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


PHP CCurrencyLang::isExistCurrencyLanguage方法代碼示例

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


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

示例1: CheckFields


//.........這裏部分代碼省略.........
             $arMsg[] = array('id' => 'AMOUNT', 'text' => Loc::getMessage('BT_MOD_CURR_ERR_CURR_AMOUNT_ABSENT'));
         }
     }
     if ($ACTION == 'UPDATE') {
         $strCurrencyID = Currency\CurrencyManager::checkCurrencyID($strCurrencyID);
         if ($strCurrencyID === false) {
             $arMsg[] = array('id' => 'CURRENCY', 'text' => Loc::getMessage('BT_MOD_CURR_ERR_CURR_CUR_ID_BAD'));
         }
     }
     if (empty($arMsg)) {
         if (isset($arFields['AMOUNT_CNT'])) {
             $arFields['AMOUNT_CNT'] = (int) $arFields['AMOUNT_CNT'];
             if ($arFields['AMOUNT_CNT'] <= 0) {
                 $arMsg[] = array('id' => 'AMOUNT_CNT', 'text' => Loc::getMessage('BT_MOD_CURR_ERR_CURR_AMOUNT_CNT_BAD'));
             }
         }
         if (isset($arFields['AMOUNT'])) {
             $arFields['AMOUNT'] = (double) $arFields['AMOUNT'];
             if ($arFields['AMOUNT'] <= 0) {
                 $arMsg[] = array('id' => 'AMOUNT', 'text' => Loc::getMessage('BT_MOD_CURR_ERR_CURR_AMOUNT_BAD'));
             }
         }
         if (isset($arFields['SORT'])) {
             $arFields['SORT'] = (int) $arFields['SORT'];
             if ($arFields['SORT'] <= 0) {
                 $arFields['SORT'] = 100;
             }
         }
         if (isset($arFields['BASE'])) {
             $arFields['BASE'] = (string) $arFields['BASE'] === 'Y' ? 'Y' : 'N';
         }
         if (isset($arFields['NUMCODE'])) {
             $arFields['NUMCODE'] = (string) $arFields['NUMCODE'];
             if ($arFields['NUMCODE'] === '') {
                 unset($arFields['NUMCODE']);
             } elseif (!preg_match("~^[0-9]{3}\$~", $arFields['NUMCODE'])) {
                 $arMsg[] = array('id' => 'NUMCODE', 'text' => Loc::getMessage('BT_MOD_CURR_ERR_CURR_NUMCODE_IS_BAD'));
             }
         }
     }
     $boolUserExist = self::isUserExists();
     $intUserID = $boolUserExist ? (int) $USER->GetID() : 0;
     $strDateFunction = $DB->GetNowFunction();
     $arFields['~DATE_UPDATE'] = $strDateFunction;
     if ($boolUserExist) {
         if (!isset($arFields['MODIFIED_BY'])) {
             $arFields['MODIFIED_BY'] = $intUserID;
         }
         $arFields['MODIFIED_BY'] = (int) $arFields['MODIFIED_BY'];
         if ($arFields['MODIFIED_BY'] <= 0) {
             $arFields['MODIFIED_BY'] = $intUserID;
         }
     }
     if ($ACTION == 'ADD') {
         $arFields['~DATE_CREATE'] = $strDateFunction;
         if ($boolUserExist) {
             if (!isset($arFields['CREATED_BY'])) {
                 $arFields['CREATED_BY'] = $intUserID;
             }
             $arFields['CREATED_BY'] = (int) $arFields['CREATED_BY'];
             if ($arFields['CREATED_BY'] <= 0) {
                 $arFields['CREATED_BY'] = $intUserID;
             }
         }
     }
     if (isset($arFields['LANG'])) {
         if (empty($arFields['LANG']) || !is_array($arFields['LANG'])) {
             $arMsg[] = array('id' => 'LANG', 'text' => Loc::getMessage('BT_MOD_CURR_ERR_CURR_LANG_BAD'));
         } else {
             $langSettings = array();
             $currency = $ACTION == 'ADD' ? $arFields['CURRENCY'] : $strCurrencyID;
             foreach ($arFields['LANG'] as $lang => $settings) {
                 if (empty($settings) || !is_array($settings)) {
                     continue;
                 }
                 $langAction = 'ADD';
                 if ($ACTION == 'UPDATE') {
                     $langAction = CCurrencyLang::isExistCurrencyLanguage($currency, $lang) ? 'UPDATE' : 'ADD';
                 }
                 $checkLang = CCurrencyLang::checkFields($langAction, $settings, $currency, $lang, true);
                 $settings['CURRENCY'] = $currency;
                 $settings['LID'] = $lang;
                 $settings['IS_EXIST'] = $langAction == 'ADD' ? 'N' : 'Y';
                 $langSettings[$lang] = $settings;
                 if (is_array($checkLang)) {
                     $arMsg = array_merge($arMsg, $checkLang);
                 }
             }
             $arFields['LANG'] = $langSettings;
             unset($settings, $lang, $currency, $langSettings);
         }
     }
     if (!empty($arMsg)) {
         $obError = new CAdminException($arMsg);
         $APPLICATION->ResetException();
         $APPLICATION->ThrowException($obError);
         return false;
     }
     return true;
 }
開發者ID:akniyev,項目名稱:itprom_dobrohost,代碼行數:101,代碼來源:currency.php


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