本文整理汇总了PHP中CCurrencyRates::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CCurrencyRates::GetByID方法的具体用法?PHP CCurrencyRates::GetByID怎么用?PHP CCurrencyRates::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCurrencyRates
的用法示例。
在下文中一共展示了CCurrencyRates::GetByID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CAdminFilter
$filter = new CAdminFilter($sTableID . "_filter", array(GetMessage("curr_rates_curr1")));
$arFilter = array("CURRENCY" => $filter_currency, "DATE_RATE" => $filter_period_from, "!DATE_RATE" => $filter_period_to);
if ($by != "curr" && $by != "rate") {
$by = "date";
}
$order = strtolower($order);
if ($order != "asc") {
$order = "desc";
}
if ($CURRENCY_RIGHT == "W" && $lAdmin->EditAction()) {
foreach ($FIELDS as $ID => $arFields) {
$ID = (int) $ID;
if (!$lAdmin->IsUpdated($ID)) {
continue;
}
$arCurR = CCurrencyRates::GetByID($ID);
$arFields["CURRENCY"] = $arCurR["CURRENCY"];
$res = CCurrencyRates::Update($ID, $arFields);
if (!$res) {
if ($e = $APPLICATION->GetException()) {
$lAdmin->AddUpdateError(GetMessage("SAVE_ERROR") . $ID . ": " . str_replace("<br>", " ", $e->GetString()), $ID);
}
}
}
}
if ($CURRENCY_RIGHT == "W" && ($arID = $lAdmin->GroupAction())) {
if ($_REQUEST['action_target'] == 'selected') {
$rsData = CCurrencyRates::GetList($by, $order, $arFilter);
while ($arRes = $rsData->Fetch()) {
$arID[] = $arRes['ID'];
}
示例2: Delete
/**
* <p>Удаляет запись с кодом ID из таблицы курсов валют. Если удаляется несуществующий курс (нет курса с таким ID) - будет ошибка. </p> <p>В случае успеха сбросится кеш <b>currency_rate</b> и тэгированный <b>currency_id_КОД_ВАЛЮТЫ</b>.</p>
*
*
*
*
* @param int $ID Код записи для удаления.
*
*
*
* @return bool <p>Возвращает значение <i>True</i> в случае успешного добавления и
* <i>False</i> - в противном случае. Текст ошибки выводится с помощью
* <code>$APPLICATION->GetException</code>.</p> <br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/currency/developer/ccurrencyrates/ccurrencyrates__delete.28de3643.php
* @author Bitrix
*/
public static function Delete($ID)
{
global $DB;
global $stackCacheManager;
global $APPLICATION;
$ID = (int) $ID;
if ($ID <= 0) {
return false;
}
foreach (GetModuleEvents("currency", "OnBeforeCurrencyRateDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
return false;
}
}
$arFields = CCurrencyRates::GetByID($ID);
if (!is_array($arFields)) {
$arMsg = array('id' => 'ID', 'text' => GetMessage('BT_MOD_CURR_ERR_RATE_CANT_DELETE_ABSENT_ID'));
$e = new CAdminException($arMsg);
$APPLICATION->ThrowException($e);
return false;
}
$stackCacheManager->Clear("currency_rate");
$strSql = "DELETE FROM b_catalog_currency_rate WHERE ID = " . $ID;
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
CCurrency::updateCurrencyBaseRate($arFields['CURRENCY']);
CCurrency::clearTagCache($arFields['CURRENCY']);
foreach (GetModuleEvents("currency", "OnCurrencyRateDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID));
}
return true;
}
示例3: LocalRedirect
}
}
LocalRedirect("/bitrix/admin/currency_rate_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
}
}
$defaultValues = array('DATE_RATE' => '', 'CURRENCY' => '', 'RATE_CNT' => '', 'RATE' => '');
if ($ID > 0) {
$APPLICATION->SetTitle(GetMessage("CURRENCY_EDIT_TITLE"));
} else {
$APPLICATION->SetTitle(GetMessage("CURRENCY_NEW_TITLE"));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
CJSCore::Init(array('ajax'));
$currencyRate = $defaultValues;
if ($ID > 0) {
$currencyRate = CCurrencyRates::GetByID($ID);
if (empty($currencyRate)) {
$ID = 0;
$currencyRate = $defaultValues;
}
}
if (!empty($errorMessage)) {
$currencyRate = $arFields;
}
$aContext = array(array("ICON" => "btn_list", "TEXT" => GetMessage("MAIN_ADMIN_MENU_LIST"), "LINK" => "/bitrix/admin/currencies_rates.php?lang=" . LANGUAGE_ID, "TITLE" => GetMessage("MAIN_ADMIN_MENU_LIST")));
if ($ID > 0) {
$aContext[] = array("ICON" => "btn_new", "TEXT" => GetMessage("MAIN_ADMIN_MENU_CREATE"), "LINK" => "/bitrix/admin/currency_rate_edit.php?lang=" . LANGUAGE_ID, "TITLE" => GetMessage("MAIN_ADMIN_MENU_CREATE"));
if ($CURRENCY_RIGHT == "W") {
$aContext[] = array("ICON" => "btn_delete", "TEXT" => GetMessage("MAIN_ADMIN_MENU_DELETE"), "LINK" => "javascript:if(confirm('" . GetMessage("CONFIRM_DEL_MESSAGE") . "'))window.location='/bitrix/admin/currencies_rates.php?action=delete&ID=" . $ID . "&lang=" . LANGUAGE_ID . "&" . bitrix_sessid_get() . "';");
}
}
示例4: Delete
/**
* <p>Удаляет запись с кодом ID из таблицы курсов валют. Если удаляется несуществующий курс (нет курса с таким ID) - будет ошибка. </p> <p>В случае успеха сбросится кеш <b>currency_rate</b> и тэгированный <b>currency_id_КОД_ВАЛЮТЫ</b>.</p>
*
*
*
*
* @param int $ID Код записи для удаления.
*
*
*
* @return bool <p>Возвращает значение <i>True</i> в случае успешного добавления и
* <i>False</i> - в противном случае. Текст ошибки выводится с помощью
* <code>$APPLICATION->GetException</code>.</p><br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/currency/developer/ccurrencyrates/ccurrencyrates__delete.28de3643.php
* @author Bitrix
*/
public static function Delete($ID)
{
global $DB;
global $CACHE_MANAGER;
global $stackCacheManager;
global $APPLICATION;
$arMsg = array();
$ID = intval($ID);
if (0 >= $ID)
return false;
$arFields = CCurrencyRates::GetByID($ID);
if (!is_array($arFields))
{
$arMsg = array('id' => 'ID', 'text' => GetMessage('BT_MOD_CURR_ERR_RATE_CANT_DELETE_ABSENT_ID'));
$e = new CAdminException($arMsg);
$APPLICATION->ThrowException($e);
return false;
}
$stackCacheManager->Clear("currency_rate");
$strSql = "DELETE FROM b_catalog_currency_rate WHERE ID = ".$ID." ";
$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if (defined("BX_COMP_MANAGED_CACHE"))
$CACHE_MANAGER->ClearByTag("currency_id_".$arFields['CURRENCY']);
return true;
}
示例5: array
$APPLICATION->SetTitle(GetMessage("CURRENCY_EDIT_TITLE"));
} else {
$APPLICATION->SetTitle(GetMessage("CURRENCY_NEW_TITLE"));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$aContext = array(array("ICON" => "btn_list", "TEXT" => GetMessage("MAIN_ADMIN_MENU_LIST"), "LINK" => "/bitrix/admin/currencies_rates.php?lang=" . LANGUAGE_ID, "TITLE" => GetMessage("MAIN_ADMIN_MENU_LIST")));
if ($ID > 0) {
$aContext[] = array("ICON" => "btn_new", "TEXT" => GetMessage("MAIN_ADMIN_MENU_CREATE"), "LINK" => "/bitrix/admin/currency_rate_edit.php?lang=" . LANGUAGE_ID, "TITLE" => GetMessage("MAIN_ADMIN_MENU_CREATE"));
if ($CURRENCY_RIGHT == "W") {
$aContext[] = array("ICON" => "btn_delete", "TEXT" => GetMessage("MAIN_ADMIN_MENU_DELETE"), "LINK" => "javascript:if(confirm('" . GetMessage("CONFIRM_DEL_MESSAGE") . "'))window.location='/bitrix/admin/currencies_rates.php?action=delete&ID=" . $ID . "&lang=" . LANGUAGE_ID . "&" . bitrix_sessid_get() . "';");
}
}
$context = new CAdminContextMenu($aContext);
$context->Show();
if ($ID > 0 && !$bVarsFromForm) {
$result = CCurrencyRates::GetByID($ID);
$str_ID = $result["ID"];
$str_DATE_RATE = $result["DATE_RATE"];
$str_CURRENCY = $result["CURRENCY"];
$str_RATE_CNT = $result["RATE_CNT"];
$str_RATE = $result["RATE"];
}
if ($bVarsFromForm) {
$DB->InitTableVarsForEdit("b_catalog_currency_rate", "", "str_");
}
?>
<script type="text/javascript">
var arCurrencies = new Array();
var arCurrenciesNom = new Array();
<?php
$db_curr = CCurrency::GetList($by1 = "sort", $order1 = "asc");