diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 86907e528..8e9ee0b7e 100644 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -250,13 +250,21 @@ class Database { return $this->getHandle()->lastInsertId($column); } + public function retrieveAllTags() { + $sql = "SELECT * FROM tags"; + $query = $this->executeQuery($sql, array()); + $tags = $query->fetchAll(); + + return $tags; + } + public function retrieveTagsByEntry($entry_id) { - $sql = + $sql = "SELECT * FROM tags LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id WHERE tags_entries.entry_id = ?"; - $query = $this->executeQuery($sql, array($entry_id)); - $tags = $query->fetchAll(); + $query = $this->executeQuery($sql, array($entry_id)); + $tags = $query->fetchAll(); return $tags; } diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index c9fb6382f..802ec542f 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -430,6 +430,12 @@ class Poche ); Tools::logm('config view'); break; + case 'tags': + $tags = $this->store->retrieveAllTags(); + $tpl_vars = array( + 'tags' => $tags, + ); + break; case 'view': $entry = $this->store->retrieveOneById($id, $this->user->getId()); if ($entry != NULL) { diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 750553f12..5bb65fe9a 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -103,14 +103,15 @@ class Tools case 'config': $tpl_file = 'config.twig'; break; + case 'tags': + $tpl_file = 'tags.twig'; + break; case 'view': $tpl_file = 'view.twig'; break; - case 'login': $tpl_file = 'login.twig'; break; - case 'error': $tpl_file = 'error.twig'; break; diff --git a/themes/default/_menu.twig b/themes/default/_menu.twig index 699d6a0c9..02bec1dcd 100644 --- a/themes/default/_menu.twig +++ b/themes/default/_menu.twig @@ -2,6 +2,7 @@