當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。