當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CCatalogMeasure::add方法代碼示例

本文整理匯總了PHP中CCatalogMeasure::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCatalogMeasure::add方法的具體用法?PHP CCatalogMeasure::add怎麽用?PHP CCatalogMeasure::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CCatalogMeasure的用法示例。


在下文中一共展示了CCatalogMeasure::add方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GetMessage

        $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));
        }
    } else {
        if ($ex = $APPLICATION->GetException()) {
            $errorMessage .= $ex->GetString() . "<br>";
        }
        $bVarsFromForm = true;
        $DB->Rollback();
    }
}
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:31,代碼來源:cat_measure_edit.php

示例2: GetMessage

 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();
             } else {
                 $errors[] = GetMessage('CRM_MEASURE_ERR_CREATE');
             }
         }
     }
     $fields['ID'] = $elementID;
     $arResult['ELEMENT'] = $fields;
 }
 if (!empty($errors)) {
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:31,代碼來源:component.php


注:本文中的CCatalogMeasure::add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。