From bfa9850211411abf59bb2d244220e76da92b3b66 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 May 2018 17:47:03 +0200 Subject: [PATCH] NEW Add arrows to navigate into containers in website module --- htdocs/website/index.php | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3a92029e205..68eb2b8e8bb 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1516,7 +1516,7 @@ if (count($object->records) > 0) $out.=''; @@ -1535,6 +1535,37 @@ if (count($object->records) > 0) //print ''; print ''; + + // Print nav arrows + $pagepreviousid=0; + $pagenextid=0; + $sql = 'SELECT MAX(rowid) as pagepreviousid FROM '.MAIN_DB_PREFIX.'website_page WHERE rowid < '.$pageid.' AND fk_website = '.$object->id; + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) + { + $pagepreviousid = $obj->pagepreviousid; + } + } + else dol_print_error($db); + $sql = 'SELECT MIN(rowid) as pagenextid FROM '.MAIN_DB_PREFIX.'website_page WHERE rowid > '.$pageid.' AND fk_website = '.$object->id; + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) + { + $pagenextid = $obj->pagenextid; + } + } + else dol_print_error($db); + if ($pagepreviousid) print ''.img_previous($langs->trans("PreviousContainer")).''; + else print ''.img_previous($langs->trans("PreviousContainer")).''; + if ($pagenextid) print ''.img_next($langs->trans("NextContainer")).''; + else print ''.img_next($langs->trans("NextContainer")).''; + $websitepage = new WebSitePage($db); if ($pageid > 0 && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')) {