return $ret;
}
+ /**
+ * get all the categories ordered by link added date
+ */
+ public function categoriesByDateAdded() {
+ $ret = array();
+ $queryStr = "SELECT category FROM `".DB_PREFIX."_combined`
+ WHERE `status` = 2
+ GROUP BY category
+ ORDER BY created DESC";
+ $query = $this->DB->query($queryStr);
+ if(!empty($query) && $query->num_rows > 0) {
+ $ret = $query->fetch_all(MYSQLI_ASSOC);
+ }
+
+ return $ret;
+ }
+
+ public function linksByCategoryString($string,$limit=5) {
+ $ret = array();
+
+ $queryStr = "SELECT * FROM `".DB_PREFIX."_combined`
+ WHERE `status` = 2
+ AND `category` = '".$this->DB->real_escape_string($string)."'
+ GROUP BY `hash`
+ ORDER BY `created` DESC";
+ $query = $this->DB->query($queryStr);
+ if(!empty($query) && $query->num_rows > 0) {
+ $ret = $query->fetch_all(MYSQLI_ASSOC);
+ }
+
+ return $ret;
+ }
}
?>
\ No newline at end of file
</form>
<?php } ?>
-<div class="row expanded small-up-3 medium-up-6">
- <div class="column">
- <div class="card">
+<div class="row expanded small-up-2 medium-up-3 large-up-4" data-equalizer data-equalize-by-row="true">
+ <div class="column" >
+ <div class="card" data-equalizer-watch>
<div class="card-divider">
<h4>Last added</h4>
</div>
</div>
</div>
</div>
- <div class="column">
- <div class="card">
- <img src="assets/img/generic/rectangle-1.jpg">
- <div class="card-section">
- <h4>This is a card.</h4>
- <p>It has an easy to override visual style, and is appropriately subdued.</p>
- </div>
- </div>
- </div>
- <div class="column">
- <div class="card">
- <img src="assets/img/generic/rectangle-1.jpg">
- <div class="card-section">
- <h4>This is a card.</h4>
- <p>It has an easy to override visual style, and is appropriately subdued.</p>
- </div>
- </div>
- </div>
- <div class="column">
- <div class="card">
- <img src="assets/img/generic/rectangle-1.jpg">
- <div class="card-section">
- <h4>This is a card.</h4>
- <p>It has an easy to override visual style, and is appropriately subdued.</p>
- </div>
- </div>
- </div>
- <div class="column">
- <div class="card">
- <img src="assets/img/generic/rectangle-1.jpg">
- <div class="card-section">
- <h4>This is a card.</h4>
- <p>It has an easy to override visual style, and is appropriately subdued.</p>
- </div>
- </div>
- </div>
- <div class="column">
- <div class="card">
- <img src="assets/img/generic/rectangle-1.jpg">
- <div class="card-section">
- <h4>This is a card.</h4>
- <p>It has an easy to override visual style, and is appropriately subdued.</p>
- </div>
- </div>
- </div>
+<?php
+ if(!empty($orderedCategories)) {
+ foreach ($orderedCategories as $cat) {
+ $links = $Management->linksByCategoryString($cat['category']);
+?>
+ <div class="column">
+ <div class="card" data-equalizer-watch>
+ <div class="card-divider">
+ <h4><?php echo $cat['category']; ?></h4>
+ </div>
+ <img src="assets/img/generic/rectangle-1.jpg">
+ <div class="card-section">
+ <ul>
+<?php foreach ($links as $link) { ?>
+ <li>
+ <a href="<?php echo $link['link']; ?>" target="_blank"><?php echo $link['title']; ?></a>
+ </li>
+<?php } ?>
+ </ul>
+ <a class="button" href="#">more</a>
+ </div>
+ </div>
+ </div>
+<?php
+ }
+ }
+?>
</div>