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

List pages by chapter may now include the chapter title and chapter description.

This commit is contained in:
Cameron
2013-12-19 22:46:24 -08:00
parent 62509f09fb
commit 590add3c4a
2 changed files with 19 additions and 11 deletions

View File

@@ -11,7 +11,7 @@
* Template for Book and Chapter Listings, as well as navigation on those pages. * Template for Book and Chapter Listings, as well as navigation on those pages.
*/ */
$CHAPTER_TEMPLATE['default']['listPages']['caption'] = "{CHAPTER_NAME}";
$CHAPTER_TEMPLATE['default']['listPages']['start'] = "<ul class='page-pages-list'>"; $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']['item'] = "<li><a href='{CPAGEURL}'>{CPAGETITLE}</a></li>";
$CHAPTER_TEMPLATE['default']['listPages']['end'] = "</ul>"; $CHAPTER_TEMPLATE['default']['listPages']['end'] = "</ul>";

View File

@@ -50,8 +50,9 @@ elseif(vartrue($_GET['ch'])) // List Pages within a specific Chapter
require_once(HEADERF); require_once(HEADERF);
$text = $e107CorePage->listPages($_GET['ch'],$template); $data = $e107CorePage->listPages($_GET['ch']);
$ns->tablerender('', $text, 'cpage'); // TODO FIXME Caption eg. "book title" $ns->tablerender($data['caption'], $data['text'], 'cpage');
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
} }
@@ -307,17 +308,22 @@ class pageClass
$sql = e107::getDb('pg'); $sql = e107::getDb('pg');
$tp = e107::getParser(); $tp = e107::getParser();
$this->batch = e107::getScBatch('page',null,'cpage'); $this->batch = e107::getScBatch('page',null,'cpage');
$frm = e107::getForm();
// retrieve the template to use for this chapter. // retrieve the template to use for this chapter.
if(!$layout = $sql->retrieve('page_chapters','chapter_template','chapter_id = '.intval($chapt).' LIMIT 1')) $row = $sql->retrieve('page_chapters','chapter_id,chapter_icon,chapter_name,chapter_meta_description,chapter_template','chapter_id = '.intval($chapt).' LIMIT 1');
{ $layout = vartrue($row['chapter_template'],'default');
$layout = 'default';
}
$tml = e107::getCoreTemplate('chapter','', true, true); // always merge $tml = e107::getCoreTemplate('chapter','', true, true); // always merge
$tmpl = varset($tml[$layout]); $tmpl = varset($tml[$layout]);
$var = array(
'CHAPTER_NAME' => $tp->toHtml($row['chapter_name']),
'CHAPTER_ANCHOR' => $frm->name2id($row['chapter_name']),
'CHAPTER_ICON' => $this->chapterIcon($row['chapter_icon']),
'CHAPTER_DESCRIPTION' => $tp->toHtml($row['chapter_meta_description'], true,'BODY')
);
// $tmpl = e107::getCoreTemplate('chapter','docs', true, true); // always merge // $tmpl = e107::getCoreTemplate('chapter','docs', true, true); // always merge
$template = $tmpl['listPages']; $template = $tmpl['listPages'];
@@ -332,7 +338,8 @@ class pageClass
$pageArray = $sql->db_getList(); $pageArray = $sql->db_getList();
$text .= $template['start']; $header = $tp->simpleParse($template['start'],$var);
$text .= $tp->parseTemplate($header,true); // for parsing {SETIMAGE} etc.
foreach($pageArray as $page) foreach($pageArray as $page)
{ {
@@ -349,15 +356,16 @@ class pageClass
$text .= e107::getParser()->parseTemplate($template['item'], true, $this->batch); $text .= e107::getParser()->parseTemplate($template['item'], true, $this->batch);
} }
$text .= $template['end']; $text .= $tp->simpleParse($template['end'],$var);
// $caption = ($title !='')? $title: LAN_PAGE_11; // $caption = ($title !='')? $title: LAN_PAGE_11;
// e107::getRender()->tablerender($caption, $text,"cpage_list"); // e107::getRender()->tablerender($caption, $text,"cpage_list");
} }
$caption = $tp->simpleParse($template['caption'],$var);
return $text; return array('caption'=>$caption, 'text'=> $text);
} }