Esempio n. 1
0
 protected function _initDesign()
 {
     if (!$this->_request->isInstalling()) {
         $request = $this->_request;
         $this->_prepareBlocks();
     }
     $locale = Zend_Registry::get('Zend_Locale');
     $lang = Core_Model_Language::getCurrentLanguage();
     $detect = new Mobile_Detect();
     $this->getPluginLoader()->addPrefixPath('Siberian_Application_Resource', 'Siberian/Application/Resource');
     if (!$this->_request->isInstalling()) {
         if ($this->_request->isApplication()) {
             $apptype = 'mobile';
         } else {
             $apptype = 'desktop';
         }
         if ($detect->isMobile() || $apptype == 'mobile') {
             $device_type = 'mobile';
         } else {
             $device_type = 'desktop';
         }
         $code = 'siberian';
     } else {
         $apptype = 'desktop';
         $device_type = 'desktop';
         $code = "installer";
     }
     $base_paths = array(APPLICATION_PATH . "/design/email/template/");
     define('APPLICATION_TYPE', $apptype);
     define('DEVICE_TYPE', $device_type);
     define('DEVICE_IS_IPHONE', $detect->isIphone() || $detect->isIpad());
     define('IS_APPLICATION', $detect->isApplication() && $this->_request->isApplication());
     Core_Model_Directory::setDesignPath("/app/design/{$apptype}/{$code}");
     define('DESIGN_CODE', $code);
     $resources = array('resources' => array('layout' => array('layoutPath' => APPLICATION_PATH . "/design/{$apptype}/{$code}/template/page")));
     $base_paths[] = APPLICATION_PATH . "/design/{$apptype}/{$code}/template/";
     $this->setOptions($resources);
     $this->bootstrap('View');
     $view = $this->getResource('View');
     $view->doctype('HTML5');
     foreach ($base_paths as $base_path) {
         $view->addBasePath($base_path);
     }
     Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNeverRender(true);
     Core_View_Default::setDevice($detect);
 }
Esempio n. 2
0
 public static function setBlocks($blocks)
 {
     self::$_blocks = $blocks;
 }
Esempio n. 3
0
 protected function _initAcl()
 {
     if (!$this->getRequest()->isInstalling()) {
         $is_editor = !$this->getRequest()->isApplication() && !$this->_isInstanceOfBackoffice();
         if ($is_editor and $this->getSession()->isLoggedIn()) {
             $acl = new Acl_Model_Acl();
             $acl->prepare($this->getSession()->getAdmin());
             Core_View_Default::setAcl($acl);
             Admin_Controller_Default::setAcl($acl);
         }
     }
 }
Esempio n. 4
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->_messages = $this->getSession()->getMessages();
 }
 public function deleteAction()
 {
     if ($datas = $this->getRequest()->getPost()) {
         try {
             if (empty($datas['value_id'])) {
                 throw new Exception($this->_('An error occurred while deleting the option'));
             }
             // Récupère les données de l'application pour cette option
             $option_value = new Application_Model_Option_Value();
             $option_value->find($datas['value_id']);
             // Option folder
             if (isset($datas['category_id'])) {
                 // Récupère l'option_value en cours
                 $category_option_value = new Application_Model_Option_Value();
                 $category_option_value->find($datas['value_id']);
                 $category_option_value->setFolderCategoryId(null)->setFolderCategoryPosition(null)->save();
                 foreach (Core_View_Default::getBlocks() as $block) {
                     if ($block->getCode() == 'area') {
                         $colorized_block = $block;
                     }
                 }
                 $icon_url = $category_option_value->getImage()->getCanBeColorized() ? Siberian_View::getColorizedImage($category_option_value->getIconId(), $colorized_block->getColor()) : $category_option_value->getIconUrl();
                 $html['folder'] = array('id' => $category_option_value->getId(), 'name' => $category_option_value->getShortTabbarName(), 'icon_url' => $icon_url, 'value_id' => $datas['value_id'], 'category_id' => $datas['category_id']);
             } else {
                 // Récupère l'id
                 $id = $option_value->getId();
                 // Récupère l'option
                 $option = new Application_Model_Option();
                 $option->find($option_value->getOptionId());
                 $option_folder = new Application_Model_Option();
                 $option_folder->find(array('code' => 'folder'));
                 $was_folder = 0;
                 //Folder, supprime les cat id des options
                 if ($option_value->getOptionId() == $option_folder->getOptionId()) {
                     $folder = new Folder_Model_Folder();
                     $folder->find($id, 'value_id');
                     $root_category = new Folder_Model_Category();
                     $root_category->find($folder->getRootCategoryId());
                     $categories_options = $root_category->deleteChildren($folder->getRootCategoryId());
                     $category_option = new Application_Model_Option_Value();
                     $option_values = $category_option->findAll(array('folder_category_id' => $folder->getRootCategoryId()));
                     $categories_options[$folder->getRootCategoryId()] = array();
                     foreach ($option_values as $ov) {
                         $ov->setFolderCategoryId(null)->setFolderCategoryPosition(null)->save();
                         $categories_options[$folder->getRootCategoryId()][] = $ov->getValueId();
                     }
                     $folder->delete();
                     $was_folder = 1;
                 }
                 // Supprime l'option de l'application
                 $option_value->delete();
                 // Renvoi le nouveau code HTML
                 $this->getLayout()->setBaseRender('content', 'application/customization/page/list.phtml', 'admin_view_default');
                 $html = array('success' => 1, 'option_id' => $id, 'use_user_account' => $this->getApplication()->usesUserAccount());
                 if ($option->onlyOnce()) {
                     $html['page'] = array('id' => $option->getId(), 'name' => $option->getName(), 'icon_url' => $option->getIconUrl());
                 }
                 if ($was_folder == 1) {
                     $html['was_folder'] = 1;
                     $html['categories_options'] = $categories_options;
                 }
             }
         } catch (Exception $e) {
             $html = array('message' => $this->_('An error occurred while deleting the option'), 'message_button' => 1, 'message_loader' => 1);
         }
         $this->getLayout()->setHtml(Zend_Json::encode($html));
     }
 }
Esempio n. 6
0
 public function __construct($config = array())
 {
     $this->_admin = $this->getSession()->getAdmin();
     parent::__construct($config);
 }
Esempio n. 7
0
 public static function setDevice($device)
 {
     self::$_device = $device;
 }
Esempio n. 8
0
 protected function _initSession()
 {
     $configSession = new Zend_Config_Ini(APPLICATION_PATH . '/configs/session.ini', APPLICATION_ENV);
     if (!$this->getRequest()->isInstalling()) {
         $config = array('name' => 'session', 'primary' => 'session_id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime', 'lifetime' => $configSession->gc_maxlifetime);
         Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
     }
     if (!$this->getRequest()->isInstalling() or is_writable(Core_Model_Directory::getSessionDirectory(true))) {
         $types = array();
         $options = $configSession->toArray();
         if (isset($options['types'])) {
             $types = $options['types'];
             unset($options['types']);
         }
         Zend_Session::start($options);
         $session_type = 'front';
         if ($this->getRequest()->isApplication()) {
             $session_type = 'mobile';
         }
         $session = new Core_Model_Session($session_type);
         $session->prepare($types);
         $language_session = new Core_Model_Session('language');
         if (!$language_session->current_language) {
             $language_session->current_language = null;
         }
         Core_Model_Language::setSession($language_session);
         Core_View_Default::setSession($session);
         Core_Controller_Default::setSession($session);
     }
 }