mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Book listing template added.
This commit is contained in:
@@ -19,7 +19,9 @@ class page_shortcodes extends e_shortcode
|
||||
|
||||
$this->request = e107::getRegistry('core/pages/request');
|
||||
|
||||
if((varset($this->request['action']) == 'listPages' || varset($this->request['action']) == 'listChapters') && vartrue($this->request['id']))
|
||||
$action = varset($this->request['action']);
|
||||
|
||||
if(($action == 'listPages' || $action == 'listChapters') && vartrue($this->request['id']))
|
||||
{
|
||||
$this->var = e107::getDb()->retrieve('page_chapters','chapter_name, chapter_meta_description','chapter_id = '.intval($this->request['id']).' LIMIT 1');
|
||||
}
|
||||
@@ -33,7 +35,7 @@ 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);
|
||||
|
||||
|
||||
$tmpl = e107::getCoreTemplate('chapter', vartrue($parm['template'],'nav'), true, true); // always merge
|
||||
|
||||
$template = $tmpl['showPage'];
|
||||
@@ -44,6 +46,15 @@ class page_shortcodes extends e_shortcode
|
||||
{
|
||||
switch ($request['action'])
|
||||
{
|
||||
case 'listBooks':
|
||||
$parm['cbook'] = 'all';
|
||||
$template = $tmpl['listBooks'];
|
||||
if(e107::getPref('listBooks',false) == false) // List Books has been disabled.
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'listChapters':
|
||||
$parm['cbook'] = $request['id'];
|
||||
$template = $tmpl['listChapters'];
|
||||
@@ -52,6 +63,7 @@ class page_shortcodes extends e_shortcode
|
||||
case 'listPages':
|
||||
$parm['cchapter'] = $request['id'];
|
||||
$template = $tmpl['listPages'];
|
||||
|
||||
break;
|
||||
|
||||
case 'showPage':
|
||||
@@ -69,7 +81,7 @@ class page_shortcodes extends e_shortcode
|
||||
$parm = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$links = e107::getAddon('page', 'e_sitelink');
|
||||
|
||||
$data = $links->pageNav($parm);
|
||||
|
@@ -122,12 +122,14 @@ 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']);
|
||||
$parent = intval($options['book']);
|
||||
$title = $sql->retrieve('page_chapters', 'chapter_name', 'chapter_id='.intval($options['book']));
|
||||
|
||||
// print_a('parent='.$parent);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,11 +156,11 @@ class page_sitelink // include plugin-folder in the name.
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$outArray = array();
|
||||
$parent = vartrue($options['book']) ? $options['book'] : 0;
|
||||
$ret = e107::getNav()->compile($arr, $outArray, $parent);
|
||||
|
||||
$outArray = array();
|
||||
$parent = vartrue($options['book']) ? intval($options['book']) : 0;
|
||||
$ret = e107::getNav()->compile($arr, $outArray, $parent);
|
||||
|
||||
if(!$title) return $ret;
|
||||
return array('title' => $title, 'body' => $ret);
|
||||
}
|
||||
|
Reference in New Issue
Block a user