public static function createSiteTexts($mysqli, $lang)
 {
     // load db retrieving function
     include_once getcwd() . '/scripts/data-helpers/elrh_text_retriever.php';
     // use like getting normal site texts, just with "custom" request
     $data = ELRHTextRetriever::getTextsForPage($mysqli, $lang, "global");
     //
     return $data;
 }
 /** 
  * Builds a navigation box included at the bottom of the page. 
  */
 public static function createNavigationContent($lang, $mysqli)
 {
     // get lang variables
     include_once getcwd() . '/scripts/data-helpers/elrh_text_retriever.php';
     $data["nav_top"] = ELRHTextRetriever::getText($mysqli, $lang, "nav_top");
     $data["nav_index"] = ELRHTextRetriever::getText($mysqli, $lang, "nav_index");
     $data["nav_map"] = ELRHTextRetriever::getText($mysqli, $lang, "nav_map");
     // build navbox
     $navigation = '<p id="navbox">' . PHP_EOL;
     $navigation .= '- <a href="#top" title="' . $data["nav_top"] . '">' . $data["nav_top"] . '</a><br />' . PHP_EOL;
     $navigation .= '- <a href="/index" title="' . $data["nav_index"] . '">' . $data["nav_index"] . '</a><br />' . PHP_EOL;
     $navigation .= '- <a href="/map" title="' . $data["nav_map"] . '">' . $data["nav_map"] . '</a>' . PHP_EOL;
     $navigation .= '</p>' . PHP_EOL;
     // return navbox result
     return $navigation;
 }
Exemplo n.º 3
0
 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">&nbsp;Not connected</div>';
         $this->page_data["nav"] = '&raquo;&nbsp;<a href="/" title="Index">INDEX</a>';
     }
 }