From 13c7f9a462b71e89d5e252b693fc7d00aca249ec Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Mon, 12 Jan 2015 19:52:41 -0500 Subject: Add ability to mark all articles from a tag as read --- inc/poche/Poche.class.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'inc') 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; -- cgit v1.2.3