public function getQueries(Sitengine_Permiso $permiso) { $queries = array(); require_once 'Zend/Controller/Router/Route/Module.php'; $route = new Zend_Controller_Router_Route_Module(array(), $this->getDispatcher(), $this->getRequest()); $args = array(); $queries['backendHome'] = $this->getEnv()->getMyProjectRequestDir() . '/backend/home/' . $route->assemble($args, true); $args = array(Sitengine_Env::PARAM_LOGOUT => 1); $queries['signOut'] = $this->getRequest()->getBasePath() . '/backend/home' . Sitengine_Controller_Request_Http::makeNameValueQuery($args); $args = array(); $queries['sitemapBackend'] = $this->getRequest()->getBasePath() . '/backend/sitemap/' . $route->assemble($args, true); return $queries; }
public function assemble($data = array(), $reset = false, $encode = false, $partial = false) { if (isset($data['error_handler'])) { unset($data['error_handler']); } $url = ''; if (empty($url)) { $url = parent::assemble($data, $reset, $encode, $partial); } $url = !empty($url) ? explode('/', $url) : array(); if ($this->_request->useApplicationKey()) { array_unshift($url, Application_Model_Application::OVERVIEW_PATH); } if ($this->_request->addLanguageCode() and $this->_request->getLanguageCode()) { array_unshift($url, $this->_request->getLanguageCode()); } return implode('/', $url); }
public function testGetInstanceMatching() { $this->route = Zend_Controller_Router_Route_Module::getInstance(new Zend_Config(array())); $this->_request->setModuleKey('m'); $this->_request->setControllerKey('c'); $this->_request->setActionKey('a'); $values = $this->route->match('mod/ctrl'); $this->assertType('array', $values); $this->assertSame('mod', $values['m'], var_export(array_keys($values), 1)); $this->assertSame('ctrl', $values['c'], var_export(array_keys($values), 1)); $this->assertSame('index', $values['a'], var_export(array_keys($values), 1)); }
/** * Assemble a url for this route * * @param array $data * @param bool $reset * @param bool $encode * @param bool $partial * @return string */ public function assemble($data = array(), $reset = false, $encode = true, $partial = false) { return $this->_prefix . self::URI_DELIMITER . parent::assemble($data, $reset, $encode, $partial); }
public function testGetInstance() { require_once 'Zend/Config.php'; $routeConf = array('defaults' => array('controller' => 'ctrl')); $config = new Zend_Config($routeConf); $route = Zend_Controller_Router_Route_Module::getInstance($config); $this->assertType('Zend_Controller_Router_Route_Module', $route); }
/** * Class Constructor * * @param Zend_Controller_Dispatcher_Interface $dispatcher * @param Zend_Controller_Request_Abstract $request * @return void */ public function __construct(Zend_Controller_Dispatcher_Interface $dispatcher, Zend_Controller_Request_Abstract $request) { $request->setControllerKey('page'); parent::__construct(array('module' => '', 'page' => '', 'action' => ''), $dispatcher, $request); $this->_controllerKey = 'page'; }