コード例 #1
0
 /**
  * Set the visibility of the menu item and any sub items in accordance
  * with the specified user role.
  *
  * @param \Zend_Acl $acl
  * @param string $userRole
  * @return \Gems_Menu_MenuAbstract (continuation pattern)
  */
 protected function applyAcl(\Zend_Acl $acl, $userRole)
 {
     parent::applyAcl($acl, $userRole);
     if ($this->isVisible()) {
         $this->set('allowed', false);
         $this->set('visible', false);
         if ($this->_subItems) {
             foreach ($this->_subItems as $item) {
                 if ($item->get('visible', true)) {
                     $this->set('allowed', true);
                     $this->set('visible', true);
                     return $this;
                 }
             }
         }
     }
     return $this;
 }