function __construct() { if (isset($GLOBALS['bxDolClasses'][get_class($this)])) { trigger_error('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR); } parent::__construct(); $this->oDb = BxDolLanguagesQuery::getInstance(); }
protected function loadData() { $sLanguage = BxDolLanguages::getInstance()->getCurrentLangName(); $this->setSelected('', $sLanguage); $aPage = explode('?', $_SERVER['HTTP_REFERER']); $aPageParams = array(); if (!empty($aPage[1])) { parse_str($aPage[1], $aPageParams); } $aLanguages = BxDolLanguagesQuery::getInstance()->getLanguages(false, true); $aItems = array(); foreach ($aLanguages as $sName => $sLang) { $aPageParams['lang'] = $sName; $aItems[] = array('id' => $sName, 'name' => $sName, 'class' => '', 'title' => genFlag($sName) . ' ' . $sLang, 'target' => '_self', 'icon' => '', 'link' => bx_html_attribute(bx_append_url_params($aPage[0], $aPageParams)), 'onclick' => ''); } $this->_aObject['menu_items'] = $aItems; }
protected function _isVisible($a) { if (!parent::_isVisible($a)) { return false; } $bResult = true; switch ($a['name']) { case 'switch_language': $aLanguages = BxDolLanguagesQuery::getInstance()->getLanguages(false, true); if (count($aLanguages) <= 1) { $bResult = false; } break; case 'switch_template': $aTemplates = get_templates_array(true, true); if (count($aTemplates) <= 1) { $bResult = false; } break; } return $bResult; }