/**
  * 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-comment':
             $sCheckFuncName = 'isAllowedComment';
             if (!empty($this->_aEvent)) {
                 $aCheckFuncParams = array($this->_aEvent);
             }
             break;
         case 'item-vote':
             $sCheckFuncName = 'isAllowedVote';
             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;
 }
예제 #2
0
 /**
  * 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-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);
 }