コード例 #1
0
ファイル: Emulation.php プロジェクト: okite11/frames21
 /**
  * Restore locale of the initial store
  *
  * @param string $initialLocaleCode
  * @param string $initialArea
  *
  * @return Mage_Core_Model_App_Emulation
  */
 protected function _restoreInitialLocale($initialLocaleCode, $initialArea = Mage_Core_Model_App_Area::AREA_ADMINHTML)
 {
     $currentLocaleCode = $this->_app->getLocale()->getLocaleCode();
     if ($currentLocaleCode != $initialLocaleCode) {
         $this->_app->getLocale()->setLocaleCode($initialLocaleCode);
         $this->_factory->getSingleton('core/translate')->setLocale($initialLocaleCode)->init($initialArea, true);
     }
     return $this;
 }
コード例 #2
0
 /**
  * This function validates and operates on 'date expires' field of a gift card.
  *
  * @throws Mage_Core_Exception
  * @return Mage_Core_Model_Abstract
  */
 protected function _setAndValidateDateExpires()
 {
     if (is_numeric($this->getLifetime()) && $this->getLifetime() > 0) {
         $this->setDateExpires(date('Y-m-d', strtotime("now +{$this->getLifetime()}days")));
     } else {
         if ($this->getDateExpires()) {
             $expirationDate = $this->_app->getLocale()->date($this->getDateExpires(), Varien_Date::DATE_INTERNAL_FORMAT, null, false);
             $currentDate = $this->_app->getLocale()->date(null, Varien_Date::DATE_INTERNAL_FORMAT, null, false);
             if ($expirationDate < $currentDate) {
                 throw new Mage_Core_Exception($this->helper('enterprise_giftcardaccount')->__('Expiration date cannot be in the past.'));
             }
         } else {
             $this->setDateExpires(null);
         }
     }
     return $this;
 }
コード例 #3
0
ファイル: AppTest.php プロジェクト: nemphys/magento2
 public function testGetLocale()
 {
     $locale = $this->_model->getLocale();
     $this->assertInstanceOf('Mage_Core_Model_Locale', $locale);
     $this->assertSame($locale, $this->_model->getLocale());
 }
コード例 #4
0
ファイル: Console.php プロジェクト: okite11/frames21
 /**
  * Print available currency, locale and timezone options
  *
  * @return Mage_Install_Model_Installer_Console
  */
 public function printOptions()
 {
     $options = array('locale' => $this->_app->getLocale()->getOptionLocales(), 'currency' => $this->_app->getLocale()->getOptionCurrencies(), 'timezone' => $this->_app->getLocale()->getOptionTimezones());
     var_export($options);
     return $this;
 }
コード例 #5
0
 /**
  * Get prices javascript format json
  *
  * @param   mixed $store
  * @return  string
  */
 public function getPriceFormat($store = null)
 {
     $this->_app->getLocale()->emulate($store);
     $priceFormat = $this->_app->getLocale()->getJsPriceFormat();
     $this->_app->getLocale()->revert();
     if ($store) {
         $priceFormat['pattern'] = $this->_app->getStore($store)->getCurrentCurrency()->getOutputFormat();
     }
     return Mage::helper('core')->jsonEncode($priceFormat);
 }