コード例 #1
0
ファイル: FooterLink.php プロジェクト: niavok/syj
 public function FooterLink($routeoptions, $text, $redirect = true, $extraclass = null, $extratext = "")
 {
     $page = new Zend_Navigation_Page_Mvc($routeoptions);
     if ($page->isActive()) {
         $link = $this->view->escape($text);
     } else {
         $href = $page->getHRef();
         if ($redirect) {
             $currentUri = $this->view->UriPath(true);
             $href = $this->view->addParamToUrl($href, 'redirect', $currentUri, true);
         }
         $link = $this->view->anchor($href, $text, array('class' => 'footer-anchor'));
     }
     $class = "footer-link";
     if (isset($extraclass)) {
         $class = "{$class} {$extraclass}";
     }
     return '<div class="' . $class . '">' . $link . $extratext . '</div>' . PHP_EOL;
 }
コード例 #2
0
ファイル: MvcTest.php プロジェクト: ThorstenSuckow/conjoon
 /**
  * @group ZF-11442
  */
 public function testIsActiveIsChainedRouteAware()
 {
     // Create page
     $page = new Zend_Navigation_Page_Mvc(array('action' => 'myaction', 'route' => 'myroute', 'params' => array('page' => 1337, 'item' => 1234)));
     // Create chained route
     $chain = new Zend_Controller_Router_Route_Chain();
     $foo = new Zend_Controller_Router_Route('lolcat/:action', array('module' => 'default', 'controller' => 'foobar', 'action' => 'bazbat'));
     $bar = new Zend_Controller_Router_Route(':page/:item', array('page' => 1, 'item' => 1));
     $chain->chain($foo)->chain($bar);
     // Set up router
     $this->_front->getRouter()->addRoute('myroute', $chain);
     $this->_front->getRequest()->setParams(array('module' => 'default', 'controller' => 'foobar', 'action' => 'myaction', 'page' => 1337, 'item' => 1234));
     // Test
     $this->assertTrue($page->isActive());
 }
コード例 #3
0
ファイル: MvcTest.php プロジェクト: omusico/logica
 /**
  * @group ZF-11550
  */
 public function testNullValuesInMatchedRouteWillStillReturnMatchedPage()
 {
     $page = new Zend_Navigation_Page_Mvc(array('route' => 'default', 'module' => 'default', 'controller' => 'index', 'action' => 'index', 'label' => 'Home', 'title' => 'Home'));
     $this->_front->getRouter()->addRoute('default', new Zend_Controller_Router_Route(':locale/:module/:controller/:action/*', array('locale' => null, 'module' => 'default', 'controller' => 'index', 'action' => 'index'), array('locale' => '.*', 'module' => '.*', 'controller' => '.*', 'action' => '.*')));
     $this->_front->getRequest()->setParams(array('locale' => 'en_US', 'module' => 'default', 'controller' => 'index', 'action' => 'index'));
     $this->assertEquals(true, $page->isActive());
 }
コード例 #4
0
 public function testIsActiveReturnsFalseWhenRequestHasLessParams()
 {
     $page = new Zend_Navigation_Page_Mvc(array('label' => 'foo', 'action' => 'view', 'controller' => 'post', 'module' => 'blog', 'params' => array('id' => '1337')));
     $this->_front->getRequest()->setParams(array('module' => 'blog', 'controller' => 'post', 'action' => 'view', 'id' => null));
     $this->assertEquals(false, $page->isActive());
 }