예제 #1
0
파일: Action.php 프로젝트: anunay/stentors
 public function init()
 {
     parent::init();
     $this->view->assign('user', $this->view->auth());
     $session = new Cible_Sessions();
     // Defines the default interface language
     if ($this->_config->defaultInterfaceLanguage) {
         $this->_defaultInterfaceLanguage = $this->_config->defaultInterfaceLanguage;
     }
     // Check if the current interface language should be different than the default one
     $this->_currentInterfaceLanguage = !empty($session->languageID) ? $session->languageID : $this->_defaultInterfaceLanguage;
     if ($this->_getParam('setLang')) {
         $this->_currentInterfaceLanguage = Cible_FunctionsGeneral::getLanguageID($this->_getParam('setLang'));
     }
     // Registers the current interface language for future uses
     $this->_registry->set('languageID', $this->_currentInterfaceLanguage);
     $session->languageID = $this->_currentInterfaceLanguage;
     $suffix = Cible_FunctionsGeneral::getLanguageSuffix($this->_currentInterfaceLanguage);
     $this->_registry->set('languageSuffix', $suffix);
     // Defines the default edit language
     if ($this->_config->defaultEditLanguage) {
         $this->_currentEditLanguage = $this->_config->defaultEditLanguage;
     } else {
         $this->_currentEditLanguage = $this->_defaultEditLanguage;
     }
     $this->_currentEditLanguage = !empty($session->currentEditLanguage) ? $session->currentEditLanguage : $this->_currentEditLanguage;
     // Check if the current edit language should be different than the default one
     if ($this->_getParam('lang')) {
         $this->_currentEditLanguage = Cible_FunctionsGeneral::getLanguageID($this->_getParam('lang'));
     }
     // Registers the current edit language for future uses
     $this->_registry->set('currentEditLanguage', $this->_currentEditLanguage);
     $session->currentEditLanguage = $this->_currentEditLanguage;
     if (Cible_FunctionsGeneral::extranetLanguageIsAvailable($this->getCurrentInterfaceLanguage()) == 0) {
         $session = new Cible_Sessions();
         $this->_currentInterfaceLanguage = $this->_config->defaultInterfaceLanguage;
         // Registers the current interface language for future uses
         $this->_registry->set('languageID', $this->_currentInterfaceLanguage);
         $session->languageID = $this->_currentInterfaceLanguage;
         $suffix = Cible_FunctionsGeneral::getLanguageSuffix($this->_currentInterfaceLanguage);
         $this->_registry->set('languageSuffix', $suffix);
     }
     $hasProfile = false;
     $hasVideos = true;
     $modProfile = Cible_FunctionsModules::modulesProfile();
     if (count($modProfile) > 0) {
         $hasProfile = true;
     }
     $this->view->assign('hasProfile', $hasProfile);
     $this->view->assign('hasVideos', $hasVideos);
 }
예제 #2
0
 /**
  * Set some properties to redirect and process actions.
  *
  * @access public
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     // Sets the called action name. This will be dispatched to the method
     $this->_currentAction = $this->_getParam('action');
     // The action (process) to do for the selected object
     $this->_actionKey = $this->_getParam('actionKey');
     $this->_formatName();
     $this->view->assign('cleaction', $this->_labelSuffix);
     $dataImagePath = "../../" . $this->_config->document_root . "/data/images/";
     if (isset($this->_objectList[$this->_currentAction])) {
         $this->_imageFolder = $dataImagePath . $this->_moduleTitle . "/" . $this->_objectList[$this->_currentAction] . "/";
     }
     if (isset($this->_objectList[$this->_currentAction])) {
         $this->_rootImgPath = Zend_Registry::get("www_root") . "/data/images/" . $this->_moduleTitle . "/" . $this->_objectList[$this->_currentAction] . "/";
     }
     // Set the default objects according to the modules list;
     $modulesProfiles = Cible_FunctionsModules::modulesProfile();
     $this->view->profilesList = $modulesProfiles;
     foreach ($modulesProfiles as $id => $name) {
         $value = $name['M_MVCModuleTitle'];
         if (!in_array($value, $this->_objectList)) {
             switch ($value) {
                 //                    case 'newsletter':
                 //                        $this->_objectList[$value] = 'NewsletterProfilesObject';
                 //                        break;
                 case 'order':
                     $this->_objectList[$value] = 'MemberProfilesObject';
                     break;
                 case 'retailers':
                     $this->_objectList[$value] = 'RetailersObject';
                     break;
                     //                    case 'member':
                     //                        $this->_objectList[$value] = 'MemberProfilesObject';
                     ////                        $this->_joinTables[] = $this->_objectList[$value];
                     //                        break;
                     //                    case 'parent':
                     //                        $this->_objectList[$value] = 'ParentProfilesObject';
                     ////                        $this->_joinTables[] = $this->_objectList[$value];
                     //                        break;
                     //                    case 'medical':
                     //                        $this->_objectList[$value] = 'MedicalProfilesObject';
                     ////                        $this->_joinTables[] = $this->_objectList[$value];
                     //                        break;
                 //                    case 'member':
                 //                        $this->_objectList[$value] = 'MemberProfilesObject';
                 ////                        $this->_joinTables[] = $this->_objectList[$value];
                 //                        break;
                 //                    case 'parent':
                 //                        $this->_objectList[$value] = 'ParentProfilesObject';
                 ////                        $this->_joinTables[] = $this->_objectList[$value];
                 //                        break;
                 //                    case 'medical':
                 //                        $this->_objectList[$value] = 'MedicalProfilesObject';
                 ////                        $this->_joinTables[] = $this->_objectList[$value];
                 //                        break;
                 default:
                     $this->_objectList[$value] = ucfirst($value) . 'ProfilesObject';
                     break;
             }
         }
         $this->_objectList = array_unique($this->_objectList);
     }
     switch (Zend_Registry::get('languageID')) {
         case '1':
             $this->view->jQuery()->addJavascriptFile("{$this->view->baseUrl()}/js/jquery/localizations/ui.datepicker-fr.js");
             break;
         case '2':
             $this->view->jQuery()->addJavascriptFile("{$this->view->baseUrl()}/js/jquery/localizations/ui.datepicker-en.js");
             break;
         default:
             $this->view->jQuery()->addJavascriptFile("{$this->view->baseUrl()}/js/jquery/localizations/ui.datepicker-fr.js");
             break;
     }
     $this->view->headScript()->appendFile($this->view->locateFile('jquery.validate.min.js', 'jquery'));
     $this->view->headScript()->appendFile($this->view->locateFile('additional-methods.min.js', 'jquery'));
     $this->view->headLink()->appendStylesheet($this->view->locateFile('profile.css'));
 }