From 13c7f9a462b71e89d5e252b693fc7d00aca249ec Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Mon, 12 Jan 2015 19:52:41 -0500 Subject: [PATCH] Add ability to mark all articles from a tag as read --- inc/poche/Poche.class.php | 17 +++++++++++++++-- themes/baggy/home.twig | 2 ++ themes/default/home.twig | 4 +++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 540aa55e..20897c61 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -240,8 +240,21 @@ class Poche } break; case 'toggle_archive' : - $this->store->archiveById($id, $this->user->getId()); - Tools::logm('archive link #' . $id); + if (isset($_GET['tag_id'])) { + //when we want to archive a whole tag + $tag_id = $_GET['tag_id']; + $allentry_ids = $this->store->retrieveEntriesByTag($tag_id, $this->user->getId()); + $entry_ids = array(); + foreach ($allentry_ids as $eachentry) { + $entry_ids[] = $eachentry[0]; + } + } else { //archive a single article + $entry_ids = array($id); + } + foreach($entry_ids as $id) { + $this->store->archiveById($id, $this->user->getId()); + Tools::logm('archive link #' . $id); + } if ( Tools::isAjaxRequest() ) { echo 1; exit; diff --git a/themes/baggy/home.twig b/themes/baggy/home.twig index 9cd66395..93515080 100755 --- a/themes/baggy/home.twig +++ b/themes/baggy/home.twig @@ -62,6 +62,8 @@ {% if searchterm is defined %}{% trans "Delete results matching" %} {{ searchterm }}{% endif %}
+ {% if tag %}{% trans "Mark all articles from this tag as read" %}
{% endif %} + {% if tag %} {% if constant('EPUB') == 1 %}{% trans "Download as ePub3" %}{% endif %} {% if constant('MOBI') == 1 %}{% trans "Download as Mobi" %}{% endif %} diff --git a/themes/default/home.twig b/themes/default/home.twig index 88e6a6ea..b9000559 100755 --- a/themes/default/home.twig +++ b/themes/default/home.twig @@ -62,6 +62,8 @@ {% if searchterm is defined %}{% trans "Delete results matching" %} {{ searchterm }}{% endif %}
+ {% if tag %}{% trans "Mark all articles from this tag as read" %}
{% endif %} + {% if tag %} {% if constant('EPUB') == 1 %}{% trans "Download as ePub3" %}{% endif %} {% if constant('MOBI') == 1 %}{% trans "Download as Mobi" %}{% endif %} @@ -75,6 +77,6 @@ {% if constant('MOBI') == 1 %}{% trans "Download as Mobi" %}{% endif %} {% if constant('PDF') == 1 %}{% trans "Download as PDF" %}{% endif %} {% endif %} - + {% endif %} {% endblock %} -- 2.41.0