]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
[1203] fixing tag export
authorVincent Malley <vincent.malley@insalien.org>
Tue, 2 Jun 2015 15:09:28 +0000 (11:09 -0400)
committerVincent Malley <vincent.malley@insalien.org>
Tue, 2 Jun 2015 15:09:28 +0000 (11:09 -0400)
inc/poche/Database.class.php
inc/poche/Poche.class.php

index 1a88d7d9d24cfe5a61cd94ff8cb233b6fd242c7e..7be7a394ae8887ba9c6030ba6d0b89c49fcc4494 100755 (executable)
@@ -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;
index 465d9f956408da5ab39e2f8275716845f78d53d1..d297807a8a41e4a50e8533a6eff3eed418188299 100755 (executable)
@@ -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),
       ));