From f9c8087f787b6ac38ca2c3b6a876a803860b8991 Mon Sep 17 00:00:00 2001 From: Vincent Malley Date: Tue, 2 Jun 2015 11:09:28 -0400 Subject: [PATCH] [1203] fixing tag export --- inc/poche/Database.class.php | 15 +++++++++++++++ inc/poche/Poche.class.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 1a88d7d9..7be7a394 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -323,6 +323,21 @@ class Database { return $entries; } + public function retrieveAllWithTags($user_id) + { + $entries = $this->retrieveAll($user_id); + $count = count($entries); + for ($i = 0; $i < $count; $i++) { + $tag_entries = $this->retrieveTagsByEntry($entries[$i]['id']); + $tags = []; + foreach ($tag_entries as $tag) { + $tags[] = $tag[1]; + } + $entries[$i]['tags'] = implode(',', $tags); + } + return $entries; + } + public function retrieveOneById($id, $user_id) { $entry = NULL; diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 465d9f95..d297807a 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -874,7 +874,7 @@ class Poche $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json"; header('Content-Disposition: attachment; filename='.$filename); - $entries = $this->store->retrieveAll($this->user->getId()); + $entries = $this->store->retrieveAllWithTags($this->user->getId()); echo $this->tpl->render('export.twig', array( 'export' => Tools::renderJson($entries), )); -- 2.41.0