1
0
mirror of https://github.com/e107inc/e107.git synced 2025-05-03 02:38:06 +02:00

Page Navigation shortcode supports book selection {PAGE_NAVIGATION=book=X] where X is the ID number of the book.

This commit is contained in:
Cameron 2012-12-19 02:03:34 -08:00
parent 1bde493891
commit 7aea21b10c
2 changed files with 41 additions and 6 deletions

View File

@ -283,7 +283,7 @@ class page_admin_ui extends e_admin_ui
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'page_id' => array('title'=> 'ID', 'width'=>'5%', 'forced'=> TRUE),
'page_chapter' => array('title'=> 'Book/Chapter', 'type' => 'dropdown', 'width' => '10%', 'filter' => true, 'batch'=>true),
'page_chapter' => array('title'=> 'Book/Chapter', 'type' => 'dropdown', 'width' => '20%', 'filter' => true, 'batch'=>true),
'page_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width'=>'25%','readParms'=>'link={e_BASE}page.php?[id]&dialog=1'),
'page_theme' => array('title'=> CUSLAN_2, 'type' => 'text', 'width' => 'auto','nolist'=>true),
@ -300,7 +300,7 @@ class page_admin_ui extends e_admin_ui
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>'sort=1')
);
protected $fieldpref = array("page_id","page_title","page_template","page_author","page_class");
protected $fieldpref = array("page_id","page_title","page_chapter","page_template","page_author","page_class");
protected $books = array();

View File

@ -28,12 +28,22 @@ class page_sitelinks // include plugin-folder in the name.
function pageNav()
function pageNav($parm='')
{
if(vartrue($parm))
{
parse_str($parm,$options);
}
$sql = e107::getDb();
$sublinks = array();
$arr = array();
$query = "SELECT p.*, c.* FROM #page AS p LEFT JOIN #page_chapters AS c ON p.page_chapter = c.chapter_id ORDER BY c.chapter_order,p.page_order";
$query = "SELECT * FROM #page WHERE ";
$query .= vartrue($options['chapter']) ? "page_chapter = ".intval($options['chapter']) : 1;
$query .= " ORDER BY page_order";
// $query .= vartrue($options['limit']) ? " LIMIT ".intval($options['limit']) : "";
$data = $sql->retrieve($query, true);
foreach($data as $row)
@ -53,7 +63,22 @@ class page_sitelinks // include plugin-folder in the name.
);
}
$books = $sql->retrieve("page_chapters","*", 1, true);
// $filter = vartrue($options['book']) ? "chapter_id = ".intval($options['book']) : 1;
$filter = 1;
if(vartrue($options['chapter']))
{
$filter = "chapter_id > ".intval($options['chapter']);
}
if(vartrue($options['book']))
{
$filter = "chapter_id > ".intval($options['book']);
}
$books = $sql->retrieve("SELECT * FROM #page_chapters WHERE ".$filter." ORDER BY chapter_order ASC" , true);
foreach($books as $row)
{
@ -72,11 +97,21 @@ class page_sitelinks // include plugin-folder in the name.
'link_sub' => varset($sublinks[$row['chapter_id']])
);
$parent = vartrue($options['book']) ? intval($row['chapter_parent']) : 0;
}
// print_a($arr);
// echo "<h3>Compiled</h3>";
$outArray = array();
$ret = e107::getNav()->compile($arr, $outArray);
$ret = e107::getNav()->compile($arr, $outArray, $parent);
// print_a($ret);
// $mes = e107::getMessage();
// $mes->addDebug( print_a($ret,true));