コード例 #1
0
ファイル: Bootstrap.php プロジェクト: bradley-holt/postr
 protected function _initNavigation()
 {
     $this->bootstrap('frontController');
     $pages = array(array('label' => 'Home', 'id' => 'index', 'action' => 'index', 'controller' => 'index'), array('label' => 'Entries', 'id' => 'entry', 'action' => 'index', 'controller' => 'entry', 'pages' => array(array('label' => 'New', 'id' => 'entry-new', 'action' => 'new', 'controller' => 'entry'), array('action' => 'get', 'controller' => 'entry', 'visible' => false), array('action' => 'edit', 'controller' => 'entry', 'visible' => false), array('action' => 'post', 'controller' => 'entry', 'visible' => false), array('action' => 'put', 'controller' => 'entry', 'visible' => false), array('action' => 'delete', 'controller' => 'entry', 'visible' => false))));
     $resource = new Zend_Application_Resource_Navigation(array('pages' => $pages));
     $resource->setBootstrap($this);
     return $resource->init();
 }
コード例 #2
0
ファイル: Bootstrap.php プロジェクト: marcelocaixeta/zf1
 protected function _initNavigation()
 {
     $this->bootstrap('view');
     $this->bootstrap('frontController');
     $this->bootstrap('acl');
     $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav');
     $resource = new Zend_Application_Resource_Navigation(array('pages' => $config->toArray()));
     $resource->setBootstrap($this);
     return $resource->init();
 }
コード例 #3
0
ファイル: NavigationTest.php プロジェクト: travisj/zf
 /**
  * @group ZF-7461
  */
 public function testRegistryIsUsedWhenNumericRegistryValueIsGiven()
 {
     // Register view for cases where registry should/is not (be) used
     $this->bootstrap->registerPluginResource('view');
     $this->bootstrap->getPluginResource('view')->getView();
     $options1 = array('pages' => array(new Zend_Navigation_Page_Mvc(array('action' => 'index', 'controller' => 'index'))), 'storage' => array('registry' => true));
     $options = array($options1, array_merge($options1, array('storage' => array('registry' => '1'))), array_merge($options1, array('storage' => array('registry' => 1))), array_merge($options1, array('storage' => array('registry' => false))));
     $results = array();
     $key = Zend_Application_Resource_Navigation::DEFAULT_REGISTRY_KEY;
     foreach ($options as $option) {
         $resource = new Zend_Application_Resource_Navigation($option);
         $resource->setBootstrap($this->bootstrap)->init();
         $results[] = Zend_Registry::get($key) instanceof Zend_Navigation;
         Zend_Registry::set($key, null);
     }
     $this->assertEquals(array(true, true, true, false), $results);
     $this->bootstrap->unregisterPluginResource('view');
 }