本文整理汇总了PHP中Axis_Locale::getLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP Axis_Locale::getLocale方法的具体用法?PHP Axis_Locale::getLocale怎么用?PHP Axis_Locale::getLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axis_Locale
的用法示例。
在下文中一共展示了Axis_Locale::getLocale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCacheKey
public function getCacheKey()
{
if (null === $this->_cacheKey) {
$this->_cacheKey = md5('admin_navigation' . Axis::session()->roleId . Axis_Locale::getLocale()->toString());
}
return $this->_cacheKey;
}
示例2: __construct
/**
* Constructor
* @param string|integer|Zend_Date|array $date OPTIONAL Date value or value of date part to set
* ,depending on $part. If null the actual time is set
* @param string $part OPTIONAL Defines the input format of $date
* @param string|Zend_Locale $locale OPTIONAL Locale for parsing input
* @return Axis_Date
* @throws Zend_Date_Exception
*/
public function __construct($date = null, $part = null, $locale = null)
{
if (null === $locale) {
$locale = Axis_Locale::getLocale();
}
// supress notice about PCRE without UTF8 support
@parent::__construct($date, $part, $locale);
}
示例3: getName
/**
*
* @static
* @param string $id
* @return mixed string|void
*/
public static function getName($id)
{
if (empty($id)) {
return;
}
$locale = Axis_Locale::getLocale();
$name = $locale->getTranslation($id, 'WindowsToTimezone', $locale);
return empty($name) ? $id : $name . ' (' . $id . ')';
}
示例4: _loadCollection
/**
*
* @return array
*/
protected function _loadCollection()
{
$locale = Axis_Locale::getLocale();
$currencies = $locale->getTranslationList('NameToCurrency', $locale);
if (!$currencies) {
$currencies = $locale->getTranslationList('NameToCurrency', Axis_Locale::DEFAULT_LOCALE);
}
return $currencies;
}
示例5: _loadCollection
/**
*
* @return array
*/
protected function _loadCollection()
{
$locale = Axis_Locale::getLocale();
$countries = $locale->getTranslationList('territory', $locale, 2);
if (!$countries) {
$countries = $locale->getTranslationList('territory', Axis_Locale::DEFAULT_LOCALE, 2);
}
return $countries;
}
示例6: addJsValidateTranslation
public function addJsValidateTranslation()
{
if (file_exists('js/jquery/jquery-validation-1.9.01/localization/messages_' . Axis_Locale::getLocale()->toString() . '.js')) {
$this->view->headScript()->appendFile('js/jquery/jquery-validation-1.9.0/localization/messages_' . Axis_Locale::getLocale()->toString() . '.js');
} elseif (file_exists('js/jquery/jquery-validation-1.9.0/localization/messages_' . Axis_Locale::getLocale()->getLanguage() . '.js')) {
$this->view->headScript()->appendFile('js/jquery/jquery-validation-1.9.0/localization/messages_' . Axis_Locale::getLocale()->getLanguage() . '.js');
} elseif (file_exists('js/jquery/jquery-validation-1.9.0/localization/messages_' . strtolower(Axis_Locale::getLocale()->getRegion()) . '.js')) {
$this->view->headScript()->appendFile('js/jquery/jquery-validation-1.9.0/localization/messages_' . strtolower(Axis_Locale::getLocale()->getRegion()) . '.js');
}
}
示例7: getName
/**
*
* @static
* @param int $id
* @return mixed string|void
*/
public static function getName($id)
{
if (empty($id)) {
return;
}
$data = explode('_', $id);
$locale = Axis_Locale::getLocale();
$language = $locale->getTranslation($data[0], 'language', $locale);
$country = $locale->getTranslation($data[1], 'country', $locale);
return ucfirst($language) . ' (' . $country . ')';
}
示例8: _loadCollection
/**
*
* @return array
*/
protected function _loadCollection()
{
$options = array();
$locale = Axis_Locale::getLocale();
$zones = $locale->getTranslationList('WindowsToTimezone', $locale);
if (!$zones) {
$zones = $locale->getTranslationList('WindowsToTimezone', Axis_Locale::DEFAULT_LOCALE);
}
asort($zones);
foreach ($zones as $code => $name) {
$name = trim($name);
$options[$code] = empty($name) ? $code : $name . ' (' . $code . ')';
}
return $options;
}
示例9: create
/**
*
* @param array $data
* @return type
*/
public function create(array $data)
{
$row = $this->createRow($data);
if (empty($row->password)) {
$row->password = $this->generatePassword();
}
$password = $row->password;
$row->password = md5($password);
$row->modified_at = Axis_Date::now()->toSQLString();
if (empty($row->created_at)) {
$row->created_at = $row->modified_at;
}
if (empty($row->locale)) {
$row->locale = Axis_Locale::getLocale()->toString();
}
$row->save();
return array($row, $password);
}
示例10: _loadCollection
/**
*
* @return array
*/
protected function _loadCollection()
{
$options = array();
$locale = Axis_Locale::getLocale();
$locales = $locale->getLocaleList();
// error here
$languages = $locale->getTranslationList('language', $locale);
$countries = $locale->getTranslationList('territory', $locale, 2);
if (!$languages || !$countries) {
$languages = $locale->getTranslationList('language', Axis_Locale::DEFAULT_LOCALE);
$countries = $locale->getTranslationList('territory', Axis_Locale::DEFAULT_LOCALE, 2);
}
foreach ($locales as $code => $isActive) {
if (!strstr($code, '_')) {
continue;
}
list($languageCode, $countryCode) = explode('_', $code);
if (!isset($languages[$languageCode]) || !isset($countries[$countryCode])) {
continue;
}
$options[$code] = ucfirst($languages[$languageCode]) . ' (' . $countries[$countryCode] . ')';
}
return $options;
}
示例11: getCurrency
/**
* Return Zend_Currency object
*
* @param string $code
* @return Zend_Currency
*/
public function getCurrency($code = '')
{
if (empty($code)) {
$code = $this->getCode();
}
if (!isset($this->_currency[$code])) {
$options = $this->_getCurrencyOptions($code);
Zend_Currency::setCache(Axis::cache());
try {
$currency = new Zend_Currency($options['currency'], $options['format'] === null ? Axis_Locale::getLocale() : $options['format']);
} catch (Zend_Currency_Exception $e) {
Axis::message()->addError($e->getMessage() . ": " . Axis::translate('locale')->__("Try to change the format of this currency to English (United States) - en_US"));
$options = $this->_getSystemSafeCurrencyOptions();
$currency = new Zend_Currency($options['currency'], $options['format']);
}
$currency->setFormat($options);
$this->_currency[$code] = $currency;
}
return $this->_currency[$code];
}
示例12: getLocale
/**
* Retrieve the code of current Axis locale
*
* @return string
*/
public function getLocale()
{
return Axis_Locale::getLocale()->toString();
}
示例13: setLocale
/**
* Set the locale to be used for email template and subject
* Locale will be automatically switched back after calling the send method
*
* @param string $locale Locale code
*/
public function setLocale($locale)
{
$this->_locale = Axis_Locale::getLocale()->toString();
Axis_Locale::setLocale($locale);
}
示例14: getAdminLocales
/**
* Retrieve the list of available admin intrerface tranlations
*
* @static
* @return array
*/
public static function getAdminLocales()
{
if (!($locales = Axis::cache()->load('locales_list'))) {
$path = Axis::config()->system->path . '/app/locale';
try {
$locales_dir = new DirectoryIterator($path);
} catch (Exception $e) {
throw new Axis_Exception("Directory {$path} not readable");
}
$locale = Axis_Locale::getLocale();
$locales = array();
foreach ($locales_dir as $localeDir) {
$localeCode = $localeDir->getFilename();
if ($localeCode[0] == '.' || !strstr($localeCode, '_')) {
continue;
}
list($language, $country) = explode('_', $localeCode, 2);
$language = $locale->getTranslation($language, 'language', $localeCode);
$country = $locale->getTranslation($country, 'country', $localeCode);
if (!$language) {
$language = $locale->getTranslation($language, 'language', Axis_Locale::DEFAULT_LOCALE);
}
if (!$country) {
$country = $locale->getTranslation($country, 'country', Axis_Locale::DEFAULT_LOCALE);
}
$locales[$localeCode] = ucfirst($language) . ' (' . $country . ')';
}
ksort($locales);
Axis::cache()->save($locales, 'locales_list', array('locales'));
}
return $locales;
}
示例15: createFromCheckout
/**
* Create order, and clears shopping cart after that
*
* @return Axis_Sales_Model_Order_Row
* @throws Axis_Exception
*/
public function createFromCheckout()
{
/**
* @var Axis_Checkout_Model_Checkout $checkout
*/
$checkout = Axis::single('checkout/checkout');
if (!$checkout->getCart()->validateContent()) {
throw new Axis_Exception();
}
$orderRow = $this->createRow();
$storage = $checkout->getStorage();
if ($customer = Axis::getCustomer()) {
$orderRow->customer_id = $customer->id;
$orderRow->customer_email = $customer->email;
} else {
$orderRow->customer_email = $checkout->getBilling()->email;
}
$orderRow->site_id = Axis::getSiteId();
$orderRow->payment_method = $checkout->payment()->getTitle();
$orderRow->payment_method_code = $checkout->payment()->getCode();
$orderRow->shipping_method = $checkout->shipping()->getTitle();
$orderRow->shipping_method_code = $checkout->shipping()->getCode();
$orderRow->date_purchased_on = Axis_Date::now()->toSQLString();
$orderRow->currency = Axis::single('locale/currency')->getCode();
$orderRow->currency_rate = Axis::single('locale/currency')->getData($orderRow->currency, 'rate');
$orderRow->order_total = $checkout->getTotal()->getTotal();
$orderRow->txn_id = 0;
//@todo
$orderRow->order_status_id = 0;
$orderRow->ip_address = $_SERVER['REMOTE_ADDR'];
$orderRow->customer_comment = $storage->customer_comment;
$orderRow->locale = Axis_Locale::getLocale()->toString();
/* build delivery & billing arrays */
$addressFormatId = Axis::config('core/store/addressFormat');
$delivery = $checkout->getDelivery()->toArray();
$delivery['country'] = isset($delivery['country']['name']) ? $delivery['country']['name'] : '';
if (isset($delivery['zone']['name'])) {
$delivery['state'] = $delivery['zone']['name'];
}
$delivery['address_format_id'] = $addressFormatId;
$billing = $checkout->getBilling()->toArray();
$billing['country'] = isset($billing['country']['name']) ? $billing['country']['name'] : '';
if (isset($billing['zone']['name'])) {
$billing['state'] = $billing['zone']['name'];
}
$billing['address_format_id'] = $addressFormatId;
unset($billing['id'], $delivery['id']);
foreach ($delivery as $key => $value) {
$delivery['delivery_' . $key] = $value;
}
foreach ($billing as $key => $value) {
$billing['billing_' . $key] = $value;
}
$orderRow->setFromArray($delivery);
$orderRow->setFromArray($billing);
/* Save order (auto generate number ) */
$orderRow->save();
/* Add products to order and change quantity */
$modelOrderProduct = Axis::single('sales/order_product');
foreach ($checkout->getCart()->getProducts() as $product) {
$modelOrderProduct->add($product, $orderRow->id);
}
/* Add total info */
$total = $checkout->getTotal();
$orderTotal = Axis::single('sales/order_total');
foreach ($total->getCollects() as $collect) {
$orderTotal->insert(array('order_id' => $orderRow->id, 'code' => $collect['code'], 'title' => $collect['title'], 'value' => $collect['total']));
}
// update product stock
$orderRow->setStatus('pending');
return $orderRow;
}