From 44e77bfa2481090e559b56fd8ffbe5b175ab55ca Mon Sep 17 00:00:00 2001 From: nicosomb Date: Sun, 21 Apr 2013 18:09:25 +0200 Subject: [PATCH] =?UTF-8?q?Fixed=20#55=20-=20export=20des=20donn=C3=A9es?= =?UTF-8?q?=20au=20format=20json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/functions.php | 8 +++++++- inc/store/sqlite.class.php | 8 ++++++++ inc/store/store.class.php | 4 ++++ tpl/config.html | 2 ++ tpl/export.html | 1 + 5 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tpl/export.html diff --git a/inc/functions.php b/inc/functions.php index 10005df..abf70a9 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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); diff --git a/inc/store/sqlite.class.php b/inc/store/sqlite.class.php index b2ae94a..d5208a2 100644 --- a/inc/store/sqlite.class.php +++ b/inc/store/sqlite.class.php @@ -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(); diff --git a/inc/store/store.class.php b/inc/store/store.class.php index ae3cb34..360ff7c 100644 --- a/inc/store/store.class.php +++ b/inc/store/store.class.php @@ -17,6 +17,10 @@ class Store { } + public function retrieveAll() { + + } + public function retrieveOneById($id) { } diff --git a/tpl/config.html b/tpl/config.html index a19a84f..7d1c6af 100644 --- a/tpl/config.html +++ b/tpl/config.html @@ -3,4 +3,6 @@

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, have a look here.

Drag & drop this link to your bookmarks bar and have fun with poche.

poche it !

+

Export

+

Click here to export your poche datas.

\ No newline at end of file diff --git a/tpl/export.html b/tpl/export.html new file mode 100644 index 0000000..d22d05f --- /dev/null +++ b/tpl/export.html @@ -0,0 +1 @@ +export {$export} \ No newline at end of file