本文整理汇总了PHP中CCurrencyRates::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CCurrencyRates::Add方法的具体用法?PHP CCurrencyRates::Add怎么用?PHP CCurrencyRates::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCurrencyRates
的用法示例。
在下文中一共展示了CCurrencyRates::Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$arFields = array();
$ID = 0;
if (isset($_REQUEST['ID'])) {
$ID = (int) $_REQUEST['ID'];
}
if ($ID < 0) {
$ID = 0;
}
$aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("curr_rates_rate"), "ICON" => "currency", "TITLE" => GetMessage("curr_rates_rate_ex")));
$tabControl = new CAdminTabControl("tabControl", $aTabs);
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['Update']) && $CURRENCY_RIGHT == "W" && check_bitrix_sessid()) {
$arFields = array('DATE_RATE' => isset($_POST['DATE_RATE']) ? $_POST['DATE_RATE'] : '', 'RATE' => isset($_POST['RATE']) ? $_POST['RATE'] : '', 'RATE_CNT' => isset($_POST['RATE_CNT']) ? $_POST['RATE_CNT'] : '', 'CURRENCY' => isset($_POST['CURRENCY']) ? $_POST['CURRENCY'] : '');
if ($ID > 0) {
$res = CCurrencyRates::Update($ID, $arFields);
} else {
$ID = (int) CCurrencyRates::Add($arFields);
$res = $ID > 0;
}
if (!$res) {
if ($ex = $APPLICATION->GetException()) {
$errorMessage[] = $ex->GetString();
} else {
$errorMessage[] = $ID > 0 ? GetMessage('BX_CURRENCY_RATE_EDIT_ERR_UPDATE', array('#ID#' => $ID)) : GetMessage('BX_CURRENCY_RATE_EDIT_ERR_ADD');
}
} else {
if (empty($_POST['apply'])) {
if (!empty($return_url)) {
LocalRedirect($return_url);
} else {
LocalRedirect("/bitrix/admin/currencies_rates.php?lang=" . LANGUAGE_ID . GetFilterParams("filter_", false));
}
示例2: __IncludeLang
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
__IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/currency/lang/", "/currencies_rates.php"));
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/currency/prolog.php";
ClearVars();
$message = null;
$bVarsFromForm = false;
$ID = intval($ID);
$aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("curr_rates_rate"), "ICON" => "main_user_edit", "TITLE" => GetMessage("curr_rates_rate_ex")));
$tabControl = new CAdminTabControl("tabControl", $aTabs);
if ($REQUEST_METHOD == "POST" && strlen($Update) > 0 && $CURRENCY_RIGHT == "W" && check_bitrix_sessid()) {
$arFields = array("DATE_RATE" => $DATE_RATE, "RATE" => $RATE, "RATE_CNT" => $RATE_CNT, "CURRENCY" => $CURRENCY);
if ($ID > 0) {
$res = CCurrencyRates::Update($ID, $arFields);
} else {
$ID = CCurrencyRates::Add($arFields);
$res = $ID > 0;
}
if (!$res) {
if ($e = $APPLICATION->GetException()) {
$message = new CAdminMessage(GetMessage("currency_error"), $e);
}
$bVarsFromForm = true;
} else {
if (strlen($apply) <= 0) {
if (strlen($return_url) > 0) {
LocalRedirect($return_url);
} else {
LocalRedirect("/bitrix/admin/currencies_rates.php?lang=" . LANGUAGE_ID . GetFilterParams("filter_", false));
}
}