aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-12-06 13:15:06 +0100
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-12-06 13:15:06 +0100
commit2e2ebe5ec767dcbee90394d12b03298592c87805 (patch)
treec62599a66288c6a77eeeac3bc968e3024100386e
parent68e20616663e048d47297ff251f64081b1d1fe3a (diff)
downloadwallabag-2e2ebe5ec767dcbee90394d12b03298592c87805.tar.gz
wallabag-2e2ebe5ec767dcbee90394d12b03298592c87805.tar.zst
wallabag-2e2ebe5ec767dcbee90394d12b03298592c87805.zip
[add] create tags page
-rw-r--r--inc/poche/Database.class.php14
-rw-r--r--inc/poche/Poche.class.php6
-rw-r--r--inc/poche/Tools.class.php5
-rw-r--r--themes/default/_menu.twig1
-rw-r--r--themes/default/tags.twig8
5 files changed, 29 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;
diff --git a/themes/default/_menu.twig b/themes/default/_menu.twig
index 699d6a0c..02bec1dc 100644
--- a/themes/default/_menu.twig
+++ b/themes/default/_menu.twig
@@ -2,6 +2,7 @@
2 <li><a href="./" {% if view == 'home' %}class="current"{% endif %}>{% trans "home" %}</a></li> 2 <li><a href="./" {% if view == 'home' %}class="current"{% endif %}>{% trans "home" %}</a></li>
3 <li><a href="./?view=fav" {% if view == 'fav' %}class="current"{% endif %}>{% trans "favorites" %}</a></li> 3 <li><a href="./?view=fav" {% if view == 'fav' %}class="current"{% endif %}>{% trans "favorites" %}</a></li>
4 <li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li> 4 <li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li>
5 <li><a href="./?view=tags" {% if view == 'tags' %}class="current"{% endif %}>{% trans "tags" %}</a></li>
5 <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li> 6 <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
6 <li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li> 7 <li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
7 </ul> \ No newline at end of file 8 </ul> \ No newline at end of file
diff --git a/themes/default/tags.twig b/themes/default/tags.twig
new file mode 100644
index 00000000..9421fe3e
--- /dev/null
+++ b/themes/default/tags.twig
@@ -0,0 +1,8 @@
1{% extends "layout.twig" %}
2{% block title %}tags{% endblock %}
3{% block menu %}
4{% include '_menu.twig' %}
5{% endblock %}
6{% block content %}
7{% for tag in tags %}<a href="#">{{ tag.value }}</a> {% endfor %}
8{% endblock %} \ No newline at end of file