本文整理汇总了PHP中CCatalogMeasure::update方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogMeasure::update方法的具体用法?PHP CCatalogMeasure::update怎么用?PHP CCatalogMeasure::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogMeasure
的用法示例。
在下文中一共展示了CCatalogMeasure::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CAdminSorting
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/catalog/prolog.php";
$sTableID = "b_catalog_measure";
$oSort = new CAdminSorting($sTableID, "ID", "asc");
$lAdmin = new CAdminList($sTableID, $oSort);
$arFilterFields = array();
$lAdmin->InitFilter($arFilterFields);
$arFilter = array();
if ($lAdmin->EditAction() && !$bReadOnly) {
foreach ($_POST['FIELDS'] as $ID => $arFields) {
$ID = (int) $ID;
if ($ID <= 0 || !$lAdmin->IsUpdated($ID)) {
continue;
}
$DB->StartTransaction();
if (!CCatalogMeasure::update($ID, $arFields)) {
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddUpdateError($ex->GetString(), $ID);
} else {
$lAdmin->AddUpdateError(GetMessage("ERROR_UPDATING_REC") . " (" . $arFields["ID"] . ", " . $arFields["TITLE"] . ", " . $arFields["SORT"] . ")", $ID);
}
$DB->Rollback();
} else {
$DB->Commit();
}
}
}
if (($arID = $lAdmin->GroupAction()) && !$bReadOnly) {
if ($_REQUEST['action_target'] == 'selected') {
$arID = array();
$dbResultList = CCatalogMeasure::getList(array($_REQUEST["by"] => $_REQUEST["order"]), $arFilter, false, false, array('ID'));
示例2: unset
unset($fields);
if (check_bitrix_sessid()) {
if ($_SERVER['REQUEST_METHOD'] === 'POST' && (isset($_POST['save']) || isset($_POST['saveAndView']) || isset($_POST['apply']))) {
$errors = array();
$code = isset($_REQUEST['CODE']) ? intval($_REQUEST['CODE']) : 0;
if ($code <= 0) {
$errors[] = GetMessage('CRM_MEASURE_ERR_CODE_EMPTY');
}
$title = isset($_REQUEST['MEASURE_TITLE']) ? trim($_REQUEST['MEASURE_TITLE']) : '';
if ($title == '') {
$errors[] = GetMessage('CRM_MEASURE_ERR_TITLE_EMPTY');
}
if (empty($errors)) {
$fields = array('CODE' => $code, 'MEASURE_TITLE' => $title, 'SYMBOL_RUS' => isset($_REQUEST['SYMBOL_RUS']) ? $_REQUEST['SYMBOL_RUS'] : '', 'SYMBOL_INTL' => isset($_REQUEST['SYMBOL_INTL']) ? $_REQUEST['SYMBOL_INTL'] : '', 'SYMBOL_LETTER_INTL' => isset($_REQUEST['SYMBOL_LETTER_INTL']) ? $_REQUEST['SYMBOL_LETTER_INTL'] : '', 'IS_DEFAULT' => isset($_REQUEST['IS_DEFAULT']) && $_REQUEST['IS_DEFAULT'] == 'Y' ? 'Y' : 'N');
if ($elementID > 0) {
if (CCatalogMeasure::update($elementID, $fields) === false) {
$exception = $APPLICATION->GetException();
if ($exception) {
$errors[] = $exception->GetString();
} else {
$errors[] = GetMessage('CRM_MEASURE_ERR_UPDATE');
}
}
} else {
$result = CCatalogMeasure::add($fields);
if (is_int($result)) {
$elementID = $arParams['ELEMENT_ID'] = $result;
} else {
$exception = $APPLICATION->GetException();
if ($exception) {
$errors[] = $exception->GetString();
示例3: GetMessage
?>
');
}
</script>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_REQUEST["Update"]) > 0 && !$bReadOnly && check_bitrix_sessid()) {
$IS_DEFAULT = $_REQUEST["IS_DEFAULT"] == 'Y' ? 'Y' : 'N';
if (intval($_REQUEST["CODE"]) <= 0) {
$errorMessage .= GetMessage("CAT_MEASURE_CODE_EMPTY") . "\n";
}
if (trim($_REQUEST["MEASURE_TITLE"]) == '') {
$errorMessage .= GetMessage("CAT_MEASURE_TITLE_EMPTY") . "\n";
}
$arFields = array("CODE" => $_REQUEST["CODE"], "MEASURE_TITLE" => $_REQUEST["MEASURE_TITLE"], "SYMBOL_RUS" => $_REQUEST["SYMBOL_RUS"], "SYMBOL_INTL" => $_REQUEST["SYMBOL_INTL"], "SYMBOL_LETTER_INTL" => $_REQUEST["SYMBOL_LETTER_INTL"], "IS_DEFAULT" => $IS_DEFAULT);
$DB->StartTransaction();
if (strlen($errorMessage) == 0 && $ID > 0 && ($res = CCatalogMeasure::update($ID, $arFields))) {
$ID = $res;
$DB->Commit();
if (strlen($_REQUEST["apply"]) <= 0) {
LocalRedirect("/bitrix/admin/cat_measure_list.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
} else {
LocalRedirect("/bitrix/admin/cat_measure_edit.php?lang=" . LANG . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
}
} elseif (strlen($errorMessage) == 0 && $ID == 0 && ($res = CCatalogMeasure::add($arFields))) {
$ID = $res;
$DB->Commit();
if (strlen($_REQUEST["apply"]) <= 0) {
LocalRedirect("/bitrix/admin/cat_measure_list.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
} else {
LocalRedirect("/bitrix/admin/cat_measure_edit.php?lang=" . LANG . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
}
示例4: while
while ($measure = $dbResult->Fetch()) {
CCatalogMeasure::delete($measure['ID']);
}
}
} elseif ($actionData['NAME'] === 'edit') {
if (isset($actionData['FIELDS']) && is_array($actionData['FIELDS'])) {
foreach ($actionData['FIELDS'] as $ID => $arSrcData) {
$arUpdateData = array();
reset($arResult['HEADERS']);
foreach ($arResult['HEADERS'] as $arHead) {
if (isset($arHead['editable']) && $arHead['editable'] == true && isset($arSrcData[$arHead['id']])) {
$arUpdateData[$arHead['id']] = $arSrcData[$arHead['id']];
}
}
if (!empty($arUpdateData)) {
CCatalogMeasure::update($ID, $arUpdateData);
}
}
}
}
if (!$actionData['AJAX_CALL']) {
LocalRedirect($arParams['PATH_TO_MEASURE_LIST']);
}
} else {
if ($actionData['NAME'] === 'delete' && isset($actionData['ID'])) {
CCatalogMeasure::delete($actionData['ID']);
}
if (!$actionData['AJAX_CALL']) {
LocalRedirect($arParams['PATH_TO_MEASURE_LIST']);
}
}