コード例 #1
0
ファイル: Menu.php プロジェクト: BGCX262/zupal-svn-to-git
 /**
  *
  * @param string $pModule
  * @param string $pController
  * @return Zend_Navigation_Page
  */
 public function page($pModule = NULL, $pController = NULL)
 {
     $module = $this->module();
     if ($module) {
         if (!$module->is_active()) {
             return array();
         }
         if ($this->if_module && $pModule && $pModule != $this->module) {
             return array();
         }
         if ($this->if_controller && $pModule && $pModule != $this->module && $pController && $pController != $this->controller) {
             return array();
         }
     }
     if ($this->href) {
         $config = array('label' => $this->label, 'href' => $this->href);
         if ($this->resource) {
             $config['resource'] = $this->resource;
         }
         $page = new Zend_Navigation_Page_Uri($config);
     } else {
         $config = array('label' => $this->label, 'module' => $this->module, 'controller' => $this->controller, 'action' => $this->action);
         if ($this->resource) {
             $config['resource'] = $this->resource;
         }
         $page = new Zend_Navigation_Page_Mvc($config);
     }
     $children = array();
     foreach ($this->children() as $menu) {
         if ($c_page = $menu->page($pModule, $pController)) {
             $children[] = $c_page;
         }
     }
     if ($children) {
         $page->setPages($children);
     }
     return $page;
 }