2013-02-01 01:32:43 -08:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* e107 website system
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!defined('e107_INIT')) { exit; }
|
|
|
|
|
2013-05-29 01:22:11 -07:00
|
|
|
|
2013-11-20 17:44:06 -08:00
|
|
|
|
|
|
|
|
2013-05-29 15:33:39 -07:00
|
|
|
//FIXME XXX - This menu should call the {PAGE_NAVIGATION} shortcode instead of duplicating its code and automatically display all links.
|
2013-02-01 01:32:43 -08:00
|
|
|
|
2013-03-08 13:08:06 +02:00
|
|
|
$parm = eHelper::scParams($parm);
|
2013-05-29 01:22:11 -07:00
|
|
|
|
2014-01-04 06:02:24 -08:00
|
|
|
$tmpl = e107::getCoreTemplate('chapter','nav',true,true); // always merge and allow override
|
2013-05-29 23:00:55 -07:00
|
|
|
|
|
|
|
$template = $tmpl['showPage'];
|
2017-10-17 16:22:56 -07:00
|
|
|
/*
|
2016-02-28 20:50:09 -08:00
|
|
|
$request = e107::getRegistry('core/page/request');
|
2013-03-08 13:08:06 +02:00
|
|
|
if($request && is_array($request))
|
2013-02-14 13:06:16 +02:00
|
|
|
{
|
2013-03-08 13:08:06 +02:00
|
|
|
switch ($request['action'])
|
2013-02-14 13:06:16 +02:00
|
|
|
{
|
2013-03-08 13:08:06 +02:00
|
|
|
case 'listChapters':
|
|
|
|
$parm['cbook'] = $request['id'];
|
2013-05-29 23:00:55 -07:00
|
|
|
$template = $tmpl['listChapters'];
|
2013-03-08 13:08:06 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'listPages':
|
|
|
|
$parm['cchapter'] = $request['id'];
|
2013-05-29 23:00:55 -07:00
|
|
|
$template = $tmpl['listPages'];
|
2013-03-08 13:08:06 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'showPage':
|
|
|
|
$parm['cpage'] = $request['id'];
|
|
|
|
break;
|
2013-02-14 13:06:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-20 17:44:06 -08:00
|
|
|
$expandable = vartrue($parm['expandable']);
|
|
|
|
|
2013-03-08 13:08:06 +02:00
|
|
|
if($parm) $parm = http_build_query($parm, null, '&');
|
|
|
|
else $parm = '';
|
|
|
|
|
2013-02-14 15:37:42 +02:00
|
|
|
### Retrieve
|
2013-03-08 13:08:06 +02:00
|
|
|
$links = e107::getAddon('page', 'e_sitelink');
|
2013-02-14 15:37:42 +02:00
|
|
|
$data = $links->pageNav($parm);
|
|
|
|
if(isset($data['title']) && !vartrue($template['noAutoTitle']))
|
|
|
|
{
|
|
|
|
// use chapter title
|
|
|
|
$template['caption'] = $data['title'];
|
|
|
|
$data = $data['body'];
|
|
|
|
}
|
2013-03-08 13:08:06 +02:00
|
|
|
|
|
|
|
if(empty($data)) return;
|
2017-10-17 16:22:56 -07:00
|
|
|
$text = e107::getNav()->render($data, $template) ;*/
|
|
|
|
$pg = new page_shortcodes;
|
|
|
|
$text = $pg->sc_page_navigation($parm);
|
|
|
|
|
|
|
|
|
2013-02-01 01:32:43 -08:00
|
|
|
|
2013-11-20 17:44:06 -08:00
|
|
|
/**
|
|
|
|
* Expandable menu support.
|
|
|
|
* @see jquery.page.navigation.js . activate with expandable=1 in the page-navigation menu.
|
|
|
|
* For best results include: e107::css('page', 'css/page.navigation.css', 'jquery'); in theme.php
|
|
|
|
*/
|
|
|
|
if($expandable)
|
|
|
|
{
|
|
|
|
e107::js('page','js/jquery.page.navigation.js','jquery');
|
2014-01-28 06:41:44 -08:00
|
|
|
$template['caption'] .= "<span class='btn-group pull-right'><a class='btn btn-default btn-xs btn-mini' id='page-nav-expand'>+</a><a class='btn btn-default btn-xs btn-mini' id='page-nav-collapse'>-</a></span>";
|
2013-11-20 17:44:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-14 15:37:42 +02:00
|
|
|
### Render
|
2013-02-01 01:32:43 -08:00
|
|
|
e107::getRender()->tablerender($template['caption'], $text, 'page-navigation-menu');
|
|
|
|
|