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


PHP CCurrencyRates::Add方法代码示例

本文整理汇总了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));
            }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:currency_rate_edit.php

示例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));
            }
        }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:currency_rate_edit.php


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