1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-08 15:46:44 +02:00

Page sublink navigation

This commit is contained in:
Cameron
2012-12-17 12:14:52 -08:00
parent ed648b9ea4
commit 774f045828
2 changed files with 39 additions and 14 deletions

View File

@@ -1464,6 +1464,11 @@ class e_navigation
*/ */
protected function isDynamic($row) protected function isDynamic($row)
{ {
if(varset($row['link_sub']))
{
return $row['link_sub'];
}
if(vartrue($row['link_function'])) if(vartrue($row['link_function']))
{ {
list($path,$method) = explode("::",$row['link_function']); list($path,$method) = explode("::",$row['link_function']);

View File

@@ -46,16 +46,14 @@ class page_sitelinks // include plugin-folder in the name.
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$sublinks = array(); $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 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";
// $sql->db_Select("page","*","page_theme = '' ORDER BY page_title");
$data = $sql->retrieve($query, true); $data = $sql->retrieve($query, true);
$sublinks = array();
foreach($data as $row) foreach($data as $row)
{ {
$sublinks[] = array( $pid = $row['page_chapter'];
$sublinks[$pid][] = array(
'link_id' => $row['page_id'], 'link_id' => $row['page_id'],
'link_name' => $row['page_title'], 'link_name' => $row['page_title'],
'link_url' => 'page.php?'.$row['page_id'], 'link_url' => 'page.php?'.$row['page_id'],
@@ -63,18 +61,40 @@ class page_sitelinks // include plugin-folder in the name.
'link_button' => '', 'link_button' => '',
'link_category' => '', 'link_category' => '',
'link_order' => $row['page_order'], 'link_order' => $row['page_order'],
'link_parent' => 0, 'link_parent' => $row['page_chapter'],
'link_open' => '', 'link_open' => '',
'link_class' => intval($row['page_class']) 'link_class' => intval($row['page_class'])
); );
} }
$books = $sql->retrieve("page_chapters","*",1, true);
foreach($books as $row)
{
$arr[] = array(
'link_id' => $row['chapter_id'],
'link_name' => $row['chapter_name'],
'link_url' => 'page.php?'.$row['chapter_id'],
'link_description' => '',
'link_button' => '',
'link_category' => '',
'link_order' => $row['chapter_order'],
'link_parent' => $row['chapter_parent'],
'link_open' => '',
'link_class' => 0,
'link_sub' => varset($sublinks[$row['chapter_id']])
);
}
$outArray = array(); $outArray = array();
$ret = e107::getNav()->compile($sublinks, $outArray); $ret = e107::getNav()->compile($arr, $outArray);
// print_a($ret);
// $mes = e107::getMessage();
// $mes->addDebug( print_a($ret,true));
return $ret; return $ret;
// compile();
} }
} }