diff options
author | nicosomb <nicolas@loeuillet.org> | 2013-04-21 18:09:25 +0200 |
---|---|---|
committer | nicosomb <nicolas@loeuillet.org> | 2013-04-21 18:09:25 +0200 |
commit | 44e77bfa2481090e559b56fd8ffbe5b175ab55ca (patch) | |
tree | 5a55ef08bd91ff9b989497acd01327f306d05a41 /inc | |
parent | 016989b79af1f950f449e33c76f368c307c28c19 (diff) | |
download | wallabag-44e77bfa2481090e559b56fd8ffbe5b175ab55ca.tar.gz wallabag-44e77bfa2481090e559b56fd8ffbe5b175ab55ca.tar.zst wallabag-44e77bfa2481090e559b56fd8ffbe5b175ab55ca.zip |
Fixed #55 - export des données au format json
Diffstat (limited to 'inc')
-rw-r--r-- | inc/functions.php | 8 | ||||
-rw-r--r-- | inc/store/sqlite.class.php | 8 | ||||
-rw-r--r-- | inc/store/store.class.php | 4 |
3 files changed, 19 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 | } |