public function prepareData() { // variable info that depends on displayed page if ($this->page_request != "error") { include_once getcwd() . '/web/scripts/page-data/elrh_' . $this->page_request . '_data.php'; $this->page_data = array_merge($this->page_data, ELRHPageData::prepareData($this->item_request, $this->mysqli)); } else { $this->page_data["title"] = "Alois Sečkár - Domovská stránka"; } // always presented info if ($this->page_data["mysql"] == true) { // menu include_once getcwd() . '/web/scripts/elrh_menu_creator.php'; $this->page_data["menu"] = ELRHMenuCreator::createMenuContent(); // breadcrumb navigation include_once getcwd() . '/web/scripts/elrh_navigation_creator.php'; $this->page_data["navigation"] = ELRHNavigationCreator::createNavigationContent($this->page_request, $this->item_request, $this->mysqli); // info displayed in footer // current version number and last update date $result = $this->mysqli->query("SELECT value FROM elrh_main WHERE var='last_update' OR var='system_version'"); $data = $result->fetch_array(); $this->page_data["update"] = $data["value"]; $data = $result->fetch_array(); $this->page_data["version"] = $data["value"]; } else { $this->page_data["menu"] = ' ♦ Not connected ♦ '; $this->page_data["navigation"]["top"] = '» <a href="" target="_self" title="Index">INDEX</a>'; $this->page_data["navigation"]["bottom"] = ''; $this->page_data["update"] = "???"; $this->page_data["version"] = "???"; } }
public function prepareData() { // variable initial set (to avoid possible warnings later) $this->page_data["texts"]["null"] = ""; $this->page_data["item_title"] = ""; // TODO allow other languages $this->page_data["lang"] = "cz"; // set mySQL $this->getMySQLConnection(); // variable info that depends on displayed page // mysql must work and page must exist if ($this->page_data["mysql"] == true) { if ($this->page_request != "error") { // get additional data to be displayed include_once getcwd() . '/pages/page-data/elrh_' . $this->page_request . '_data.php'; $this->page_data = array_merge($this->page_data, ELRHPageData::prepareData($this->item_request, $this->mysqli)); // get language variables for given page include_once getcwd() . '/scripts/data-helpers/elrh_text_retriever.php'; $this->page_data["texts"] = ELRHTextRetriever::getTextsForPage($this->mysqli, $this->page_data["lang"], $this->page_request); // for admin requests we need special "output" text variable if (!empty($this->page_data["admin_output"])) { $this->page_data["texts"]["admin_output"] = ELRHTextRetriever::getText($this->mysqli, $this->page_data["lang"], $this->page_data["admin_output"]); } } else { // get global site title include_once getcwd() . '/scripts/data-helpers/elrh_db_extractor.php'; $this->page_data["title"] = ELRHDataExtractor::retrieveItem($this->mysqli, "SELECT value FROM elrh_settings WHERE var='global_title'", "value"); } } // always presented info // mysql must work if ($this->page_data["mysql"] == true) { // global site text values include_once getcwd() . '/scripts/data-helpers/elrh_sitedata_retriever.php'; $this->page_data["texts"] = array_merge($this->page_data["texts"], ELRHSitedataCreator::createSiteTexts($this->mysqli, $this->page_data["lang"])); $this->page_data["settings"] = ELRHSitedataCreator::createSiteSettings($this->mysqli); // page title // concluding from global title and possibly from particular page subtitle or article/gallery/image title // global_site_title contains always presented global title - set up along with global texts // $this->page_request."_headline" stands for page headline (and therefore subtitle) - set up along with particular page texts // item_title may contain item-specific title - set up along with page data // for "index" and "error" use simplified title if ($this->page_request == "index" || $this->page_request == "error") { $this->page_data["title"] = $this->page_data["settings"]["global_title"]; } else { include_once getcwd() . '/scripts/content-helpers/elrh_title_creator.php'; $this->page_data["title"] = ELRHTitleCreator::createSiteTitle($this->page_data["settings"]["global_title"], $this->page_data["texts"][$this->page_request . "_headline"], $this->page_data["item_title"]); } // menu include_once getcwd() . '/scripts/content-helpers/elrh_menu_creator.php'; $this->page_data["menu"] = ELRHMenuCreator::createMenuContent($this->page_data["texts"]); // bottom navigation include_once getcwd() . '/scripts/content-helpers/elrh_navigation_creator.php'; $this->page_data["nav"] = ELRHNavigationCreator::createNavigationContent($this->page_data["lang"], $this->mysqli); } else { // set hard-core default values $this->page_data["title"] = 'ELRHistory Web - NoDB'; $this->page_data["menu"]["top"] = '<div id="menu"> Not connected</div>'; $this->page_data["nav"] = '» <a href="/" title="Index">INDEX</a>'; } }