本文整理匯總了PHP中CCurrencyLang::Add方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCurrencyLang::Add方法的具體用法?PHP CCurrencyLang::Add怎麽用?PHP CCurrencyLang::Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CCurrencyLang
的用法示例。
在下文中一共展示了CCurrencyLang::Add方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: elseif
if (count($locFields) == 0) {
continue;
}
if (!(isset($locFields['FULL_NAME']) && isset($locFields['FULL_NAME'][0]))) {
$locFields['FULL_NAME'] = $currencyID;
}
$currencyLocs[$k] = $locFields;
if ($result) {
$locFields['CURRENCY'] = $currencyID;
$locFields['LID'] = $k;
if (is_array(CCurrencyLang::GetByID($currencyID, $k))) {
CCurrencyLang::Update($currencyID, $k, $locFields);
} else {
$locFields['DECIMALS'] = 2;
//Default decimals
CCurrencyLang::Add($locFields);
}
}
}
if ($result) {
if ($currency['IS_ACCOUNTING_CURRENCY'] && $currencyID !== CCrmCurrency::GetAccountCurrencyID()) {
CCrmCurrency::SetAccountCurrencyID($currencyID);
} elseif (!$currency['IS_ACCOUNTING_CURRENCY'] && $currencyID === CCrmCurrency::GetAccountCurrencyID()) {
CCrmCurrency::SetAccountCurrencyID(CCrmCurrency::GetBaseCurrencyID());
}
if ($currency['IS_INVOICE_CURRENCY'] && $currencyID !== CCrmCurrency::getInvoiceDefault()) {
CCrmCurrency::setInvoiceDefault($currencyID);
}
LocalRedirect(isset($_POST['apply']) ? CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CURRENCY_EDIT'], array('currency_id' => $currencyID)) : CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CURRENCY_LIST'], array('currency_id' => $currencyID)));
}
} elseif ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['delete'])) {
示例2: SetCurrencyLocalizations
public static function SetCurrencyLocalizations($currencyID, $arItems)
{
if (!CModule::IncludeModule('currency')) {
return false;
}
$currencyID = self::NormalizeCurrencyID($currencyID);
$langsID = self::GetLanguagesID();
$allowedKeys = array_keys(self::GetCurrencyLocalizationFieldsInfo());
$processed = 0;
foreach ($langsID as $langID) {
$item = isset($arItems[$langID]) ? $arItems[$langID] : null;
if (!is_array($item)) {
continue;
}
$fields = array();
foreach ($allowedKeys as $key) {
if (isset($item[$key])) {
$fields[$key] = $item[$key];
}
}
if (empty($fields)) {
continue;
}
$fields['CURRENCY'] = $currencyID;
$fields['LID'] = $langID;
if (is_array(CCurrencyLang::GetByID($currencyID, $langID))) {
CCurrencyLang::Update($currencyID, $langID, $fields);
$processed++;
} else {
if (!isset($fields['DECIMALS'])) {
$fields['DECIMALS'] = 2;
}
CCurrencyLang::Add($fields);
$processed++;
}
}
return $processed > 0;
}
示例3: Update
public static function Update($currency, $arFields)
{
global $DB;
foreach (GetModuleEvents("currency", "OnBeforeCurrencyUpdate", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($currency, &$arFields)) === false) {
return false;
}
}
$currency = Currency\CurrencyManager::checkCurrencyID($currency);
if (!CCurrency::CheckFields('UPDATE', $arFields, $currency)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_catalog_currency", $arFields);
if (!empty($strUpdate)) {
$strSql = "update b_catalog_currency set " . $strUpdate . " where CURRENCY = '" . $DB->ForSql($currency) . "'";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
Currency\CurrencyManager::updateBaseRates($currency);
Currency\CurrencyManager::clearTagCache($currency);
if (isset(self::$currencyCache[$currency])) {
unset(self::$currencyCache[$currency]);
}
}
if (isset($arFields['LANG'])) {
foreach ($arFields['LANG'] as $lang => $settings) {
if ($settings['IS_EXIST'] == 'N') {
CCurrencyLang::Add($settings);
} else {
CCurrencyLang::Update($currency, $lang, $settings);
}
}
unset($settings, $lang);
}
if (!empty($strUpdate) || isset($arFields['LANG'])) {
Currency\CurrencyManager::clearCurrencyCache();
}
foreach (GetModuleEvents("currency", "OnCurrencyUpdate", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($currency, $arFields));
}
return $currency;
}
示例4: array
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;
$iblockType = "catalog";
$rsIBlock = CIBlock::GetList(array(), array("XML_ID" => $iblockCode, "TYPE" => $iblockType));
$IBLOCK_CATALOG_ID = false;
if ($arIBlock = $rsIBlock->Fetch()) {
$IBLOCK_CATALOG_ID = $arIBlock["ID"];
} else {
示例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;
}