aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornicosomb <nicolas@loeuillet.org>2013-04-21 18:09:25 +0200
committernicosomb <nicolas@loeuillet.org>2013-04-21 18:09:25 +0200
commit44e77bfa2481090e559b56fd8ffbe5b175ab55ca (patch)
tree5a55ef08bd91ff9b989497acd01327f306d05a41
parent016989b79af1f950f449e33c76f368c307c28c19 (diff)
downloadwallabag-44e77bfa2481090e559b56fd8ffbe5b175ab55ca.tar.gz
wallabag-44e77bfa2481090e559b56fd8ffbe5b175ab55ca.tar.zst
wallabag-44e77bfa2481090e559b56fd8ffbe5b175ab55ca.zip
Fixed #55 - export des données au format json
-rw-r--r--inc/functions.php8
-rw-r--r--inc/store/sqlite.class.php8
-rw-r--r--inc/store/store.class.php4
-rw-r--r--tpl/config.html2
-rw-r--r--tpl/export.html1
5 files changed, 22 insertions, 1 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 10005dfe..abf70a93 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -232,6 +232,12 @@ function display_view($view, $id = 0, $full_head = 'yes')
232 232
233 switch ($view) 233 switch ($view)
234 { 234 {
235 case 'export':
236 $entries = $store->retrieveAll();
237 $tpl->assign('export', json_encode($entries));
238 $tpl->draw('export');
239 logm('export view');
240 break;
235 case 'config': 241 case 'config':
236 $tpl->assign('load_all_js', 0); 242 $tpl->assign('load_all_js', 0);
237 $tpl->draw('head'); 243 $tpl->draw('head');
@@ -240,7 +246,7 @@ function display_view($view, $id = 0, $full_head = 'yes')
240 $tpl->draw('js'); 246 $tpl->draw('js');
241 $tpl->draw('footer'); 247 $tpl->draw('footer');
242 logm('config view'); 248 logm('config view');
243 break; 249 break;
244 case 'view': 250 case 'view':
245 $entry = $store->retrieveOneById($id); 251 $entry = $store->retrieveOneById($id);
246 252
diff --git a/inc/store/sqlite.class.php b/inc/store/sqlite.class.php
index b2ae94a7..d5208a29 100644
--- a/inc/store/sqlite.class.php
+++ b/inc/store/sqlite.class.php
@@ -38,6 +38,14 @@ class Sqlite extends Store {
38 } 38 }
39 } 39 }
40 40
41 public function retrieveAll() {
42 $sql = "SELECT * FROM entries ORDER BY id";
43 $query = $this->executeQuery($sql, array());
44 $entries = $query->fetchAll();
45
46 return $entries;
47 }
48
41 public function retrieveOneById($id) { 49 public function retrieveOneById($id) {
42 parent::__construct(); 50 parent::__construct();
43 51
diff --git a/inc/store/store.class.php b/inc/store/store.class.php
index ae3cb341..360ff7c2 100644
--- a/inc/store/store.class.php
+++ b/inc/store/store.class.php
@@ -17,6 +17,10 @@ class Store {
17 17
18 } 18 }
19 19
20 public function retrieveAll() {
21
22 }
23
20 public function retrieveOneById($id) { 24 public function retrieveOneById($id) {
21 25
22 } 26 }
diff --git a/tpl/config.html b/tpl/config.html
index a19a84fe..7d1c6afe 100644
--- a/tpl/config.html
+++ b/tpl/config.html
@@ -3,4 +3,6 @@
3 <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> 3 <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>
4 <p>Drag & drop this link to your bookmarks bar and have fun with poche.</p> 4 <p>Drag & drop this link to your bookmarks bar and have fun with poche.</p>
5 <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> 5 <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>
6 <h2>Export</h2>
7 <p><a href="?view=export" target="_blank">Click here</a> to export your poche datas.</p>
6 </div> \ No newline at end of file 8 </div> \ No newline at end of file
diff --git a/tpl/export.html b/tpl/export.html
new file mode 100644
index 00000000..d22d05fc
--- /dev/null
+++ b/tpl/export.html
@@ -0,0 +1 @@
export {$export} \ No newline at end of file