diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-12-06 14:22:29 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-12-06 14:22:29 +0100 |
commit | 4886ed6d3637df0b3e16e672d58d4ef8f17dc432 (patch) | |
tree | 2e4255655a218eb7d42522ff3009a2826b03d002 /inc/poche/Database.class.php | |
parent | 74ec445a662aa31f713bc50e74c9366da336538a (diff) | |
download | wallabag-4886ed6d3637df0b3e16e672d58d4ef8f17dc432.tar.gz wallabag-4886ed6d3637df0b3e16e672d58d4ef8f17dc432.tar.zst wallabag-4886ed6d3637df0b3e16e672d58d4ef8f17dc432.zip |
[add] page which lists entries for a tag
Diffstat (limited to 'inc/poche/Database.class.php')
-rw-r--r-- | inc/poche/Database.class.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 8e9ee0b7..a89bce41 100644 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -258,6 +258,27 @@ class Database { | |||
258 | return $tags; | 258 | return $tags; |
259 | } | 259 | } |
260 | 260 | ||
261 | public function retrieveTag($id) { | ||
262 | $tag = NULL; | ||
263 | $sql = "SELECT * FROM tags WHERE id=?"; | ||
264 | $params = array(intval($id)); | ||
265 | $query = $this->executeQuery($sql, $params); | ||
266 | $tag = $query->fetchAll(); | ||
267 | |||
268 | return isset($tag[0]) ? $tag[0] : null; | ||
269 | } | ||
270 | |||
271 | public function retrieveEntriesByTag($tag_id) { | ||
272 | $sql = | ||
273 | "SELECT * FROM entries | ||
274 | LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id | ||
275 | WHERE tags_entries.tag_id = ?"; | ||
276 | $query = $this->executeQuery($sql, array($tag_id)); | ||
277 | $entries = $query->fetchAll(); | ||
278 | |||
279 | return $entries; | ||
280 | } | ||
281 | |||
261 | public function retrieveTagsByEntry($entry_id) { | 282 | public function retrieveTagsByEntry($entry_id) { |
262 | $sql = | 283 | $sql = |
263 | "SELECT * FROM tags | 284 | "SELECT * FROM tags |