当前位置: 首页>>代码示例>>PHP>>正文


PHP CCurrency::Add方法代码示例

本文整理汇总了PHP中CCurrency::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CCurrency::Add方法的具体用法?PHP CCurrency::Add怎么用?PHP CCurrency::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCurrency的用法示例。


在下文中一共展示了CCurrency::Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CheckCurrency

 function CheckCurrency($currency)
 {
     global $CML2_CURRENCY;
     if ($currency == $this->mess["IBLOCK_XML2_RUB"]) {
         $currency = "RUB";
     } elseif (!preg_match("/^[a-zA-Z]+\$/", $currency)) {
         if (is_array($CML2_CURRENCY) && isset($CML2_CURRENCY[$currency]) && is_string($CML2_CURRENCY[$currency]) && preg_match("/^[a-zA-Z0-9]+\$/", $CML2_CURRENCY[$currency])) {
             $currency = $CML2_CURRENCY[$currency];
         } else {
             $currency = "RUB";
             $this->LAST_ERROR = GetMessage("IBLOCK_XML2_CURRENCY_ERROR");
         }
     }
     if (!isset($this->arCurrencyCache[$currency])) {
         if ($this->bCatalog && CModule::IncludeModule('currency')) {
             CCurrency::Add(array("CURRENCY" => $currency));
         }
         $this->arCurrencyCache[$currency] = true;
     }
     return $currency;
 }
开发者ID:nycmic,项目名称:bittest,代码行数:21,代码来源:cml2.php

示例2: Add

 public static function Add($arFields)
 {
     if (!CModule::IncludeModule('currency')) {
         self::$LAST_ERROR = GetMessage('CRM_CURRERCY_MODULE_IS_NOT_INSTALLED');
         return false;
     }
     global $APPLICATION;
     $ID = isset($arFields['CURRENCY']) ? $arFields['CURRENCY'] : '';
     if (!self::CheckFields('ADD', $arFields, $ID)) {
         return false;
     }
     $ID = CCurrency::Add($arFields);
     if (!$ID) {
         $ex = $APPLICATION->GetException();
         if ($ex) {
             self::$LAST_ERROR = $ex->GetString();
         }
         return false;
     }
     self::ClearCache();
     return $ID;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:22,代码来源:crm_currency.php

示例3: array

 }
 $strAction = $ID ? 'UPDATE' : 'ADD';
 $langSettings = array();
 foreach ($langID as &$oneLang) {
     if (isset($_POST['LANG_' . $oneLang])) {
         $langSettings[$oneLang] = $_POST['LANG_' . $oneLang];
     }
 }
 unset($oneLang);
 $arFields['LANG'] = $langSettings;
 unset($langSettings);
 $DB->StartTransaction();
 if ($ID) {
     $res = CCurrency::Update($ID, $arFields);
 } else {
     $ID = (string) CCurrency::Add($arFields);
     $res = $ID !== '';
 }
 if (!$res) {
     $DB->Rollback();
     if ($ex = $APPLICATION->GetException()) {
         $errorMessage[] = $ex->GetString();
     } else {
         $errorMessage[] = ($ID ? str_replace('#ID#', $ID, GetMessage('BT_CURRENCY_EDIT_ERR_UPDATE')) : GetMessage('BT_CURRENCY_EDIT_ERR_ADD')) . "<br>";
     }
 } else {
     $DB->Commit();
     if (empty($_POST['apply'])) {
         LocalRedirect('/bitrix/admin/currencies.php?lang=' . LANGUAGE_ID);
     }
     LocalRedirect('/bitrix/admin/currency_edit.php?ID=' . $ID . '&lang=' . LANGUAGE_ID . '&' . $tabControl->ActiveTabParam());
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:currency_edit.php

示例4: array

            CCurrency::Add($arFields);
            $dbLangs = CLanguage::GetList($b, $o, array("ACTIVE" => "Y"));
            while ($arLangs = $dbLangs->Fetch()) {
                IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/currency/install_lang.php", $arLangs["LID"]);
                $arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "UAH", "FORMAT_STRING" => GetMessage("CUR_INSTALL_UAH_FORMAT_STRING") ? GetMessage("CUR_INSTALL_UAH_FORMAT_STRING") : "", "FULL_NAME" => GetMessage("CUR_INSTALL_UAH_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_UAH_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_UAH_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2, "HIDE_ZERO" => "Y");
                if (!empty($arFields)) {
                    CCurrencyLang::Add($arFields);
                }
            }
        }
        break;
    case 'bl':
        $iblockXMLFilePrices = WIZARD_SERVICE_RELATIVE_PATH . "/xml/" . LANGUAGE_ID . "/catalog_prices_bl.xml";
        if (!CCurrency::GetByID('BYR')) {
            $arFields = array("CURRENCY" => "BYR", "AMOUNT" => 36.72, "AMOUNT_CNT" => 10000, "SORT" => 500);
            CCurrency::Add($arFields);
            $dbLangs = CLanguage::GetList($b, $o, array("ACTIVE" => "Y"));
            while ($arLangs = $dbLangs->Fetch()) {
                IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/currency/install_lang.php", $arLangs["LID"]);
                $arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "BYR", "FORMAT_STRING" => GetMessage("CUR_INSTALL_BYR_FORMAT_STRING") ? GetMessage("CUR_INSTALL_BYR_FORMAT_STRING") : "", "FULL_NAME" => GetMessage("CUR_INSTALL_BYR_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_BYR_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_BYR_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2, "HIDE_ZERO" => "Y");
                if (!empty($arFields)) {
                    CCurrencyLang::Add($arFields);
                }
            }
        }
        break;
    default:
        $iblockXMLFilePrices = WIZARD_SERVICE_RELATIVE_PATH . "/xml/" . LANGUAGE_ID . "/catalog_prices.xml";
        break;
}
$iblockCode = "clothes_" . WIZARD_SITE_ID;
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:catalog.php

示例5: InstallDB

 function InstallDB()
 {
     global $DB, $DBType, $APPLICATION;
     global $stackCacheManager;
     global $CACHE_MANAGER;
     $this->errors = false;
     if (!$DB->Query("SELECT COUNT(CURRENCY) FROM b_catalog_currency", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/currency/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("", $this->errors));
         return false;
     }
     RegisterModule("currency");
     $stackCacheManager->Clear("currency_currency_lang");
     $CACHE_MANAGER->Clean("currency_currency_list");
     $CACHE_MANAGER->Clean("currency_base_currency");
     $stackCacheManager->Clear("currency_rate");
     if (CModule::IncludeModule("currency")) {
         $dbCurrency = CCurrency::GetList($by = "sort", $order = "asc");
         if (!$dbCurrency->Fetch()) {
             $rsLang = CLanguage::GetByID("ru");
             if ($arLang = $rsLang->Fetch()) {
                 $arFields = array("CURRENCY" => "RUB", "AMOUNT" => 1, "AMOUNT_CNT" => 1, "SORT" => 100);
                 CCurrency::Add($arFields);
                 $arFields = array("CURRENCY" => "USD", "AMOUNT" => 30.33, "AMOUNT_CNT" => 1, "SORT" => 200);
                 CCurrency::Add($arFields);
                 $arFields = array("CURRENCY" => "EUR", "AMOUNT" => 38.98, "AMOUNT_CNT" => 1, "SORT" => 300);
                 CCurrency::Add($arFields);
                 $arFields = array("CURRENCY" => "UAH", "AMOUNT" => 3.77, "AMOUNT_CNT" => 1, "SORT" => 400);
                 CCurrency::Add($arFields);
                 $arCurrency = array("RUB", "USD", "EUR", "UAH");
             } else {
                 $rsLang = CLanguage::GetByID("de");
                 if ($arLang = $rsLang->Fetch()) {
                     $arFields = array("CURRENCY" => "USD", "AMOUNT" => 0.78, "AMOUNT_CNT" => 1, "SORT" => 200);
                     CCurrency::Add($arFields);
                     $arFields = array("CURRENCY" => "EUR", "AMOUNT" => 1, "AMOUNT_CNT" => 1, "SORT" => 100);
                     CCurrency::Add($arFields);
                     $arCurrency = array("USD", "EUR");
                 } else {
                     $arFields = array("CURRENCY" => "USD", "AMOUNT" => 1, "AMOUNT_CNT" => 1, "SORT" => 100);
                     CCurrency::Add($arFields);
                     $arFields = array("CURRENCY" => "EUR", "AMOUNT" => 1.26, "AMOUNT_CNT" => 1, "SORT" => 200);
                     CCurrency::Add($arFields);
                     $arCurrency = array("USD", "EUR");
                 }
             }
             $dbLangs = CLanguage::GetList($b = "", $o = "", array("ACTIVE" => "Y"));
             while ($arLangs = $dbLangs->Fetch()) {
                 $CACHE_MANAGER->Clean("currency_currency_list_" . $arLangs["LID"]);
                 IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/currency/install_lang.php", $arLangs["LID"]);
                 foreach ($arCurrency as $val) {
                     $arFields = array();
                     if ($val == "USD") {
                         $arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "USD", "FORMAT_STRING" => GetMessage("CUR_INSTALL_USD_FORMAT_STRING"), "FULL_NAME" => GetMessage("CUR_INSTALL_USD_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_USD_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_USD_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2);
                     } elseif ($val == "EUR") {
                         $arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "EUR", "FORMAT_STRING" => GetMessage("CUR_INSTALL_EUR_FORMAT_STRING"), "FULL_NAME" => GetMessage("CUR_INSTALL_EUR_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_EUR_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_EUR_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2);
                     } elseif ($val == "RUB") {
                         $arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "RUB", "FORMAT_STRING" => GetMessage("CUR_INSTALL_RUB_FORMAT_STRING"), "FULL_NAME" => GetMessage("CUR_INSTALL_RUB_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_RUB_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_RUB_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2);
                     } elseif ($val == "UAH") {
                         $arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "UAH", "FORMAT_STRING" => GetMessage("CUR_INSTALL_UAH_FORMAT_STRING"), "FULL_NAME" => GetMessage("CUR_INSTALL_UAH_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_UAH_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_UAH_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2);
                     }
                     CCurrencyLang::Add($arFields);
                 }
             }
         }
     }
     $stackCacheManager->Clear("currency_currency_lang");
     $CACHE_MANAGER->Clean("currency_currency_list");
     $CACHE_MANAGER->Clean("currency_base_currency");
     $stackCacheManager->Clear("currency_rate");
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:74,代码来源:index.php


注:本文中的CCurrency::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。