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
'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(
{
$views = array(
'install', 'import', 'export', 'config', 'tags',
- 'edit-tags', 'view', 'login', 'error'
+ 'edit-tags', 'view', 'login', 'error', 'tag'
);
if (in_array($view, $views)) {
--- /dev/null
+{% extends "layout.twig" %}
+{% block title %}tag {% endblock %}
+{% block menu %}
+{% include '_menu.twig' %}
+{% endblock %}
+{% block content %}
+ <h3>{% trans "Tag" %} {{ tag.value }}</h3>
+ {% if entries is empty %}
+ <div class="messages warning"><p>{% trans "No link available here!" %}</p></div>
+ {% else %}
+ {% block pager %}
+ {% if nb_results > 1 %}
+ <div class="results">
+ <div class="nb-results">{{ nb_results }} {% trans "results" %}</div>
+ {{ page_links | raw }}
+ </div>
+ {% endif %}
+ {% endblock %}
+ {% for entry in entries %}
+ <div id="entry-{{ entry.id|e }}" class="entrie">
+ <h2><a href="index.php?view=view&id={{ entry.id|e }}">{{ entry.title|raw }}</a></h2>
+ <ul class="tools">
+ <li><a title="{% trans "toggle mark as read" %}" class="tool {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="./?action=toggle_archive&id={{ entry.id|e }}"><span>{% trans "toggle mark as read" %}</span></a></li>
+ <li><a title="{% trans "toggle favorite" %}" class="tool {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="./?action=toggle_fav&id={{ entry.id|e }}"><span>{% trans "toggle favorite" %}</span></a></li>
+ <li><a title="{% trans "delete" %}" class="tool delete" href="./?action=delete&id={{ entry.id|e }}"><span>{% trans "delete" %}</span></a></li>
+ <li><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}" class="tool link"><span>{{ entry.url | e | getDomain }}</span></a></li>
+ <li><a target="_blank" title="{% trans "estimated reading time:" %} {{ entry.content| getReadingTime }} min" class="reading-time"><span>{{ entry.content| getReadingTime }} min</span></a></li>
+ </ul>
+ <p>{{ entry.content|striptags|slice(0, 300) }}...</p>
+ </div>
+ {% endfor %}
+ {% endif %}
+{% endblock %}
\ No newline at end of file
{% include '_menu.twig' %}
{% endblock %}
{% block content %}
-{% for tag in tags %}<a href="#">{{ tag.value }}</a> {% endfor %}
+{% for tag in tags %}<a href="./?view=tag&id={{ tag.id }}">{{ tag.value }}</a> {% endfor %}
{% endblock %}
\ No newline at end of file
<h1>{{ entry.title|raw }}</h1>
</header>
<aside class="tags">
- tags: {% for tag in tags %}<a href="#">{{ tag.value }}</a> {% endfor %}<a href="./?&view=edit-tags&id={{ entry.id|e }}" title="{% trans "edit tags" %}">✎</a>
+ tags: {% for tag in tags %}<a href="#">{{ tag.value }}</a> {% endfor %}<a href="./?view=edit-tags&id={{ entry.id|e }}" title="{% trans "edit tags" %}">✎</a>
</aside>
<article>
{{ content | raw }}