當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Currency::config方法代碼示例

本文整理匯總了PHP中Currency::config方法的典型用法代碼示例。如果您正苦於以下問題:PHP Currency::config方法的具體用法?PHP Currency::config怎麽用?PHP Currency::config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Currency的用法示例。


在下文中一共展示了Currency::config方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

    public function init()
    {
        // Send default settings according to locale
        $locale = i18n::get_locale();
        $symbols = Zend_Locale_Data::getList($locale, 'symbols');
        $currency = Currency::config()->currency_symbol;
        $decimals = $symbols['decimal'];
        $thousands = $decimals == ',' ? ' ' : ',';
        // Accouting needs to be initialized globally
        FormExtraJquery::include_accounting();
        Requirements::customScript(<<<EOT
    window.accounting.settings = {
        currency: {
            symbol : "{$currency}",
            format: "%s%v",
            decimal : "{$decimals}",
            thousand: "{$thousands}",
            precision : 2
        },
        number: {
            precision : 0,
            thousand: "{$thousands}",
            decimal : "{$decimals}"
        }
    }
EOT
, 'accountingInit');
    }
開發者ID:helpfulrobot,項目名稱:lekoala-silverstripe-form-extras,代碼行數:28,代碼來源:FormExtraLeftAndMainExtension.php

示例2: init

 /**
  * Init actions that happen globally to all commerce interfaces.
  *
  * At the moment this is used to set config where database access is required
  */
 public function init()
 {
     // Set the default currency symbol
     if ($siteconfig = SiteConfig::current_site_config()) {
         Currency::config()->currency_symbol = $siteconfig->Currency()->HTMLNotation;
     }
     parent::init();
 }
開發者ID:helpfulrobot,項目名稱:i-lateral-silverstripe-commerce,代碼行數:13,代碼來源:Commerce_Controller.php

示例3: onBeforeInit

 public function onBeforeInit()
 {
     $controller = $this->owner->request->param("Controller");
     $action = $this->owner->request->param("Action");
     if ($controller != "DevelopmentAdmin" && $action != "build") {
         $config = SiteConfig::current_site_config();
         // Set the default currency symbol for this site
         Currency::config()->currency_symbol = Checkout::config()->currency_symbol;
         // Auto inject the order prefix to the orders module if it exists
         if (class_exists("Order") && class_exists("SiteConfig") && $config) {
             Order::config()->order_prefix = $config->PaymentNumberPrefix;
         }
     }
 }
開發者ID:helpfulrobot,項目名稱:i-lateral-silverstripe-checkout,代碼行數:14,代碼來源:CheckoutControllerExtension.php

示例4: setCurrencySymbol

 /**
  * @deprecated 4.0 Use the "Currency.currency_symbol" config setting instead
  * @param [type] $value [description]
  */
 public static function setCurrencySymbol($value)
 {
     Deprecation::notice('4.0', 'Use the "Currency.currency_symbol" config setting instead');
     Currency::config()->currency_symbol = $value;
 }
開發者ID:ivoba,項目名稱:silverstripe-framework,代碼行數:9,代碼來源:Currency.php

示例5: include_accounting

    public static function include_accounting()
    {
        if (self::$disabled || in_array('accounting', self::$included)) {
            return;
        }
        if (Director::isDev()) {
            Requirements::block(FORM_EXTRAS_PATH . '/javascript/accounting/accounting.min.js');
            Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/accounting/accounting.js');
        } else {
            Requirements::block(FORM_EXTRAS_PATH . '/javascript/accounting/accounting.js');
            Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/accounting/accounting.min.js');
        }
        if (Controller::has_curr() && Controller::curr() instanceof LeftAndMain) {
            // In admin we rely on extension because of ajax architecture
            self::$included[] = 'accounting';
            return;
        }
        // Send default settings according to locale
        $locale = i18n::get_locale();
        $symbols = Zend_Locale_Data::getList($locale, 'symbols');
        $currency = Currency::config()->currency_symbol;
        $decimals = $symbols['decimal'];
        $thousands = $decimals == ',' ? ' ' : ',';
        Requirements::customScript(<<<JS
window.accounting.settings = {
    currency: {
        symbol : "{$currency}",
        format: "%s%v",
        decimal : "{$decimals}",
        thousand: "{$thousands}",
        precision : 2
    },
    number: {
        precision : 0,
        thousand: "{$thousands}",
        decimal : "{$decimals}"
    }
}
JS
, 'accountingInit');
        self::$included[] = 'accounting';
    }
開發者ID:helpfulrobot,項目名稱:lekoala-silverstripe-form-extras,代碼行數:42,代碼來源:FormExtraJquery.php


注:本文中的Currency::config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。