public static function selector($langXml) { // create lang selector $langSelector = new simpleXmlElement("<lang_selector/>"); if ($langXml) { foreach ($langXml as $entry) { $langCode = $entry->getName(); //echoall($langCode); $countryCode = OLIVLang::defaultCountry($langCode); // make current language bigger $id = "oliv_lang_flag"; if ($langCode == status::lang()) { $id = "oliv_lang_flag_selected"; } //get string for url title language name $title = OLIVText::_("change_language", $langCode); $title .= " - " . OLIVText::_($langCode, $langCode); // full language name // create flag image // $img = new simpleXmlElement("<img url='" . status::url() . "' urllang='" . $langCode . "' urltitle='{$title}' src='oliv_flag' id='{$id}' lang='" . $countryCode . "' />"); $img = new simpleXmlElement("<selector><a href='current()' title='{$title}' lang='" . $langCode . "'/><img id='{$id}' lang='" . $countryCode . "'>oliv_flag</img></selector>"); // insert image olivxml_insert($langSelector, $img, "ALL"); } //echoall($langSelector->asXML()); return $langSelector; } }
public function __construct($header) { global $_argv; // status parameter found $status = (string) $header->param->status; if ($articleParam = status::$status()) { //TODO retranslate article name $header->param->content = $articleParam; } // load content $article = OLIVModule::load_content($header); // check if content exist // set article and content to "error_no_article" article if (!$article) { $article = OLIVModule::load_content($header, "error_no_article"); if (!$article) { die("no article error page defined"); } $article->content->articlename = (string) $header->param->content; // $article->argv->source = "sourcePath"; } // create edit frame $editStruct = new simpleXmlElement("<structure><article id='article_edit'/></structure>"); olivxml_insert($editStruct->article, $article->structure); // set article $this->content = $article; //TODO insert edit frame if toolbox = article_edit // set article for editing if (argv::toolbox() == "article_edit") { unset($this->content->structure); olivxml_insert($this->content, $editStruct, "ALL"); } // combine article $this->create(); // check activities $this->activities($header, $this->content); // add source and textname attribute recursive if ($article) { // get article languages $langs = OLIVText::getLanguages($article); olivxml_insert($article, OLIVLang::selector($langs), "ALL"); // load central article template // $this->template = OLIVModule::load_template($header,"default"); $this->template = OLIVModule::load_template($header); } }