listPages(); $tmp = $e107CorePage->listBooks(); if(is_array($tmp)) { $ns->tablerender($tmp['title'], $tmp['text']); require_once(FOOTERF); exit; } } else { $e107CorePage->processViewPage(); require_once(HEADERF); echo $e107CorePage->showPage(); require_once(FOOTERF); exit; } /* EOF */ class pageClass { public $bullet; /* bullet image */ public $pageText; /* main text of selected page, not parsed */ public $multipageFlag; /* flag - true if multiple page page, false if not */ public $pageTitles; /* array containing page titles */ public $pageID; /* id number of page to be displayed */ public $pageSelected; /* selected page of multiple page page */ public $pageToRender; /* parsed page to be sent to screen */ public $debug; /* temp debug flag */ public $title; /* title of page, it if has one (as defined in [newpage=title] tag */ public $page; /* page DB data */ public $batch; /* shortcode batch object */ public $template; /* current template array */ protected $authorized; /* authorized status */ public $cacheString; /* current page cache string */ public $cacheTitleString; /* current page title and comment flag cache string */ public $cacheData = null; /* cache data */ function __construct($debug=FALSE) { /* constructor */ $tmp = explode(".", e_QUERY); $this->pageID = intval($tmp[0]); $this->pageSelected = (isset($tmp[1]) ? intval($tmp[1]) : 0); $this->pageTitles = array(); $this->bullet = ''; // TODO nq_ (no query) cache string $this->cacheString = 'page_'.$this->pageID.'_'.$this->pageSelected; $this->cacheTitleString = 'page-t_'.$this->pageID.'_'.$this->pageSelected; if(defined('BULLET')) { $this->bullet = ""; } elseif(file_exists(THEME.'images/bullet2.gif')) { $this->bullet = ""; } elseif(file_exists(THEME.'images/bullet2.png')) { $this->bullet = ""; } $this->debug = $debug; if($this->debug) { $this->debug = "PageID ".$this->pageID."
"; $this->debug .= "pageSelected ".$this->pageSelected."
"; } } //XXX - May be better to compile into assoc 'tree' array first. ie. books/chapters/pages. function listBooks() { $sql = e107::getDb('sql2'); $tp = e107::getParser(); if($sql->db_Select("page_chapters", "*", "chapter_parent ='0' ORDER BY chapter_order ASC ")) { while($row = $sql->db_Fetch()) { $text .= "

".$tp->toHtml($row['chapter_name'])."

"; // Book Title. $text .= $this->listChapters($row['chapter_id']); } } $text .= "

Other Pages

"; // Book Title. $text .= $this->listPages(0); // Pages unassigned to Book/Chapters. e107::getRender()->tablerender(LAN_PAGE_11, $text,"cpage_list"); } //XXX - May be better to compile into assoc 'tree' array first. ie. books/chapters/pages. function listChapters($book=1) { $sql = e107::getDb(); $tp = e107::getParser(); if($sql->db_Select("page_chapters", "*", "chapter_parent = ".intval($book)." ORDER BY chapter_order ASC ")) { while($row = $sql->db_Fetch()) { $text .= "

".$tp->toHtml($row['chapter_name'])."

"; // Chapter Title. $text .= $this->listPages(intval($row['chapter_id'])); } } return $text; } // TODO template for page list function listPages($chapt=0) { $sql = e107::getDb(); $tp = e107::getParser(); if(!e107::getPref('listPages', false)) { message_handler("MESSAGE", LAN_PAGE_1); } else { if(!$sql->db_Select("page", "*", "page_theme='' AND page_chapter=".$chapt." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC ")) { $text = LAN_PAGE_2; } else { $pageArray = $sql->db_getList(); foreach($pageArray as $page) { $url = e107::getUrl()->create('page/view', $page, 'allow=page_id,page_sef'); $text .= $this->bullet." ".$tp->toHtml($page['page_title'])."
"; //XXX Better to use