1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-20 05:11:42 +02:00

Pages/Menus: each book/chapter now has it's own template.

This commit is contained in:
Cameron
2013-05-29 23:00:55 -07:00
parent 19b616dae4
commit 7b88d1cb6d
11 changed files with 254 additions and 195 deletions

View File

@@ -33,8 +33,10 @@ class page_shortcodes extends e_shortcode
function sc_page_navigation($parm='') // TODO when No $parm provided, auto-detect based on URL which book/chapters to display.
{
// $parm = eHelper::scParams($parm);
$template = e107::getCoreTemplate('page',vartrue($parm['template'],'nav'), true, true); // always merge
$tmpl = e107::getCoreTemplate('chapter', vartrue($parm['template'],'nav'), true, true); // always merge
$template = $tmpl['showPage'];
$request = $this->request;
@@ -44,10 +46,12 @@ class page_shortcodes extends e_shortcode
{
case 'listChapters':
$parm['cbook'] = $request['id'];
$template = $tmpl['listChapters'];
break;
case 'listPages':
$parm['cchapter'] = $request['id'];
$template = $tmpl['listPages'];
break;
case 'showPage':
@@ -67,8 +71,8 @@ class page_shortcodes extends e_shortcode
$links = e107::getAddon('page', 'e_sitelink');
$data = $links->pageNav($parm);
$data = $links->pageNav($parm);
if(isset($data['title']) && !vartrue($template['noAutoTitle']))
{

View File

@@ -111,6 +111,7 @@ class page_sitelink // include plugin-folder in the name.
if(vartrue($options['chapter']))
{
//$filter = "chapter_id > ".intval($options['chapter']);
$title = $sql->retrieve('page_chapters', 'chapter_name', 'chapter_id='.intval($options['chapter']));
$outArray = array();
if(!$title) return e107::getNav()->compile($_pdata, $outArray, $options['chapter']);
@@ -121,6 +122,7 @@ class page_sitelink // include plugin-folder in the name.
$title = false;
if(vartrue($options['book']))
{
// XXX discuss the idea here
//$filter = "chapter_id > ".intval($options['book']);
$filter = "chapter_parent = ".intval($options['book']);
@@ -132,6 +134,7 @@ class page_sitelink // include plugin-folder in the name.
$books = $sql->retrieve("SELECT * FROM #page_chapters WHERE ".$filter." ORDER BY chapter_order ASC" , true);
foreach($books as $row)
{
$arr[] = array(
'link_id' => $row['chapter_id'],
'link_name' => $row['chapter_name'],
@@ -146,11 +149,12 @@ class page_sitelink // include plugin-folder in the name.
'link_parent' => $row['chapter_parent'],
'link_open' => '',
'link_class' => 0,
'link_sub' => varset($sublinks[$row['chapter_id']]),
'link_sub' => (!vartrue($options['book']) && !vartrue($options['auto'])) ? varset($sublinks[$row['chapter_id']]) : '', //XXX always test with docs template in bootstrap before changing.
'link_active' => $row['chapter_parent'] == 0 ? $options['cbook'] && $options['cbook'] == $row['chapter_id'] : $options['cchapter'] && $options['cchapter'] == $row['chapter_id'],
);
}
$outArray = array();
$parent = vartrue($options['book']) ? $options['book'] : 0;
$ret = e107::getNav()->compile($arr, $outArray, $parent);

View File

@@ -15,7 +15,9 @@ if (!defined('e107_INIT')) { exit; }
$parm = eHelper::scParams($parm);
$template = e107::getCoreTemplate('page','nav',false,true); // always merge
$tmpl = e107::getCoreTemplate('chapter','nav',false,true); // always merge
$template = $tmpl['showPage'];
$request = e107::getRegistry('core/pages/request');
if($request && is_array($request))
@@ -24,10 +26,12 @@ if($request && is_array($request))
{
case 'listChapters':
$parm['cbook'] = $request['id'];
$template = $tmpl['listChapters'];
break;
case 'listPages':
$parm['cchapter'] = $request['id'];
$template = $tmpl['listPages'];
break;
case 'showPage':