Url.php

Go to the documentation of this file.
00001 <?php
00002 
00031 class Robo47_View_Helper_Url extends Zend_View_Helper_Abstract
00032 {
00033 
00039     protected $_router = null;
00040 
00045     public function __construct(Zend_Controller_Router_Interface $router = null)
00046     {
00047         $this->setRouter($router);
00048     }
00049 
00056     public function setRouter(Zend_Controller_Router_Interface $router = null)
00057     {
00058         if ($router === null) {
00059             $this->_router = Zend_Controller_Front::getInstance()->getRouter();
00060         } else {
00061             $this->_router = $router;
00062         }
00063         return $this;
00064     }
00065 
00071     public function getRouter()
00072     {
00073         return $this->_router;
00074     }
00075 
00084     public function url(array $urlOptions = array(), $name = null,
00085         $reset = false, $encode = true)
00086     {
00087         return $this->_router->assemble($urlOptions, $name, $reset, $encode);
00088     }
00089 }