Esempio n. 1
0
 public function setPathInfo($pathInfo = null)
 {
     parent::setPathInfo($pathInfo);
     $path = $this->_pathInfo;
     $paths = explode('/', trim($path, '/'));
     $language = !empty($paths[0]) ? $paths[0] : '';
     if (in_array($language, Core_Model_Language::getLanguageCodes())) {
         $this->_language_code = $language;
         unset($paths[0]);
         $paths = array_values($paths);
     }
     if (!$this->isInstalling()) {
         $paths = $this->_initApplication($paths);
         if (!$this->isApplication()) {
             $this->_initWhiteLabelEditor();
         }
     }
     // $paths = array_diff($paths, Core_Model_Language::getLanguageCodes());
     $paths = array_values($paths);
     $this->_pathInfo = '/' . implode('/', $paths);
     $detector = new Mobile_Detect();
     $this->_is_native = $detector->isNative();
     return $this;
 }
Esempio n. 2
0
 protected function _initDesign()
 {
     $detect = new Mobile_Detect();
     $design_codes = array("desktop" => "siberian", "mobile" => "angular");
     Zend_Registry::set("design_codes", $design_codes);
     if (!$this->getRequest()->isInstalling()) {
         if ($this->getRequest()->isApplication()) {
             $apptype = 'mobile';
         } else {
             $apptype = 'desktop';
         }
         if ($detect->isMobile() || $apptype == 'mobile') {
             $device_type = 'mobile';
         } else {
             $device_type = 'desktop';
         }
         if ($this->getRequest()->isApplication()) {
             $code = $design_codes["mobile"];
         } else {
             if ($this->_isInstanceOfBackoffice()) {
                 $code = 'backoffice';
             } else {
                 $code = $design_codes["desktop"];
             }
         }
     } else {
         $apptype = 'desktop';
         $device_type = 'desktop';
         $code = "installer";
     }
     $base_paths = array(APPLICATION_PATH . "/design/email/template/");
     if (!defined("APPLICATION_TYPE")) {
         define("APPLICATION_TYPE", $apptype);
     }
     if (!defined("DEVICE_TYPE")) {
         define("DEVICE_TYPE", $device_type);
     }
     if (!defined("DEVICE_IS_IPHONE")) {
         define("DEVICE_IS_IPHONE", $detect->isIphone() || $detect->isIpad());
     }
     if (!defined("IS_APPLICATION")) {
         define("IS_APPLICATION", $detect->isNative() && $this->getRequest()->isApplication());
     }
     if (!defined("DESIGN_CODE")) {
         define("DESIGN_CODE", $code);
     }
     Core_Model_Directory::setDesignPath("/app/design/{$apptype}/{$code}");
     $resources = array('resources' => array('layout' => array('layoutPath' => APPLICATION_PATH . "/design/{$apptype}/{$code}/template/page")));
     $base_paths[] = APPLICATION_PATH . "/design/{$apptype}/{$code}/template/";
     $bootstrap = Zend_Controller_Front::getInstance()->getParam("bootstrap");
     $bootstrap->setOptions($resources);
     $bootstrap->bootstrap('View');
     $view = $bootstrap->getResource('View');
     $view->doctype('HTML5');
     foreach ($base_paths as $base_path) {
         $view->addBasePath($base_path);
     }
     Core_View_Default::setDevice($detect);
     Application_Controller_Mobile_Default::setDevice($detect);
     if (!$this->getRequest()->isInstalling()) {
         $blocks = array();
         if ($this->getRequest()->isApplication()) {
             $blocks = $this->getRequest()->getApplication()->getBlocks();
         } else {
             if (!$this->_isInstanceOfBackoffice()) {
                 $blocks = $this->getRequest()->getWhiteLabelEditor()->getBlocks();
                 if ($block = $this->getRequest()->getWhiteLabelEditor()->getBlock("area")) {
                     $icon_color = $block->getColor();
                     Application_Model_Option_Value::setEditorIconColor($icon_color);
                 }
             }
         }
         if (!empty($blocks)) {
             Core_View_Default::setBlocks($blocks);
         }
     }
 }