From a1953dff8f39b225b408c3046246e9446a01f305 Mon Sep 17 00:00:00 2001 From: nicosomb Date: Fri, 19 Apr 2013 11:41:12 +0200 Subject: =?UTF-8?q?tout=20est=20recentr=C3=A9=20sur=20index.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/functions.php | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index 13acd36f..ef1fc0e2 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -226,10 +226,55 @@ function remove_directory($directory) } } +function display_view($view, $id = 0, $full_head = 'yes') +{ + global $tpl; + + switch ($view) + { + case 'view': + $entry = get_article($id); + + if ($entry != NULL) { + $tpl->assign('id', $entry[0]['id']); + $tpl->assign('url', $entry[0]['url']); + $tpl->assign('title', $entry[0]['title']); + $tpl->assign('content', $entry[0]['content']); + $tpl->assign('is_fav', $entry[0]['is_fav']); + $tpl->assign('is_read', $entry[0]['is_read']); + $tpl->assign('load_all_js', 0); + $tpl->draw('view'); + } + else { + logm('error in view call : entry is NULL'); + } + + logm('view link #' . $id); + break; + default: # home view + $entries = get_entries($view); + + $tpl->assign('entries', $entries); + + if ($full_head == 'yes') { + $tpl->assign('load_all_js', 1); + $tpl->draw('head'); + $tpl->draw('home'); + } + + $tpl->draw('entries'); + + if ($full_head == 'yes') { + $tpl->draw('js'); + $tpl->draw('footer'); + } + break; + } +} + /** * Appel d'une action (mark as fav, archive, delete) */ - function action_to_do($action, $url, $id = 0) { global $db; -- cgit v1.2.3