mirror of
https://github.com/e107inc/e107.git
synced 2025-04-14 09:32:17 +02:00
Pages/Menus: each book/chapter now has it's own template.
This commit is contained in:
parent
19b616dae4
commit
7b88d1cb6d
@ -128,11 +128,14 @@ class page_chapters_ui extends e_admin_ui
|
||||
'chapter_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>FALSE, 'batch' => FALSE, 'filter'=>FALSE),
|
||||
'chapter_parent' => array('title'=> "Book", 'type' => 'dropdown', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE, 'filter'=>true),
|
||||
'chapter_name' => array('title'=> "Book or Chapter Title", 'type' => 'method', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
|
||||
'chapter_template' => array('title'=> LAN_TEMPLATE, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
|
||||
|
||||
'chapter_meta_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'width' => 'auto', 'thclass' => 'left','readParms' => 'expand=...&truncate=150&bb=1', 'readonly'=>FALSE),
|
||||
'chapter_meta_keywords' => array('title'=> "Meta Keywords", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
|
||||
'chapter_sef' => array('title'=> "SEF Url String", 'type' => 'text', 'width' => 'auto', 'readonly'=>FALSE), // Display name
|
||||
'chapter_manager' => array('title'=> "Can be edited by", 'type' => 'userclass', 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
|
||||
'chapter_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'right', 'class'=> 'right' ),
|
||||
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => 'method', 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'left last', 'class' => 'left', 'readParms'=>'sort=1')
|
||||
|
||||
);
|
||||
@ -153,9 +156,23 @@ class page_chapters_ui extends e_admin_ui
|
||||
$this->books[$bk] = $row['chapter_name'];
|
||||
}
|
||||
|
||||
asort($this->books);
|
||||
asort($this->books);
|
||||
|
||||
$this->fields['chapter_parent']['writeParms'] = $this->books;
|
||||
|
||||
|
||||
$tmp = e107::getLayouts('', 'chapter', 'front', '', true, false);
|
||||
$tmpl = array();
|
||||
foreach($tmp as $key=>$val)
|
||||
{
|
||||
if(substr($key,0,3) != 'nav')
|
||||
{
|
||||
$tmpl[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$this->fields['chapter_template']['writeParms'] = $tmpl; // e107::getLayouts('', 'chapter', 'front', '', true, false); // e107::getLayouts('', 'page', 'books', 'front', true, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -410,6 +410,7 @@ CREATE TABLE page_chapters (
|
||||
chapter_manager tinyint(3) unsigned NOT NULL default '254',
|
||||
chapter_icon varchar(250) NOT NULL default '',
|
||||
chapter_order tinyint(3) unsigned NOT NULL default '0',
|
||||
chapter_template varchar(50) NOT NULL default '',
|
||||
PRIMARY KEY (chapter_id),
|
||||
KEY chapter_order (chapter_order)
|
||||
) ENGINE=MyISAM;
|
||||
|
105
e107_core/templates/chapter_template.php
Normal file
105
e107_core/templates/chapter_template.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?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)
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Template for Book and Chapter Listings, as well as navigation on those pages.
|
||||
*/
|
||||
|
||||
|
||||
$CHAPTER_TEMPLATE['default']['listPages']['start'] = "<ul class='page-pages-list'>";
|
||||
$CHAPTER_TEMPLATE['default']['listPages']['item'] = "<li><a href='{CPAGEURL}'>{CPAGETITLE}</a></li>";
|
||||
$CHAPTER_TEMPLATE['default']['listPages']['end'] = "</ul>";
|
||||
|
||||
$CHAPTER_TEMPLATE['default']['listChapters']['start'] = "<ul class='page-chapters-list'>";
|
||||
$CHAPTER_TEMPLATE['default']['listChapters']['item'] = "<li><h4>{CHAPTER_NAME}</h4>{PAGES}";
|
||||
$CHAPTER_TEMPLATE['default']['listChapters']['end'] = "</ul>";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['caption'] = "Articles";
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['start'] = '<ul class="page-nav">';
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['item'] = '
|
||||
<li>
|
||||
<a role="button" href="{LINK_URL}" >
|
||||
{LINK_NAME}
|
||||
</a>
|
||||
</li>
|
||||
';
|
||||
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['item_submenu'] = '
|
||||
<li>
|
||||
<a role="button" href="{LINK_URL}" >
|
||||
{LINK_NAME}
|
||||
</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['item_submenu_active'] = '
|
||||
<li class="active">
|
||||
<a role="button" href="{LINK_URL}">
|
||||
{LINK_IMAGE} {LINK_NAME}
|
||||
</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['item_active'] = '
|
||||
<li class="active">
|
||||
<a crole="button" href="{LINK_URL}">
|
||||
{LINK_IMAGE} {LINK_NAME}
|
||||
</a>
|
||||
</li>
|
||||
';
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['end'] = '</ul>';
|
||||
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['submenu_start'] = '<ul class="page-nav" id="page-nav-{LINK_PARENT}" role="menu" >';
|
||||
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['submenu_item'] = '
|
||||
<li role="menuitem" >
|
||||
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_NAME}</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['submenu_loweritem'] = '
|
||||
<li role="menuitem" >
|
||||
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_NAME}</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['submenu_loweritem_active'] = '
|
||||
<li role="menuitem" class="active">
|
||||
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_NAME}</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['submenu_item_active'] = '
|
||||
<li role="menuitem" class="active">
|
||||
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_NAME}</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listChapters']['submenu_end'] = '</ul>';
|
||||
|
||||
|
||||
$CHAPTER_TEMPLATE['nav']['listPages'] = $CHAPTER_TEMPLATE['nav']['listChapters'];
|
||||
$CHAPTER_TEMPLATE['nav']['showPage'] = $CHAPTER_TEMPLATE['nav']['listChapters'];
|
||||
|
||||
?>
|
@ -96,96 +96,7 @@ $sc_style['CPAGENAV|default']['post'] = '</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Used by {PAGE_NAVIGATION} shortcode - uses Sitelink/Navigation Shortcodes eg. {LINK_NAME} */
|
||||
|
||||
$PAGE_TEMPLATE['nav']['caption'] = "Articles";
|
||||
|
||||
$PAGE_TEMPLATE['nav']['start'] = '<ul class="page-nav">';
|
||||
|
||||
// Main Link
|
||||
$PAGE_TEMPLATE['nav']['item'] = '
|
||||
<li>
|
||||
<a role="button" href="{LINK_URL}" >
|
||||
{LINK_NAME}
|
||||
</a>
|
||||
</li>
|
||||
';
|
||||
|
||||
// Main Link which has a sub menu.
|
||||
$PAGE_TEMPLATE['nav']['item_submenu'] = '
|
||||
<li>
|
||||
<a role="button" href="{LINK_URL}" >
|
||||
{LINK_NAME}
|
||||
</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$PAGE_TEMPLATE['nav']['item_submenu_active'] = '
|
||||
<li class="active">
|
||||
<a role="button" href="{LINK_URL}">
|
||||
{LINK_IMAGE} {LINK_NAME}
|
||||
</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$PAGE_TEMPLATE['nav']['item_active'] = '
|
||||
<li class="active">
|
||||
<a crole="button" href="{LINK_URL}">
|
||||
{LINK_IMAGE} {LINK_NAME}
|
||||
</a>
|
||||
</li>
|
||||
';
|
||||
|
||||
$PAGE_TEMPLATE['nav']['end'] = '</ul>';
|
||||
|
||||
|
||||
$PAGE_TEMPLATE['nav']['submenu_start'] = '<ul class="page-nav" id="page-nav-{LINK_PARENT}" role="menu" >';
|
||||
|
||||
|
||||
$PAGE_TEMPLATE['nav']['submenu_item'] = '
|
||||
<li role="menuitem" >
|
||||
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_NAME}</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$PAGE_TEMPLATE['nav']['submenu_loweritem'] = '
|
||||
<li role="menuitem" >
|
||||
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_NAME}</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
$PAGE_TEMPLATE['nav']['submenu_loweritem_active'] = '
|
||||
<li role="menuitem" class="active">
|
||||
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_NAME}</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$PAGE_TEMPLATE['nav']['submenu_item_active'] = '
|
||||
<li role="menuitem" class="active">
|
||||
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_NAME}</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$PAGE_TEMPLATE['nav']['submenu_end'] = '</ul>';
|
||||
|
||||
|
||||
|
||||
$PAGE_TEMPLATE['listPages']['start'] = "<ul class='page-pages-list'>";
|
||||
$PAGE_TEMPLATE['listPages']['item'] = "<li><a href='{CPAGEURL}'>{CPAGETITLE}</a></li>";
|
||||
$PAGE_TEMPLATE['listPages']['end'] = "</ul>";
|
||||
|
||||
|
||||
$PAGE_TEMPLATE['listChapters']['start'] = "<ul class='page-chapters-list'>";
|
||||
$PAGE_TEMPLATE['listChapters']['item'] = "<li><h4>{CHAPTER_NAME}</h4>{PAGES}";
|
||||
$PAGE_TEMPLATE['listChapters']['end'] = "</ul>";
|
||||
|
||||
|
||||
|
||||
|
@ -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']))
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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':
|
||||
|
55
e107_themes/bootstrap/templates/chapter_template.php
Normal file
55
e107_themes/bootstrap/templates/chapter_template.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?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)
|
||||
*
|
||||
*/
|
||||
|
||||
$CHAPTER_TEMPLATE['docs']['listPages']['start'] = '';
|
||||
$CHAPTER_TEMPLATE['docs']['listPages']['item'] = '
|
||||
<section id="{CPAGEANCHOR}">
|
||||
<div class="page-header">
|
||||
<h1>{CPAGETITLE}</h1>
|
||||
</div>
|
||||
{CPAGEBODY}
|
||||
</section>
|
||||
';
|
||||
$CHAPTER_TEMPLATE['docs']['listPages']['end'] = '';
|
||||
|
||||
|
||||
$CHAPTER_TEMPLATE['docs']['listChapters']['start'] = '<section id="{CPAGEANCHOR}">';
|
||||
$CHAPTER_TEMPLATE['docs']['listChapters']['item'] = "<a href='{CHAPTER_URL}'><h1>{CHAPTER_NAME}</h1></a>
|
||||
{CHAPTER_DESCRIPTION}
|
||||
";
|
||||
$CHAPTER_TEMPLATE['docs']['listChapters']['end'] = "</section>";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$CHAPTER_TEMPLATE['navdocs']['listChapters']['caption'] = " ";
|
||||
|
||||
$CHAPTER_TEMPLATE['navdocs']['listChapters']['start'] = '<ul class="nav nav-list bs-docs-sidenav">';
|
||||
|
||||
$CHAPTER_TEMPLATE['navdocs']['listChapters']['item'] = '
|
||||
<li>
|
||||
<a role="button" href="{LINK_ANCHOR}" ><i class="icon-chevron-right"></i>
|
||||
{LINK_NAME}
|
||||
</a>
|
||||
</li>
|
||||
';
|
||||
|
||||
|
||||
$CHAPTER_TEMPLATE['navdocs']['listPages'] = $CHAPTER_TEMPLATE['navdocs']['listChapters'];
|
||||
$CHAPTER_TEMPLATE['navdocs']['showPage'] = $CHAPTER_TEMPLATE['navdocs']['listChapters'];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@ -1,83 +1,14 @@
|
||||
<?php
|
||||
/*
|
||||
* <ul class="nav nav-list bs-docs-sidenav">
|
||||
<li><a href="#download-bootstrap"><i class="icon-chevron-right"></i> Download</a></li>
|
||||
<li><a href="#file-structure"><i class="icon-chevron-right"></i> File structure</a></li>
|
||||
<li><a href="#contents"><i class="icon-chevron-right"></i> What's included</a></li>
|
||||
<li><a href="#html-template"><i class="icon-chevron-right"></i> HTML template</a></li>
|
||||
<li><a href="#examples"><i class="icon-chevron-right"></i> Examples</a></li>
|
||||
<li><a href="#what-next"><i class="icon-chevron-right"></i> What next?</a></li>
|
||||
</ul>
|
||||
*/
|
||||
$PAGE_TEMPLATE['navdoc']['caption'] = " ";
|
||||
|
||||
$PAGE_TEMPLATE['navdoc']['start'] = '<ul class="nav nav-list bs-docs-sidenav">';
|
||||
|
||||
// Main Link
|
||||
$PAGE_TEMPLATE['navdoc']['item'] = '
|
||||
<li>
|
||||
<a role="button" href="{LINK_ANCHOR}" ><i class="icon-chevron-right"></i>
|
||||
{LINK_NAME}
|
||||
</a>
|
||||
</li>
|
||||
';
|
||||
|
||||
// Main Link which has a sub menu.
|
||||
$PAGE_TEMPLATE['navdoc']['item_submenu'] = '
|
||||
<li>
|
||||
<a role="button" href="{LINK_URL}" >
|
||||
{LINK_NAME}
|
||||
</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$PAGE_TEMPLATE['navdoc']['item_submenu_active'] = '
|
||||
<li class="active">
|
||||
<a role="button" href="{LINK_URL}">
|
||||
{LINK_IMAGE} {LINK_NAME}
|
||||
</a>
|
||||
{LINK_SUB}
|
||||
</li>
|
||||
';
|
||||
|
||||
$PAGE_TEMPLATE['navdoc']['item_active'] = '
|
||||
<li class="active">
|
||||
<a crole="button" href="{LINK_URL}">
|
||||
{LINK_IMAGE} {LINK_NAME}
|
||||
</a>
|
||||
</li>
|
||||
';
|
||||
|
||||
$PAGE_TEMPLATE['navdoc']['end'] = '</ul>';
|
||||
|
||||
|
||||
$PAGE_TEMPLATE['navdoc']['submenu_start'] = '';
|
||||
$PAGE_TEMPLATE['navdoc']['submenu_item'] = '';
|
||||
$PAGE_TEMPLATE['navdoc']['submenu_loweritem'] = '';
|
||||
$PAGE_TEMPLATE['navdoc']['submenu_loweritem_active'] = '';
|
||||
$PAGE_TEMPLATE['navdoc']['submenu_item_active'] = '';
|
||||
$PAGE_TEMPLATE['navdoc']['submenu_end'] = '';
|
||||
|
||||
|
||||
|
||||
$PAGE_TEMPLATE['listPages']['start'] = '';
|
||||
$PAGE_TEMPLATE['listPages']['item'] = '
|
||||
<section id="{CPAGEANCHOR}">
|
||||
<div class="page-header">
|
||||
<h1>{CPAGETITLE}</h1>
|
||||
</div>
|
||||
{CPAGEBODY}
|
||||
</section>
|
||||
';
|
||||
$PAGE_TEMPLATE['listPages']['end'] = '';
|
||||
|
||||
|
||||
$PAGE_TEMPLATE['listChapters']['start'] = '<section id="{CPAGEANCHOR}">';
|
||||
$PAGE_TEMPLATE['listChapters']['item'] = "<a href='{CHAPTER_URL}'><h1>{CHAPTER_NAME}</h1></a>
|
||||
{CHAPTER_DESCRIPTION}
|
||||
";
|
||||
$PAGE_TEMPLATE['listChapters']['end'] = "</section>";
|
||||
* 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)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -430,7 +430,7 @@ $HEADER['docs'] = <<<TMPL
|
||||
|
||||
<div class="span3 bs-docs-sidebar">
|
||||
{SETSTYLE=navdoc}
|
||||
{PAGE_NAVIGATION: template=navdoc&auto=1}
|
||||
{PAGE_NAVIGATION: template=navdocs&auto=1}
|
||||
</div>
|
||||
{SETSTYLE=doc}
|
||||
|
||||
|
69
page.php
69
page.php
@ -171,9 +171,9 @@ class pageClass
|
||||
$sql = e107::getDb('sql2');
|
||||
$tp = e107::getParser();
|
||||
|
||||
if($sql->db_Select("page_chapters", "*", "chapter_parent ='0' ORDER BY chapter_order ASC "))
|
||||
if($sql->select("page_chapters", "*", "chapter_parent ='0' ORDER BY chapter_order ASC "))
|
||||
{
|
||||
while($row = $sql->db_Fetch())
|
||||
while($row = $sql->fetch())
|
||||
{
|
||||
$text .= "<h3 class='page-book-list'>".$tp->toHtml($row['chapter_name'])."</h3>"; // Book Title.
|
||||
$text .= $this->listChapters($row['chapter_id']);
|
||||
@ -186,20 +186,31 @@ class pageClass
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//XXX - May be better to compile into assoc 'tree' array first. ie. books/chapters/pages.
|
||||
/**
|
||||
* Parse the Book/Chapter "listChapters' template
|
||||
*/
|
||||
function listChapters($book=1)
|
||||
{
|
||||
$sql = e107::getDb('chap');
|
||||
$tp = e107::getParser();
|
||||
|
||||
$template = e107::getCoreTemplate('page','listChapters', true, true); // always merge
|
||||
|
||||
if($sql->db_Select("page_chapters", "*", "chapter_parent = ".intval($book)." ORDER BY chapter_order ASC "))
|
||||
// retrieve the template to use for this book
|
||||
if(!$layout = $sql->retrieve('page_chapters','chapter_template','chapter_id = '.intval($book).' LIMIT 1'))
|
||||
{
|
||||
$text .= $template['start']; // "<ul class='page-chapters-list'>";
|
||||
while($row = $sql->db_Fetch())
|
||||
$layout = 'default';
|
||||
}
|
||||
|
||||
|
||||
$tml = e107::getCoreTemplate('chapter','', true, true); // always merge
|
||||
$tmpl = varset($tml[$layout]);
|
||||
|
||||
$template = $tmpl['listChapters'];
|
||||
|
||||
if($sql->select("page_chapters", "*", "chapter_parent = ".intval($book)." ORDER BY chapter_order ASC "))
|
||||
{
|
||||
$text .= $template['start'];
|
||||
|
||||
while($row = $sql->fetch())
|
||||
{
|
||||
$var = array(
|
||||
'CHAPTER_NAME' => $tp->toHtml($row['chapter_name']),
|
||||
@ -209,27 +220,43 @@ class pageClass
|
||||
);
|
||||
|
||||
$text .= $tp->simpleParse($template['item'],$var);
|
||||
// $text .= "<li>";
|
||||
// $text .= "<h4>".$tp->toHtml($row['chapter_name'])."</h4>"; // Chapter Title.
|
||||
// $text .= $this->listPages(intval($row['chapter_id']));
|
||||
// $text .= "</li>";
|
||||
|
||||
}
|
||||
$text .= $template['end'];
|
||||
// $text .= "</ul>";
|
||||
|
||||
$text .= $template['end'];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = e107::getMessage()->addInfo("There are no chapters in this book")->render();
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function listPages($chapt=0)
|
||||
{
|
||||
$sql = e107::getDb('pg');
|
||||
$tp = e107::getParser();
|
||||
$this->batch = e107::getScBatch('page',null,'cpage');
|
||||
|
||||
$template = e107::getCoreTemplate('page','listPages',true,true); // always merge
|
||||
|
||||
// retrieve the template to use for this chapter.
|
||||
if(!$layout = $sql->retrieve('page_chapters','chapter_template','chapter_id = '.intval($chapt).' LIMIT 1'))
|
||||
{
|
||||
$layout = 'default';
|
||||
}
|
||||
|
||||
$tml = e107::getCoreTemplate('chapter','', true, true); // always merge
|
||||
$tmpl = varset($tml[$layout]);
|
||||
|
||||
|
||||
// $tmpl = e107::getCoreTemplate('chapter','docs', true, true); // always merge
|
||||
$template = $tmpl['listPages'];
|
||||
|
||||
|
||||
|
||||
if(!e107::getPref('listPages', false))
|
||||
{
|
||||
@ -239,10 +266,10 @@ class pageClass
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$count = $sql->db_Select("page", "*", "page_title !='' AND page_chapter=".intval($chapt)." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC "))
|
||||
if(!$count = $sql->select("page", "*", "page_title !='' AND page_chapter=".intval($chapt)." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC "))
|
||||
{
|
||||
|
||||
$text = "<ul class='page-pages-list page-pages-none'><li>".LAN_PAGE_2."</li></ul>";
|
||||
return e107::getMessage()->addInfo(LAN_PAGE_2)->render();
|
||||
// $text = "<ul class='page-pages-list page-pages-none'><li>".LAN_PAGE_2."</li></ul>";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user