[1203] fixing tag export

This commit is contained in:
Vincent Malley 2015-06-02 11:09:28 -04:00
parent 727c35d809
commit f9c8087f78
2 changed files with 16 additions and 1 deletions

View file

@ -323,6 +323,21 @@ class Database {
return $entries; 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) public function retrieveOneById($id, $user_id)
{ {
$entry = NULL; $entry = NULL;

View file

@ -874,7 +874,7 @@ class Poche
$filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json"; $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json";
header('Content-Disposition: attachment; filename='.$filename); 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( echo $this->tpl->render('export.twig', array(
'export' => Tools::renderJson($entries), 'export' => Tools::renderJson($entries),
)); ));