]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fixed #55 - export des données au format json
authornicosomb <nicolas@loeuillet.org>
Sun, 21 Apr 2013 16:09:25 +0000 (18:09 +0200)
committernicosomb <nicolas@loeuillet.org>
Sun, 21 Apr 2013 16:09:25 +0000 (18:09 +0200)
inc/functions.php
inc/store/sqlite.class.php
inc/store/store.class.php
tpl/config.html
tpl/export.html [new file with mode: 0644]

index 10005dfe141623cffe39e4a19408845278b9b035..abf70a93429794a5bc60fced734f07466e87dda6 100644 (file)
@@ -232,6 +232,12 @@ function display_view($view, $id = 0, $full_head = 'yes')
 
     switch ($view)
     {
+        case 'export':
+            $entries = $store->retrieveAll();
+            $tpl->assign('export', json_encode($entries));
+            $tpl->draw('export');
+            logm('export view');
+            break;
         case 'config':
             $tpl->assign('load_all_js', 0);
             $tpl->draw('head');
@@ -240,7 +246,7 @@ function display_view($view, $id = 0, $full_head = 'yes')
             $tpl->draw('js');
             $tpl->draw('footer');
             logm('config view');
-        break;
+            break;
         case 'view':
             $entry = $store->retrieveOneById($id);
 
index b2ae94a7f2418caaee93154decc0b5770826e10f..d5208a295865e488118d307c2168143326a5d883 100644 (file)
@@ -38,6 +38,14 @@ class Sqlite extends Store {
         }
     }
 
+    public function retrieveAll() {
+        $sql        = "SELECT * FROM entries ORDER BY id";
+        $query      = $this->executeQuery($sql, array());
+        $entries    = $query->fetchAll();
+
+        return $entries;
+    }
+
     public function retrieveOneById($id) {
         parent::__construct();
 
index ae3cb3411acc775cb4cf54ebaf6bb8b2e9225850..360ff7c20e5f06950f42f5ec4d91455ac620ea1c 100644 (file)
@@ -17,6 +17,10 @@ class Store {
 
     }
 
+    public function retrieveAll() {
+        
+    }
+
     public function retrieveOneById($id) {
 
     }
index a19a84feaade2a529c5bbe55e4dd72eed4b11227..7d1c6afe6ad81686233c50f9e1716147edbe7679 100644 (file)
@@ -3,4 +3,6 @@
                <p>Thanks to the bookmarklet, you will be able to easily add a link to your poche. If you don't know how use a bookmarklet, <a href="http://support.mozilla.org/en-US/kb/bookmarklets-perform-common-web-page-tasks">have a look here</a>.</p>
                <p>Drag & drop this link to your bookmarks bar and have fun with poche.</p>
                 <p><a style="cursor: move; border: 1px dashed grey; background: white;" title="i am a bookmarklet, use me !" href="javascript:(function(){var%20url%20=%20location.href%20||%20url;window.open('{$poche_url}?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it !</a></p>
+                <h2>Export</h2>
+                <p><a href="?view=export" target="_blank">Click here</a> to export your poche datas.</p>
             </div>
\ No newline at end of file
diff --git a/tpl/export.html b/tpl/export.html
new file mode 100644 (file)
index 0000000..d22d05f
--- /dev/null
@@ -0,0 +1 @@
+export {$export}
\ No newline at end of file