From 4b5c8a61f5aa2085db27f2f3deadb7da7857cd8c 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/courgette/home.twig | 2 ++ themes/default/home.twig | 2 ++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index b9b96cc..779554b 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 7dfd248..6cf22b0 100755 --- a/themes/baggy/home.twig +++ b/themes/baggy/home.twig @@ -64,6 +64,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 %}

{% trans "Download the articles from this tag in an epub" %}

{% elseif search_term is defined %}

{% trans "Download the articles from this search in an epub" %}

diff --git a/themes/courgette/home.twig b/themes/courgette/home.twig index b3b9947..208f20a 100755 --- a/themes/courgette/home.twig +++ b/themes/courgette/home.twig @@ -57,6 +57,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 %}{% trans "Download the articles from this tag in an epub" %} {% elseif searchterm is defined %}{% trans "Download the articles from this search in an epub" %} {% else %}{% trans "Download the articles from this category in an epub" %}{% endif %} diff --git a/themes/default/home.twig b/themes/default/home.twig index 3662070..4eab6f7 100755 --- a/themes/default/home.twig +++ b/themes/default/home.twig @@ -66,6 +66,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 %}{% trans "Download the articles from this tag in an epub" %} {% elseif searchterm is defined %}{% trans "Download the articles from this search in an epub" %} {% else %}{% trans "Download the articles from this category in an epub" %}{% endif %}