예제 #1
0
 public function indexAction()
 {
     if (Engine_Api::_()->user()->getViewer()->getIdentity()) {
         return $this->_helper->redirector->gotoRoute(array('action' => 'home'), 'user_general', true);
     }
     /*
     		if (isset($_SESSION['skip_registration'])) {
     			return $this -> _helper -> redirector -> gotoRoute(array(), 'user_home', true);
     		}
     */
     // Languages
     $translate = Zend_Registry::get('Zend_Translate');
     $languageList = $translate->getList();
     // Prepare default langauge
     $defaultLanguage = Engine_Api::_()->getApi('settings', 'core')->getSetting('core.locale.locale', 'en');
     if (!in_array($defaultLanguage, $languageList)) {
         if ($defaultLanguage == 'auto' && isset($languageList['en'])) {
             $defaultLanguage = 'en';
         } else {
             $defaultLanguage = null;
         }
     }
     // Prepare language name list
     $languageNameList = array();
     $languageDataList = Zend_Locale_Data::getList(null, 'language');
     $territoryDataList = Zend_Locale_Data::getList(null, 'territory');
     foreach ($languageList as $localeCode) {
         $languageNameList[$localeCode] = Engine_String::ucfirst(Zend_Locale::getTranslation($localeCode, 'language', $localeCode));
         if (empty($languageNameList[$localeCode])) {
             if (false !== strpos($localeCode, '_')) {
                 list($locale, $territory) = explode('_', $localeCode);
             } else {
                 $locale = $localeCode;
                 $territory = null;
             }
             if (isset($territoryDataList[$territory]) && isset($languageDataList[$locale])) {
                 $languageNameList[$localeCode] = $territoryDataList[$territory] . ' ' . $languageDataList[$locale];
             } else {
                 if (isset($territoryDataList[$territory])) {
                     $languageNameList[$localeCode] = $territoryDataList[$territory];
                 } else {
                     if (isset($languageDataList[$locale])) {
                         $languageNameList[$localeCode] = $languageDataList[$locale];
                     } else {
                         continue;
                     }
                 }
             }
         }
     }
     $languageNameList = array_merge(array($defaultLanguage => $defaultLanguage), $languageNameList);
     ksort($languageNameList);
     $this->view->languageNameList = $languageNameList;
     $this->_helper->layout->disableLayout();
     // Render
     //$this -> _helper -> content
     //-> setNoRender()
     //	-> setEnabled();
 }
 public function indexAction()
 {
     $this->view->navigation = $navigation = Engine_Api::_()->getApi('menus', 'core')->getNavigation('core_footer');
     // Languages
     $translate = Zend_Registry::get('Zend_Translate');
     $languageList = $translate->getList();
     //$currentLocale = Zend_Registry::get('Locale')->__toString();
     // Prepare default langauge
     $defaultLanguage = Engine_Api::_()->getApi('settings', 'core')->getSetting('core.locale.locale', 'en');
     if (!in_array($defaultLanguage, $languageList)) {
         if ($defaultLanguage == 'auto' && isset($languageList['en'])) {
             $defaultLanguage = 'en';
         } else {
             $defaultLanguage = null;
         }
     }
     // Prepare language name list
     $languageNameList = array();
     $languageDataList = Zend_Locale_Data::getList(null, 'language');
     $territoryDataList = Zend_Locale_Data::getList(null, 'territory');
     foreach ($languageList as $localeCode) {
         $languageNameList[$localeCode] = Engine_String::ucfirst(Zend_Locale::getTranslation($localeCode, 'language', $localeCode));
         if (empty($languageNameList[$localeCode])) {
             if (false !== strpos($localeCode, '_')) {
                 list($locale, $territory) = explode('_', $localeCode);
             } else {
                 $locale = $localeCode;
                 $territory = null;
             }
             if (isset($territoryDataList[$territory]) && isset($languageDataList[$locale])) {
                 $languageNameList[$localeCode] = $territoryDataList[$territory] . ' ' . $languageDataList[$locale];
             } else {
                 if (isset($territoryDataList[$territory])) {
                     $languageNameList[$localeCode] = $territoryDataList[$territory];
                 } else {
                     if (isset($languageDataList[$locale])) {
                         $languageNameList[$localeCode] = $languageDataList[$locale];
                     } else {
                         continue;
                     }
                 }
             }
         }
     }
     $languageNameList = array_merge(array($defaultLanguage => $defaultLanguage), $languageNameList);
     $this->view->languageNameList = $languageNameList;
     // Get affiliate code
     $this->view->affiliateCode = Engine_Api::_()->getDbtable('settings', 'core')->core_affiliate_code;
 }
예제 #3
0
 public function indexAction()
 {
     if (YNRESPONSIVE_ACTIVE != 'ynresponsive-event') {
         return $this->setNoRender(true);
     }
     $this->view->navigation = $navigation = Engine_Api::_()->getApi('menus', 'core')->getNavigation('core_footer');
     // Get affiliate code
     $this->view->affiliateCode = Engine_Api::_()->getDbtable('settings', 'core')->core_affiliate_code;
     // Languages
     $translate = Zend_Registry::get('Zend_Translate');
     $languageList = $translate->getList();
     // Prepare default langauge
     $defaultLanguage = Engine_Api::_()->getApi('settings', 'core')->getSetting('core.locale.locale', 'en');
     if (!in_array($defaultLanguage, $languageList)) {
         if ($defaultLanguage == 'auto' && isset($languageList['en'])) {
             $defaultLanguage = 'en';
         } else {
             $defaultLanguage = null;
         }
     }
     $ch = curl_init('ipinfo.io/country');
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $country = substr(curl_exec($ch), 0, 2);
     curl_close($ch);
     // check mapping
     $table = Engine_Api::_()->getDbTable('langcountrymappings', 'core');
     $select = $table->select()->where('country_code = ?', $country)->limit(1);
     $countryLanguage = '';
     if ($row = $table->fetchRow($select)) {
         $countryLanguage = $row->language_code;
     }
     $this->view->countryLanguage = $countryLanguage;
     // Prepare language name list
     $languageNameList = array();
     $languageDataList = Zend_Locale_Data::getList(null, 'language');
     $territoryDataList = Zend_Locale_Data::getList(null, 'territory');
     foreach ($languageList as $localeCode) {
         $languageNameList[$localeCode] = Engine_String::ucfirst(Zend_Locale::getTranslation($localeCode, 'language', $localeCode));
         if (empty($languageNameList[$localeCode])) {
             if (false !== strpos($localeCode, '_')) {
                 list($locale, $territory) = explode('_', $localeCode);
             } else {
                 $locale = $localeCode;
                 $territory = null;
             }
             if (isset($territoryDataList[$territory]) && isset($languageDataList[$locale])) {
                 $languageNameList[$localeCode] = $territoryDataList[$territory] . ' ' . $languageDataList[$locale];
             } else {
                 if (isset($territoryDataList[$territory])) {
                     $languageNameList[$localeCode] = $territoryDataList[$territory];
                 } else {
                     if (isset($languageDataList[$locale])) {
                         $languageNameList[$localeCode] = $languageDataList[$locale];
                     } else {
                         continue;
                     }
                 }
             }
         }
     }
     $languageNameList = array_merge(array($defaultLanguage => $defaultLanguage), $languageNameList);
     ksort($languageNameList);
     $this->view->languageNameList = $languageNameList;
 }
예제 #4
0
파일: Create.php 프로젝트: hoalangoc/ftf
 public function init()
 {
     $this->setTitle('Create Tour Guide Step')->setDescription('Please compose your new tour guide item below.')->setAttrib('id', 'touritem_create');
     // $model = new Yntour_Model_DbTable_Tours;
     // $select = $model -> select()->from($model->info('name'),array('tour_id', 'label'=>new Zend_Db_Expr('substring(title,1,30)')));
     // $options = $model->getAdapter()->fetchPairs($select);
     //
     // $this -> addElement('Select', 'tour_id', array(
     // 'required' => true,
     // 'label' => 'Tour guide',
     // 'multiOptions' => $options
     // ));
     // Add title
     // $this -> addElement('Text', 'title', array(
     // 'label' => 'Title',
     // 'required' => true,
     // 'allowEmpty' => false,
     // ));
     // Add title
     $this->addElement('Text', 'priority', array('label' => 'Ordering', 'validators' => array('Int'), 'required' => true, 'allowEmpty' => false));
     $this->addElement('Text', 'time_delay', array('label' => 'Time delay in second(s)', 'description' => '', 'validators' => array('Int'), 'value' => '6', 'required' => true, 'allowEmpty' => false));
     $this->addElement('Text', 'width', array('label' => 'Width (px)', 'value' => '20', 'required' => true, 'allowEmpty' => false));
     $pos = array('top' => 'top', 'right' => 'right', 'bottom' => 'bottom', 'left' => 'left');
     $this->addElement('Select', 'position', array('label' => 'Position', 'placeholder' => 'position', 'multiOptions' => $pos, 'filters' => array(new Engine_Filter_Censor())));
     $this->addElement('Text', 'left_position', array('label' => 'Left Position (px)', 'validators' => array('Int'), 'value' => '20', 'required' => true, 'allowEmpty' => false));
     $this->addElement('Text', 'top_position', array('label' => 'Top Position (px)', 'validators' => array('Int'), 'value' => '20', 'required' => true, 'allowEmpty' => false));
     // $this -> addElement('Text', 'width', array(
     // 'label' => 'Width',
     // 'required' => true,
     // 'value'=>'auto',
     // 'description'=>'etc: 300px, 300pt, default is auto',
     // 'allowEmpty' => false,
     // ));
     // Add title
     // $this -> addElement('Text', 'path', array(
     // 'label' => 'Path',
     // 'required' => true,
     // 'allowEmpty' => false,
     // ));
     // $this->addElement('Radio','enabled',array(
     // 'label'=>'Enabled',
     // 'value'=>1,
     // 'multiOptions'=>array(
     // '0'=>'Disable',
     // '1'=>'Enable',
     // ),
     // ));
     //get all languages
     // Languages
     $translate = Zend_Registry::get('Zend_Translate');
     $languageList = $translate->getList();
     // Prepare language name list
     $languageNameList = array();
     $languageDataList = Zend_Locale_Data::getList(null, 'language');
     $territoryDataList = Zend_Locale_Data::getList(null, 'territory');
     foreach ($languageList as $localeCode) {
         $languageNameList[$localeCode] = Engine_String::ucfirst(Zend_Locale::getTranslation($localeCode, 'language', $localeCode));
         if (empty($languageNameList[$localeCode])) {
             if (false !== strpos($localeCode, '_')) {
                 list($locale, $territory) = explode('_', $localeCode);
             } else {
                 $locale = $localeCode;
                 $territory = null;
             }
             if (isset($territoryDataList[$territory]) && isset($languageDataList[$locale])) {
                 $languageNameList[$localeCode] = $territoryDataList[$territory] . ' ' . $languageDataList[$locale];
             } else {
                 if (isset($territoryDataList[$territory])) {
                     $languageNameList[$localeCode] = $territoryDataList[$territory];
                 } else {
                     if (isset($languageDataList[$locale])) {
                         $languageNameList[$localeCode] = $languageDataList[$locale];
                     } else {
                         continue;
                     }
                 }
             }
         }
         $this->addElement('Textarea', 'body_' . $localeCode, array('label' => 'Body (' . $languageDataList[$localeCode] . ')', 'required' => true, 'allowEmpty' => false));
     }
     //end
     // Buttons
     $this->addElement('Button', 'submit', array('label' => 'Submit', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'ignore' => true, 'link' => true, 'href' => Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'yntour', 'controller' => 'manage', 'action' => 'item', 'id' => $this->getTourId()), 'admin_default', true), 'prependText' => Zend_Registry::get('Zend_Translate')->_(' or '), 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons');
 }