/** * Check if menu items is visible. * @param $a menu item array * @return boolean */ protected function _isVisible($a) { if (!parent::_isVisible($a)) { return false; } $sCheckFuncName = ''; $aCheckFuncParams = array(); switch ($a['name']) { case 'item-edit': $sCheckFuncName = 'isEditAllowed'; if (!empty($this->_aCmt)) { $aCheckFuncParams = array($this->_aCmt); } break; case 'item-delete': $sCheckFuncName = 'isRemoveAllowed'; if (!empty($this->_aCmt)) { $aCheckFuncParams = array($this->_aCmt); } break; case 'item-vote': $sCheckFuncName = 'isVoteAllowed'; if (!empty($this->_aCmt)) { $aCheckFuncParams = array($this->_aCmt); } break; case 'item-reply': $sCheckFuncName = 'isPostReplyAllowed'; break; } if (!$sCheckFuncName || !method_exists($this->_oCmts, $sCheckFuncName)) { return true; } return call_user_func_array(array($this->_oCmts, $sCheckFuncName), $aCheckFuncParams); }
/** * Check if menu items are visible with extended checking * @param $a menu item array * @return boolean */ protected function _isVisible($a) { if ($a['name'] == 'studio' && !isAdmin()) { return false; } return parent::_isVisible($a); }
/** * Check if menu items is visible. * @param $a menu item array * @return boolean */ protected function _isVisible($a) { if (!parent::_isVisible($a)) { return false; } $sCheckFuncName = ''; $aCheckFuncParams = array(); switch ($a['name']) { case 'item-delete': $sCheckFuncName = 'isAllowedDelete'; if (!empty($this->_aEvent)) { $aCheckFuncParams = array($this->_aEvent); } break; } if (!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName)) { return true; } return call_user_func_array(array($this->_oModule, $sCheckFuncName), $aCheckFuncParams) === true; }
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; }
/** * Check if menu items is visible. * @param $a menu item array * @return boolean */ protected function _isVisible($a) { if (!parent::_isVisible($a)) { return false; } $aEvent = $this->_oModule->_oDb->getEvents(array('browse' => 'id', 'value' => $this->_iEvent)); if (empty($aEvent) || !is_array($aEvent)) { return false; } $sCheckFuncName = ''; $aCheckFuncParams = array(); switch ($a['name']) { case 'item-delete': $sCheckFuncName = 'isAllowedDelete'; $aCheckFuncParams = array($aEvent); break; } if (!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName)) { return true; } return call_user_func_array(array($this->_oModule, $sCheckFuncName), $aCheckFuncParams) === true; }