コード例 #1
0
ファイル: Mvc.php プロジェクト: BGCX262/zym-svn-to-git
 /**
  * Returns bool value indicating whether page is active or not
  * 
  * This method will compare the page against the request object.
  *
  * @param  bool $recursive  [optional] whether page should be
  *                          considered active if any child pages
  *                          are active, defaults to false
  * @return bool
  */
 public function isActive($recursive = false)
 {
     if (!$this->_active) {
         $front = Zend_Controller_Front::getInstance();
         $reqParams = $front->getRequest()->getParams();
         $myParams = $this->_params;
         if (null !== $this->_module) {
             $myParams['module'] = $this->_module;
         } else {
             $myParams['module'] = $front->getDefaultModule();
         }
         if (null !== $this->_controller) {
             $myParams['controller'] = $this->_controller;
         } else {
             $myParams['controller'] = $front->getDefaultControllerName();
         }
         if (null !== $this->_action) {
             $myParams['action'] = $this->_action;
         } else {
             $myParams['action'] = $front->getDefaultAction();
         }
         if (count(array_intersect_assoc($reqParams, $myParams)) == count($myParams)) {
             return $this->_active = true;
         }
     }
     return parent::isActive($recursive);
 }