コード例 #1
0
ファイル: Country.php プロジェクト: GEANT/CORE
 /**
  * Get a localized list of countries sorted by country name
  *
  * @return array
  */
 private function _getCountries()
 {
     $countries = Zend_Locale::getTranslationList('territory', null, 2);
     asort($countries, SORT_LOCALE_STRING);
     array_unshift($countries, '---');
     return $countries;
 }
コード例 #2
0
ファイル: Create.php プロジェクト: robeendey/ce
 public function init()
 {
     $this->setTitle('Language Manager')->setDescription('Create a new language pack')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     $localeObject = Zend_Registry::get('Locale');
     $languages = Zend_Locale::getTranslationList('language', $localeObject);
     $territories = Zend_Locale::getTranslationList('territory', $localeObject);
     $localeMultiOptions = array();
     foreach (array_keys(Zend_Locale::getLocaleList()) as $key) {
         $languageName = null;
         if (!empty($languages[$key])) {
             $languageName = $languages[$key];
         } else {
             $tmpLocale = new Zend_Locale($key);
             $region = $tmpLocale->getRegion();
             $language = $tmpLocale->getLanguage();
             if (!empty($languages[$language]) && !empty($territories[$region])) {
                 $languageName = $languages[$language] . ' (' . $territories[$region] . ')';
             }
         }
         if ($languageName) {
             $localeMultiOptions[$key] = $languageName . ' [' . $key . ']';
         }
     }
     //asort($languageNameList);
     $this->addElement('Select', 'language', array('label' => 'Language', 'description' => 'Which language do you want to create a language pack for?', 'multiOptions' => $localeMultiOptions));
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Create', 'type' => 'submit', 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('prependText' => ' or ', 'link' => true, 'label' => 'cancel', 'onclick' => 'history.go(-1); return false;', 'decorators' => array('ViewHelper')));
 }
コード例 #3
0
ファイル: Countries.php プロジェクト: HardSkript/unsee.cc
 public static function getValues(Zend_Translate $lang)
 {
     $countries = Zend_Locale::getTranslationList('Territory', $lang->getLocale(), 2);
     $continents = Zend_Locale::getTranslationList('Territory', $lang->getLocale(), 1);
     array_unshift($countries, current($continents));
     return $countries;
 }
コード例 #4
0
ファイル: Date.php プロジェクト: BGCX262/zweer-gdr-svn-to-git
 protected function getMonths()
 {
     if (!isset($this->_month)) {
         $this->_month = Zend_Locale::getTranslationList('month');
     }
     return $this->_month;
 }
コード例 #5
0
ファイル: LanguageListbox.php プロジェクト: que273/siremis
 public function getFromList(&$list)
 {
     $current_locale = I18n::getInstance()->getCurrentLanguage();
     $country = BizSystem::clientProxy()->getFormInputs("fld_region");
     $country = strtoupper($country);
     if (!$country) {
         $locale = explode('_', $current_locale);
         $country = strtoupper($locale[0]);
     }
     require_once 'Zend/Locale.php';
     $locale = new Zend_Locale($current_locale);
     $code2name = $locale->getTranslationList('territorytolanguage', $locale);
     $list = array();
     $i = 0;
     foreach ($code2name as $key => $value) {
         if (preg_match('/' . $country . '/', $value) || strtoupper($key) == $country) {
             $lang_list = explode(" ", $value);
             foreach ($lang_list as $lang) {
                 $list[$i]['txt'] = strtolower($key) . "_" . strtoupper($lang);
                 $list[$i]['val'] = strtolower($key) . "_" . strtoupper($lang);
                 $i++;
             }
         }
     }
     return $list;
 }
コード例 #6
0
 public function toOptionArray()
 {
     // scan the TinyMCE langs directory for javascript files and present
     // thse as languages options
     $langs = array();
     $langsDir = Mage::getBaseDir() . '/js/fontis/tiny_mce/langs/';
     if (is_dir($langsDir)) {
         $locale = Mage::getStoreConfig('general/locale/code');
         if (!$locale) {
             $locale = 'en';
         }
         $translationList = Zend_Locale::getTranslationList('language', $locale);
         $contents = scandir($langsDir);
         foreach ($contents as $item) {
             if ($item != "." && $item != ".." && is_file($langsDir . $item) && substr($item, -3) == ".js") {
                 $code = substr($item, 0, -3);
                 if (array_key_exists($code, $translationList)) {
                     $label = $translationList[$code];
                 } else {
                     $label = $code;
                 }
                 $langEntry = array('value' => $code, 'label' => $label);
                 $langs[] = $langEntry;
             }
         }
     }
     if (!empty($langs)) {
         return $langs;
     } else {
         return array(array('value' => 'en', 'label' => 'en'));
     }
 }
コード例 #7
0
 public function init()
 {
     $this->setMethod('post');
     $this->addElement('text', 'fullname', array('label' => 'Name', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'title'));
     $this->addElement('text', 'nickname', array('label' => 'Nickname', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'text'));
     $this->addElement('text', 'email', array('label' => 'Email', 'required' => false, 'validators' => array('emailAddress'), 'filters' => array('StringTrim', 'StripTags'), 'class' => 'text'));
     $this->addElement('select', 'gender', array('label' => 'Gender', 'required' => false, 'validators' => array(array('inArray', false, array(array('M', 'F')))), 'multiOptions' => array('' => 'Not specified', 'M' => 'Male', 'F' => 'Female')));
     $this->addElement('text', 'dob', array('label' => 'Date of birth (dd/mm/yyyy)', 'required' => false, 'class' => 'text', 'validators' => array(array('date', false, array('d/m/Y'))), 'filters' => array('StringTrim', 'StripTags')));
     // get the list of countries
     $countries = Zend_Locale::getTranslationList('Territory', 'en', 2);
     asort($countries, SORT_LOCALE_STRING);
     $country = new Zend_Form_Element_Select('country');
     $country->setLabel('Country')->addMultiOption('', 'Not specified')->addMultiOption('GB', 'United Kingdom')->addMultiOptions($countries)->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->setLabel('Postcode')->setAttrib("class", "text")->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $languages = Zend_Locale::getTranslationList('Language', 'en');
     asort($languages, SORT_LOCALE_STRING);
     $language = new Zend_Form_Element_Select('language');
     $language->setLabel('Language')->addMultiOption('', 'Not specified')->addMultiOption('en_GB', 'British English')->addMultiOptions($languages)->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $timeZone = new Zend_Form_Element_Text('timezone');
     $timeZone->setLabel('Timezone')->setAttrib("class", "text")->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $this->addElements(array($country, $postcode, $language, $timeZone));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Save'));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset')), array('Description', array('placement' => 'prepend', 'class' => 'error')), 'Form'));
 }
コード例 #8
0
ファイル: Locale.php プロジェクト: robeendey/ce
 public function init()
 {
     $this->setTitle('Locale Settings')->setDescription('CORE_FORM_ADMIN_SETTINGS_LOCALE_DESCRIPTION');
     // Init timezeon
     $this->addElement('Select', 'timezone', array('label' => 'Default Timezone', 'multiOptions' => array('US/Pacific' => '(UTC-8) Pacific Time (US & Canada)', 'US/Mountain' => '(UTC-7) Mountain Time (US & Canada)', 'US/Central' => '(UTC-6) Central Time (US & Canada)', 'US/Eastern' => '(UTC-5) Eastern Time (US & Canada)', 'America/Halifax' => '(UTC-4)  Atlantic Time (Canada)', 'America/Anchorage' => '(UTC-9)  Alaska (US & Canada)', 'Pacific/Honolulu' => '(UTC-10) Hawaii (US)', 'Pacific/Samoa' => '(UTC-11) Midway Island, Samoa', 'Etc/GMT-12' => '(UTC-12) Eniwetok, Kwajalein', 'Canada/Newfoundland' => '(UTC-3:30) Canada/Newfoundland', 'America/Buenos_Aires' => '(UTC-3) Brasilia, Buenos Aires, Georgetown', 'Atlantic/South_Georgia' => '(UTC-2) Mid-Atlantic', 'Atlantic/Azores' => '(UTC-1) Azores, Cape Verde Is.', 'Europe/London' => 'Greenwich Mean Time (Lisbon, London)', 'Europe/Berlin' => '(UTC+1) Amsterdam, Berlin, Paris, Rome, Madrid', 'Europe/Athens' => '(UTC+2) Athens, Helsinki, Istanbul, Cairo, E. Europe', 'Europe/Moscow' => '(UTC+3) Baghdad, Kuwait, Nairobi, Moscow', 'Iran' => '(UTC+3:30) Tehran', 'Asia/Dubai' => '(UTC+4) Abu Dhabi, Kazan, Muscat', 'Asia/Kabul' => '(UTC+4:30) Kabul', 'Asia/Yekaterinburg' => '(UTC+5) Islamabad, Karachi, Tashkent', 'Asia/Dili' => '(UTC+5:30) Bombay, Calcutta, New Delhi', 'Asia/Katmandu' => '(UTC+5:45) Nepal', 'Asia/Omsk' => '(UTC+6) Almaty, Dhaka', 'India/Cocos' => '(UTC+6:30) Cocos Islands, Yangon', 'Asia/Krasnoyarsk' => '(UTC+7) Bangkok, Jakarta, Hanoi', 'Asia/Hong_Kong' => '(UTC+8) Beijing, Hong Kong, Singapore, Taipei', 'Asia/Tokyo' => '(UTC+9) Tokyo, Osaka, Sapporto, Seoul, Yakutsk', 'Australia/Adelaide' => '(UTC+9:30) Adelaide, Darwin', 'Australia/Sydney' => '(UTC+10) Brisbane, Melbourne, Sydney, Guam', 'Asia/Magadan' => '(UTC+11) Magadan, Soloman Is., New Caledonia', 'Pacific/Auckland' => '(UTC+12) Fiji, Kamchatka, Marshall Is., Wellington')));
     // Init default locale
     $localeObject = Zend_Registry::get('Locale');
     $languages = Zend_Locale::getTranslationList('language', $localeObject);
     $territories = Zend_Locale::getTranslationList('territory', $localeObject);
     $localeMultiOptions = array();
     foreach (array_keys(Zend_Locale::getLocaleList()) as $key) {
         $languageName = null;
         if (!empty($languages[$key])) {
             $languageName = $languages[$key];
         } else {
             $tmpLocale = new Zend_Locale($key);
             $region = $tmpLocale->getRegion();
             $language = $tmpLocale->getLanguage();
             if (!empty($languages[$language]) && !empty($territories[$region])) {
                 $languageName = $languages[$language] . ' (' . $territories[$region] . ')';
             }
         }
         if ($languageName) {
             $localeMultiOptions[$key] = $languageName . ' [' . $key . ']';
         }
     }
     $localeMultiOptions = array_merge(array('auto' => '[Automatic]'), $localeMultiOptions);
     $this->addElement('Select', 'locale', array('label' => 'Default Locale', 'multiOptions' => $localeMultiOptions, 'value' => 'auto', 'disableTranslator' => true));
     // init submit
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true));
 }
コード例 #9
0
 /**
  * Create a jQuery UI Widget Date Picker
  *
  * @link   http://docs.jquery.com/UI/Datepicker
  * @param  string $id
  * @param  string $value
  * @param  array  $params jQuery Widget Parameters
  * @param  array  $attribs HTML Element Attributes
  * @return string
  */
 public function datePicker($id, $value = null, array $params = array(), array $attribs = array())
 {
     $attribs = $this->_prepareAttributes($id, $value, $attribs);
     if (Zend_Registry::isRegistered('Zend_Locale')) {
         if (!isset($params['dateFormat'])) {
             $params['dateFormat'] = self::resolveZendLocaleToDatePickerFormat();
         }
         $days = Zend_Locale::getTranslationList('Days');
         if (!isset($params['dayNames'])) {
             $params['dayNames'] = array_values($days['format']['wide']);
         }
         if (!isset($params['dayNamesShort'])) {
             $params['dayNamesShort'] = array_values($days['format']['abbreviated']);
         }
         if (!isset($params['dayNamesMin'])) {
             $params['dayNamesMin'] = array_values($days['stand-alone']['narrow']);
         }
         $months = Zend_Locale::getTranslationList('Months');
         if (!isset($params['monthNames'])) {
             $params['monthNames'] = array_values($months['stand-alone']['wide']);
         }
         if (!isset($params['monthNamesShort'])) {
             $params['monthNamesShort'] = array_values($months['stand-alone']['narrow']);
         }
     }
     // TODO: Allow translation of DatePicker Text Values to get this action from client to server
     $params = ZendX_JQuery::encodeJson($params);
     $js = sprintf('%s("#%s").datepicker(%s);', ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(), $attribs['id'], $params);
     $this->jquery->addOnLoad($js);
     return $this->view->formText($id, $value, $attribs);
 }
コード例 #10
0
 public function getNameByLanguageAndId($language, $id)
 {
     static $terr = array();
     if (!isset($terr[$language])) {
         $terr[$language] = Zend_Locale::getTranslationList('Territory', $language, '2');
     }
     return $terr[$language][$id];
 }
コード例 #11
0
ファイル: Cldr.php プロジェクト: cybercog/country-list
 /**
  * {@inheritdoc}
  */
 public function getCountries($language)
 {
     $countries = \Zend_Locale::getTranslationList('territory', $language, 2);
     if (is_array($countries)) {
         asort($countries);
     }
     return $countries;
 }
コード例 #12
0
ファイル: Language.php プロジェクト: sdgdsffdsfff/auth-center
 public function init()
 {
     parent::init();
     translate('-- Select a Language --');
     $this->addMultiOption(0, '-- Select a Language --');
     $this->addMultiOptions(Zend_Locale::getTranslationList('language', Zend_Registry::get('Zend_Locale')));
     asort($this->options);
 }
コード例 #13
0
ファイル: Cldr.php プロジェクト: fkomaralp/country-list
 /**
  * {@inheritdoc}
  */
 public function getCountryLanguages($language)
 {
     $languages = \Zend_Locale::getTranslationList('language', $language, 2);
     if (is_array($languages)) {
         asort($languages);
     }
     return $languages;
 }
コード例 #14
0
 public function __construct()
 {
     Loader::library('3rdparty/Zend/Locale');
     $countries = Zend_Locale::getTranslationList('territory', Localization::activeLocale(), 2);
     // unset invalid countries
     unset($countries['SU'], $countries['ZZ'], $countries['IM'], $countries['JE'], $countries['VD']);
     asort($countries, SORT_LOCALE_STRING);
     $this->countries = $countries;
 }
コード例 #15
0
ファイル: Currency.php プロジェクト: robeendey/ce
 public function init()
 {
     parent::init();
     // Add currencies
     $locale = Zend_Registry::get('Zend_Translate')->getLocale();
     $this->_currencies = $currencies = Zend_Locale::getTranslationList('NameToCurrency', $locale);
     uksort($currencies, array($this, '_orderCurrencies'));
     $this->addElement('Select', 'unit', array('label' => 'Currency Type', 'multiOptions' => $currencies, 'value' => 'USD'));
 }
コード例 #16
0
ファイル: Edit.php プロジェクト: hettema/Stages
 /**
  * Get the language option list generated using Zend_Locale
  * 
  * @return array $key=>$value 
  */
 public function getLanguageOptionList()
 {
     $languages = Zend_Locale::getTranslationList("language");
     $return = array();
     foreach ($languages as $key => $value) {
         $return[$key] = $value;
     }
     return $return;
 }
コード例 #17
0
ファイル: FieldCountry.php プロジェクト: robeendey/ce
 public function fieldCountry($subject, $field, $value)
 {
     $locale = Zend_Registry::get('Zend_Translate')->getLocale();
     $territories = Zend_Locale::getTranslationList('territory', $locale, 2);
     if (isset($territories[$value->value])) {
         return $territories[$value->value];
     }
     return '';
 }
コード例 #18
0
 /**
  * Get a list of countries
  *
  * @param string $locale
  * @return array
  */
 public static function getCountryList($locale = null)
 {
     if (!$locale) {
         $locale = i18n::get_locale();
     }
     $countries = Zend_Locale::getTranslationList('territory', $locale, 2);
     asort($countries, SORT_LOCALE_STRING);
     unset($countries['SU'], $countries['ZZ'], $countries['VD'], $countries['DD']);
     return $countries;
 }
コード例 #19
0
 public function init()
 {
     $locale = Zend_Registry::get('Zend_Translate')->getLocale();
     $territories = Zend_Locale::getTranslationList('territory', $locale, 2);
     asort($territories);
     //if( !$this->isRequired() ) {
     $territories = array_merge(array('' => ''), $territories);
     //}
     $this->setMultiOptions($territories);
 }
コード例 #20
0
ファイル: General.php プロジェクト: robeendey/ce
 public function init()
 {
     // @todo fix form CSS/decorators
     // @todo replace fake values with real values
     $this->setTitle('General Settings')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     // Init email
     $this->addElement('Text', 'email', array('label' => 'Email Address', 'required' => true, 'allowEmpty' => false, 'validators' => array(array('NotEmpty', true), array('EmailAddress', true), array('Db_NoRecordExists', true, array(Engine_Db_Table::getTablePrefix() . 'users', 'email', array('field' => 'user_id', 'value' => $this->getItem()->getIdentity()))))));
     $this->email->getValidator('NotEmpty')->setMessage('Please enter a valid email address.', 'isEmpty');
     $this->email->getValidator('Db_NoRecordExists')->setMessage('Someone has already registered this email address, please use another one.', 'recordFound');
     // Init username
     $this->addElement('Text', 'username', array('label' => 'Profile Address', 'required' => true, 'allowEmpty' => false, 'validators' => array(array('NotEmpty', true), array('Alnum', true), array('StringLength', true, array(4, 64)), array('Regex', true, array('/^[a-z0-9]/i')), array('Db_NoRecordExists', true, array(Engine_Db_Table::getTablePrefix() . 'users', 'username', array('field' => 'user_id', 'value' => $this->getItem()->getIdentity()))))));
     $this->username->getValidator('NotEmpty')->setMessage('Please enter a valid profile address.', 'isEmpty');
     $this->username->getValidator('Db_NoRecordExists')->setMessage('Someone has already picked this profile address, please use another one.', 'recordFound');
     $this->username->getValidator('Regex')->setMessage('Profile addresses must start with a letter.', 'regexNotMatch');
     $this->username->getValidator('Alnum')->setMessage('Profile addresses must be alphanumeric.', 'notAlnum');
     // Init type
     $this->addElement('Select', 'accountType', array('label' => 'Account Type'));
     // Init Facebook
     $facebook_enable = Engine_Api::_()->getApi('settings', 'core')->getSetting('core_facebook_enable', 'none');
     if ('none' != $facebook_enable) {
         $and_publish = 'publish' == $facebook_enable ? ' and publish content to your Facebook wall.' : '.';
         $this->addElement('Dummy', 'facebook', array('label' => 'Facebook Integration', 'description' => 'Linking your Facebook account will let you login with Facebook' . $and_publish, 'content' => User_Model_DbTable_Facebook::loginButton('Integrate with my Facebook')));
         $this->addElement('Checkbox', 'facebook_id', array('label' => 'Integrate with my Facebook', 'description' => 'Facebook Integration'));
     }
     // Init timezone
     $this->addElement('Select', 'timezone', array('label' => 'Timezone', 'description' => 'Select the city closest to you that shares your same timezone.', 'multiOptions' => array('US/Pacific' => '(UTC-8) Pacific Time (US & Canada)', 'US/Mountain' => '(UTC-7) Mountain Time (US & Canada)', 'US/Central' => '(UTC-6) Central Time (US & Canada)', 'US/Eastern' => '(UTC-5) Eastern Time (US & Canada)', 'America/Halifax' => '(UTC-4)  Atlantic Time (Canada)', 'America/Anchorage' => '(UTC-9)  Alaska (US & Canada)', 'Pacific/Honolulu' => '(UTC-10) Hawaii (US)', 'Pacific/Samoa' => '(UTC-11) Midway Island, Samoa', 'Etc/GMT-12' => '(UTC-12) Eniwetok, Kwajalein', 'Canada/Newfoundland' => '(UTC-3:30) Canada/Newfoundland', 'America/Buenos_Aires' => '(UTC-3) Brasilia, Buenos Aires, Georgetown', 'Atlantic/South_Georgia' => '(UTC-2) Mid-Atlantic', 'Atlantic/Azores' => '(UTC-1) Azores, Cape Verde Is.', 'Europe/London' => 'Greenwich Mean Time (Lisbon, London)', 'Europe/Berlin' => '(UTC+1) Amsterdam, Berlin, Paris, Rome, Madrid', 'Europe/Athens' => '(UTC+2) Athens, Helsinki, Istanbul, Cairo, E. Europe', 'Europe/Moscow' => '(UTC+3) Baghdad, Kuwait, Nairobi, Moscow', 'Iran' => '(UTC+3:30) Tehran', 'Asia/Dubai' => '(UTC+4) Abu Dhabi, Kazan, Muscat', 'Asia/Kabul' => '(UTC+4:30) Kabul', 'Asia/Yekaterinburg' => '(UTC+5) Islamabad, Karachi, Tashkent', 'Asia/Dili' => '(UTC+5:30) Bombay, Calcutta, New Delhi', 'Asia/Katmandu' => '(UTC+5:45) Nepal', 'Asia/Omsk' => '(UTC+6) Almaty, Dhaka', 'India/Cocos' => '(UTC+6:30) Cocos Islands, Yangon', 'Asia/Krasnoyarsk' => '(UTC+7) Bangkok, Jakarta, Hanoi', 'Asia/Hong_Kong' => '(UTC+8) Beijing, Hong Kong, Singapore, Taipei', 'Asia/Tokyo' => '(UTC+9) Tokyo, Osaka, Sapporto, Seoul, Yakutsk', 'Australia/Adelaide' => '(UTC+9:30) Adelaide, Darwin', 'Australia/Sydney' => '(UTC+10) Brisbane, Melbourne, Sydney, Guam', 'Asia/Magadan' => '(UTC+11) Magadan, Soloman Is., New Caledonia', 'Pacific/Auckland' => '(UTC+12) Fiji, Kamchatka, Marshall Is., Wellington')));
     // Init default locale
     $locale = Zend_Registry::get('Locale');
     $localeMultiKeys = array_merge(array_keys(Zend_Locale::getLocaleList()));
     $localeMultiOptions = array();
     $languages = Zend_Locale::getTranslationList('language', $locale);
     $territories = Zend_Locale::getTranslationList('territory', $locale);
     foreach ($localeMultiKeys as $key) {
         if (!empty($languages[$key])) {
             $localeMultiOptions[$key] = $languages[$key];
         } else {
             $locale = new Zend_Locale($key);
             $region = $locale->getRegion();
             $language = $locale->getLanguage();
             if (!empty($languages[$language]) && !empty($territories[$region])) {
                 $localeMultiOptions[$key] = $languages[$language] . ' (' . $territories[$region] . ')';
             }
         }
     }
     $localeMultiOptions = array_merge(array('auto' => '[Automatic]'), $localeMultiOptions);
     $this->addElement('Select', 'locale', array('label' => 'Locale', 'description' => 'Dates, times, and other settings will be displayed using this locale setting.', 'multiOptions' => $localeMultiOptions));
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true));
     // Create display group for buttons
     #$this->addDisplayGroup($emailAlerts, 'checkboxes');
     // Set default action
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'user', 'controller' => 'settings', 'action' => 'general'), 'default'));
 }
コード例 #21
0
 public function getMonthName($month)
 {
     static $data;
     if (!$data) {
         $data = \Zend_Locale::getTranslationList('month', $this->locale);
     }
     $month = intval($month);
     // Sometimes month comes through as '02'
     if (isset($data[$month])) {
         return $data[$month];
     }
 }
コード例 #22
0
ファイル: Country.php プロジェクト: ChristophWurst/pimcore
 private function buildOptions()
 {
     $countries = \Zend_Locale::getTranslationList('territory');
     asort($countries);
     $options = array();
     foreach ($countries as $short => $translation) {
         if (strlen($short) == 2) {
             $options[] = array("key" => $translation, "value" => $short);
         }
     }
     $this->setOptions($options);
 }
コード例 #23
0
 public function __construct()
 {
     $countries = \Zend_Locale::getTranslationList('territory');
     asort($countries);
     $options = [];
     foreach ($countries as $short => $translation) {
         if (strlen($short) == 2) {
             $options[] = ["key" => $translation, "value" => $short];
         }
     }
     $this->setOptions($options);
 }
コード例 #24
0
ファイル: Calendar.php プロジェクト: robjacoby/xlr8u
 /**
  * Sets up the Calendar Service's params
  * @param Zend_Date $date
  */
 protected function _initServiceDateParams(Zend_Date $date)
 {
     $this->_focusMonthNames = Zend_Locale::getTranslationList('Month');
     //locale month list
     $this->_focusMonthDayNames = Zend_Locale::getTranslationList('Day');
     //locale day list
     $this->setValidDates();
     $this->_focusMonthNumDays = $date->get(Zend_Date::MONTH_DAYS);
     $this->_setNextMonth($date);
     $this->_setPrevMonth($date);
     $this->_focusMonthFirstDayOfWeek = $date->get(Zend_Date::WEEKDAY_DIGIT);
     $this->_focusMonthNumWeeks = ceil(($this->getFocusMonthFirstDayOfWeek() + $this->getFocusMonthNumDays()) / 7);
 }
コード例 #25
0
ファイル: countries.php プロジェクト: Mihail9575/concrete5
 public function __construct()
 {
     Loader::library('3rdparty/Zend/Locale');
     $countries = Zend_Locale::getTranslationList('territory', Localization::activeLocale(), 2);
     unset($countries['FX'], $countries['IM'], $countries['JE'], $countries['NT'], $countries['PU'], $countries['ZZ'], $countries['CS'], $countries['CT'], $countries['DD'], $countries['PC'], $countries['PZ'], $countries['SU'], $countries['VD'], $countries['YD']);
     $countriesFromEvent = Events::fire('on_get_countries_list', $countries);
     if (is_array($countriesFromEvent)) {
         $countries = $countriesFromEvent;
     } else {
         asort($countries, SORT_LOCALE_STRING);
     }
     $this->countries = $countries;
 }
コード例 #26
0
ファイル: Templates.php プロジェクト: robeendey/ce
 public function init()
 {
     // Set form attributes
     $this->setTitle('Mail Templates')->setDescription('CORE_FORM_ADMIN_SETTINGS_EMAIL_DESCRIPTION');
     // Element: language
     $this->addElement('Select', 'language', array('label' => 'Language Pack', 'description' => 'Your community has more than one language pack installed. Please select the language pack you want to edit right now.', 'onchange' => 'javascript:setEmailLanguage(this.value);'));
     // Languages
     $localeObject = Zend_Registry::get('Locale');
     $translate = Zend_Registry::get('Zend_Translate');
     $languageList = $translate->getList();
     $languages = Zend_Locale::getTranslationList('language', $localeObject);
     $territories = Zend_Locale::getTranslationList('territory', $localeObject);
     $localeMultiOptions = array();
     foreach ($languageList as $key) {
         $languageName = null;
         if (!empty($languages[$key])) {
             $languageName = $languages[$key];
         } else {
             $tmpLocale = new Zend_Locale($key);
             $region = $tmpLocale->getRegion();
             $language = $tmpLocale->getLanguage();
             if (!empty($languages[$language]) && !empty($territories[$region])) {
                 $languageName = $languages[$language] . ' (' . $territories[$region] . ')';
             }
         }
         if ($languageName) {
             $localeMultiOptions[$key] = $languageName . ' [' . $key . ']';
         }
     }
     $defaultLanguage = Engine_Api::_()->getApi('settings', 'core')->getSetting('core.locale.locale', 'en');
     if (isset($localeMultiOptions[$defaultLanguage])) {
         $localeMultiOptions = array_merge(array($defaultLanguage => $localeMultiOptions[$defaultLanguage]), $localeMultiOptions);
     }
     $this->language->setMultiOptions($localeMultiOptions);
     // Element: template_id
     $this->addElement('Select', 'template', array('label' => 'Choose Message', 'onchange' => 'javascript:fetchEmailTemplate(this.value);', 'ignore' => true));
     $this->template->getDecorator("Description")->setOption("placement", "append");
     foreach (Engine_Api::_()->getDbtable('MailTemplates', 'core')->fetchAll() as $mailTemplate) {
         $title = $translate->_(strtoupper("_email_" . $mailTemplate->type . "_title"));
         $this->template->addMultiOption($mailTemplate->mailtemplate_id, $title);
     }
     // Element: subject
     $this->addElement('Text', 'subject', array('label' => 'Subject', 'style' => 'min-width:400px;'));
     // Element: body
     $this->addElement('Textarea', 'body', array('label' => 'Message Body'));
     // Element: submit
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true));
 }
コード例 #27
0
ファイル: RegionListbox.php プロジェクト: que273/siremis
 public function getFromList(&$list)
 {
     require_once 'Zend/Locale.php';
     $locale = new Zend_Locale(I18n::getInstance()->getCurrentLanguage());
     $code2name = $locale->getTranslationList('territory', $locale, 2);
     $list = array();
     $i = 0;
     foreach ($code2name as $key => $value) {
         if ((int) $key == 0) {
             $list[$i]['val'] = $key;
             $list[$i]['txt'] = $value;
             $i++;
         }
     }
     return $list;
 }
コード例 #28
0
 public function __construct($name, $title = null, $source = null, $value = "", $form = null)
 {
     if (!is_array($source)) {
         // Get a list of countries from Zend
         $source = Zend_Locale::getTranslationList('territory', $this->locale(), 2);
         // We want them ordered by display name, not country code
         // PHP 5.3 has an extension that sorts UTF-8 strings correctly
         if (class_exists('Collator') && ($collator = Collator::create($this->locale()))) {
             $collator->asort($source);
         } else {
             asort($source);
         }
         // We don't want "unknown country" as an option
         unset($source['ZZ']);
     }
     parent::__construct($name, $title === null ? $name : $title, $source, $value, $form);
 }
コード例 #29
0
 public function createcountriesAction()
 {
     $language = $this->_getParam("language");
     $locale = new Zend_Locale($language);
     $regions = Zend_Locale::getTranslationList('RegionToTerritory');
     $countryGroup = array();
     foreach ($regions as $region => $countriesString) {
         $countries = explode(' ', $countriesString);
         foreach ($countries as $country) {
             $countryGroup[$country] = $locale->getTranslation($region, 'territory', $locale);
         }
     }
     $countries = Country::getCountries();
     foreach ($countries as $iso => $name) {
         $currencyCode = Country::getCurrencyCodeForCountry($iso);
         $currencyDetail = Country::getCurrencyDetail($currencyCode);
         if (!$currencyCode || !$currencyDetail) {
             continue;
         }
         $currencyName = $currencyDetail['name'];
         $currencySymbol = $currencyDetail['symbol'];
         $currencyIsoNumber = $currencyDetail['isocode'];
         //Check if currency Object already exists
         $currencyObject = Model\Currency::getByName($currencyName);
         if (!$currencyObject instanceof Model\Currency) {
             $currencyObject = new Model\Currency();
             $currencyObject->setSymbol($currencySymbol);
             $currencyObject->setNumericIsoCode($currencyIsoNumber);
             $currencyObject->setIsoCode($currencyCode);
             $currencyObject->setExchangeRate(1);
         }
         $currencyObject->setName($currencyName);
         $currencyObject->save();
         //Check if country Object already exists
         $countryObject = Model\Country::getByIsoCode($iso);
         if (!$countryObject instanceof Model\Country) {
             $countryObject = new Model\Country();
         }
         $countryObject->setName($name);
         $countryObject->setIsoCode($iso);
         $countryObject->setActive(false);
         $countryObject->setCurrency($currencyObject);
         $countryObject->save();
     }
     $this->_helper->json(array("success" => true));
 }
コード例 #30
0
 public function indexAction()
 {
     // Make form
     $this->view->form = $form = new Payment_Form_Admin_Settings_Global();
     // Populate currency options
     $supportedCurrencyIndex = array();
     $fullySupportedCurrencies = array();
     $supportedCurrencies = array();
     $gateways = array();
     $gatewaysTable = Engine_Api::_()->getDbtable('gateways', 'payment');
     foreach ($gatewaysTable->fetchAll() as $gateway) {
         $gateways[$gateway->gateway_id] = $gateway->title;
         $gatewayObject = $gateway->getGateway();
         $currencies = $gatewayObject->getSupportedCurrencies();
         if (empty($currencies)) {
             continue;
         }
         $supportedCurrencyIndex[$gateway->title] = $currencies;
         if (empty($fullySupportedCurrencies)) {
             $fullySupportedCurrencies = $currencies;
         } else {
             $fullySupportedCurrencies = array_intersect($fullySupportedCurrencies, $currencies);
         }
         $supportedCurrencies = array_merge($supportedCurrencies, $currencies);
     }
     $supportedCurrencies = array_diff($supportedCurrencies, $fullySupportedCurrencies);
     $translationList = Zend_Locale::getTranslationList('nametocurrency', Zend_Registry::get('Locale'));
     $fullySupportedCurrencies = array_intersect_key($translationList, array_flip($fullySupportedCurrencies));
     $supportedCurrencies = array_intersect_key($translationList, array_flip($supportedCurrencies));
     $form->getElement('currency')->setMultiOptions(array('Fully Supported' => $fullySupportedCurrencies, 'Partially Supported' => $supportedCurrencies));
     $this->view->gateways = $gateways;
     $this->view->supportedCurrencyIndex = $supportedCurrencyIndex;
     // Populate form
     $form->populate((array) Engine_Api::_()->getApi('settings', 'core')->payment);
     // Check method/data
     if (!$this->getRequest()->isPost()) {
         return;
     }
     if (!$form->isValid($this->getRequest()->getPost())) {
         return;
     }
     // Save settings
     Engine_Api::_()->getApi('settings', 'core')->payment = $form->getValues();
     $form->addNotice('Your changes have been saved.');
 }