Ejemplo n.º 1
0
 public function url($urlOptions = array(), $name = null, $reset = false, $encode = true)
 {
     if (!$urlOptions) {
         $urlOptions = array();
     }
     if (!$name) {
         if (Staticroute::getCurrentRoute() instanceof Staticroute) {
             $name = Staticroute::getCurrentRoute()->getName();
         }
     }
     if ($name && ($route = Staticroute::getByName($name))) {
         return $route->assemble($urlOptions, $reset, $encode);
     }
     // this is to add support for arrays as values for the default Zend_View_Helper_Url
     $unset = array();
     foreach ($urlOptions as $optionName => $optionValues) {
         if (is_array($optionValues)) {
             foreach ($optionValues as $key => $value) {
                 $urlOptions[$optionName . "[" . $key . "]"] = $value;
             }
             $unset[] = $optionName;
         }
     }
     foreach ($unset as $optionName) {
         unset($urlOptions[$optionName]);
     }
     try {
         return parent::url($urlOptions, $name, $reset, $encode);
     } catch (Exception $e) {
         throw new Exception("Route '" . $name . "' for building the URL not found");
     }
 }
Ejemplo n.º 2
0
 public function init()
 {
     parent::init();
     try {
         $this->_locale = Zend_Registry::get('Zend_Locale');
     } catch (Exception $e) {
         $this->_locale = new Zend_Locale('en');
         Zend_Registry::set('Zend_Locale', $this->_locale);
     }
     $this->view->locale = $this->_locale;
     $this->_translate = $this->initTranslation();
     $this->view->setScriptPath(array_merge($this->view->getScriptPaths(), array(PIMCORE_WEBSITE_PATH . '/views/scripts/', PIMCORE_WEBSITE_PATH . '/views/layouts/', PIMCORE_WEBSITE_PATH . '/views/scripts/blog/')));
     // additional helpers
     $this->_helper->addPrefix('Modern_Controller_Action_Helper');
     $this->view->addHelperPath('Modern/View/Helper', 'Modern_View_Helper_');
     $this->_messenger = $this->_helper->getHelper('FlashMessenger');
     Modern_View_Helper_FlashMessenger::setPartial('partial/messenger.php');
     Zend_View_Helper_PaginationControl::setDefaultViewPartial('partial/paginator-search.php');
     // fix main blog list pagination
     if (!Staticroute::getCurrentRoute() instanceof Staticroute) {
         Staticroute::setCurrentRoute(Staticroute::getByName('blog'));
     }
 }