diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/poche/Database.class.php | 14 | ||||
-rw-r--r-- | inc/poche/Poche.class.php | 6 | ||||
-rw-r--r-- | inc/poche/Tools.class.php | 5 |
3 files changed, 20 insertions, 5 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 86907e52..8e9ee0b7 100644 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -250,13 +250,21 @@ class Database { | |||
250 | return $this->getHandle()->lastInsertId($column); | 250 | return $this->getHandle()->lastInsertId($column); |
251 | } | 251 | } |
252 | 252 | ||
253 | public function retrieveAllTags() { | ||
254 | $sql = "SELECT * FROM tags"; | ||
255 | $query = $this->executeQuery($sql, array()); | ||
256 | $tags = $query->fetchAll(); | ||
257 | |||
258 | return $tags; | ||
259 | } | ||
260 | |||
253 | public function retrieveTagsByEntry($entry_id) { | 261 | public function retrieveTagsByEntry($entry_id) { |
254 | $sql = | 262 | $sql = |
255 | "SELECT * FROM tags | 263 | "SELECT * FROM tags |
256 | LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id | 264 | LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id |
257 | WHERE tags_entries.entry_id = ?"; | 265 | WHERE tags_entries.entry_id = ?"; |
258 | $query = $this->executeQuery($sql, array($entry_id)); | 266 | $query = $this->executeQuery($sql, array($entry_id)); |
259 | $tags = $query->fetchAll(); | 267 | $tags = $query->fetchAll(); |
260 | 268 | ||
261 | return $tags; | 269 | return $tags; |
262 | } | 270 | } |
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index c9fb6382..802ec542 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -430,6 +430,12 @@ class Poche | |||
430 | ); | 430 | ); |
431 | Tools::logm('config view'); | 431 | Tools::logm('config view'); |
432 | break; | 432 | break; |
433 | case 'tags': | ||
434 | $tags = $this->store->retrieveAllTags(); | ||
435 | $tpl_vars = array( | ||
436 | 'tags' => $tags, | ||
437 | ); | ||
438 | break; | ||
433 | case 'view': | 439 | case 'view': |
434 | $entry = $this->store->retrieveOneById($id, $this->user->getId()); | 440 | $entry = $this->store->retrieveOneById($id, $this->user->getId()); |
435 | if ($entry != NULL) { | 441 | if ($entry != NULL) { |
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 750553f1..5bb65fe9 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php | |||
@@ -103,14 +103,15 @@ class Tools | |||
103 | case 'config': | 103 | case 'config': |
104 | $tpl_file = 'config.twig'; | 104 | $tpl_file = 'config.twig'; |
105 | break; | 105 | break; |
106 | case 'tags': | ||
107 | $tpl_file = 'tags.twig'; | ||
108 | break; | ||
106 | case 'view': | 109 | case 'view': |
107 | $tpl_file = 'view.twig'; | 110 | $tpl_file = 'view.twig'; |
108 | break; | 111 | break; |
109 | |||
110 | case 'login': | 112 | case 'login': |
111 | $tpl_file = 'login.twig'; | 113 | $tpl_file = 'login.twig'; |
112 | break; | 114 | break; |
113 | |||
114 | case 'error': | 115 | case 'error': |
115 | $tpl_file = 'error.twig'; | 116 | $tpl_file = 'error.twig'; |
116 | break; | 117 | break; |