1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-01 17:38:38 +00:00

[add] page which lists entries for a tag

This commit is contained in:
Nicolas Lœuillet 2013-12-06 14:22:29 +01:00
parent 74ec445a66
commit 4886ed6d36
6 changed files with 65 additions and 3 deletions

View file

@ -258,6 +258,27 @@ class Database {
return $tags;
}
public function retrieveTag($id) {
$tag = NULL;
$sql = "SELECT * FROM tags WHERE id=?";
$params = array(intval($id));
$query = $this->executeQuery($sql, $params);
$tag = $query->fetchAll();
return isset($tag[0]) ? $tag[0] : null;
}
public function retrieveEntriesByTag($tag_id) {
$sql =
"SELECT * FROM entries
LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id
WHERE tags_entries.tag_id = ?";
$query = $this->executeQuery($sql, array($tag_id));
$entries = $query->fetchAll();
return $entries;
}
public function retrieveTagsByEntry($entry_id) {
$sql =
"SELECT * FROM tags

View file

@ -437,6 +437,14 @@ class Poche
'tags' => $tags,
);
break;
case 'tag':
$entries = $this->store->retrieveEntriesByTag($id);
$tag = $this->store->retrieveTag($id);
$tpl_vars = array(
'tag' => $tag,
'entries' => $entries,
);
break;
case 'tags':
$tags = $this->store->retrieveAllTags();
$tpl_vars = array(

View file

@ -90,7 +90,7 @@ class Tools
{
$views = array(
'install', 'import', 'export', 'config', 'tags',
'edit-tags', 'view', 'login', 'error'
'edit-tags', 'view', 'login', 'error', 'tag'
);
if (in_array($view, $views)) {