本文整理汇总了PHP中CLangAdmin::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CLangAdmin::GetList方法的具体用法?PHP CLangAdmin::GetList怎么用?PHP CLangAdmin::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLangAdmin
的用法示例。
在下文中一共展示了CLangAdmin::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFields
function CheckFields($ACTION, &$arFields)
{
if ((is_set($arFields, "SMILE_TYPE") || $ACTION == "ADD") && $arFields["SMILE_TYPE"] != "I" && $arFields["SMILE_TYPE"] != "S") {
return False;
}
if ((is_set($arFields, "IMAGE") || $ACTION == "ADD") && strlen($arFields["IMAGE"]) <= 0) {
return False;
}
if ((is_set($arFields, "SORT") || $ACTION == "ADD") && IntVal($arFields["SORT"]) <= 0) {
$arFields["SORT"] = 150;
}
if (is_set($arFields, "LANG") || $ACTION == "ADD") {
for ($i = 0; $i < count($arFields["LANG"]); $i++) {
if (!is_set($arFields["LANG"][$i], "LID") || strlen($arFields["LANG"][$i]["LID"]) <= 0) {
return false;
}
if (!is_set($arFields["LANG"][$i], "NAME") || strlen($arFields["LANG"][$i]["NAME"]) <= 0) {
return false;
}
}
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc", array("ACTIVE" => "Y"));
while ($arLang = $db_lang->Fetch()) {
$bFound = False;
for ($i = 0; $i < count($arFields["LANG"]); $i++) {
if ($arFields["LANG"][$i]["LID"] == $arLang["LID"]) {
$bFound = True;
}
}
if (!$bFound) {
return false;
}
}
}
return True;
}
示例2: setLangIds
protected function setLangIds()
{
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc", array("ACTIVE" => "Y"));
while ($lang = $db_lang->Fetch()) {
$this->lang_ids[] = $lang["LID"];
}
}
示例3: CheckFields
function CheckFields($ACTION, &$arFields)
{
global $DB;
if (is_set($arFields, "SORT") && IntVal($arFields["SORT"]) <= 0) {
$arFields["SORT"] = 100;
}
if (is_set($arFields, "LOCATION_ID") && (!is_array($arFields["LOCATION_ID"]) || count($arFields["LOCATION_ID"]) <= 0)) {
return false;
}
if (is_set($arFields, "LANG")) {
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc", array("ACTIVE" => "Y"));
while ($arLang = $db_lang->Fetch()) {
$bFound = False;
$coountarFieldLang = count($arFields["LANG"]);
for ($i = 0; $i < $coountarFieldLang; $i++) {
if ($arFields["LANG"][$i]["LID"] == $arLang["LID"] && strlen($arFields["LANG"][$i]["NAME"]) > 0) {
$bFound = True;
}
}
if (!$bFound) {
return false;
}
}
}
return True;
}
示例4: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
$aMsg = array();
if (is_set($arFields, "LANG") || $ACTION == "ADD") {
if (!is_array($arFields["LANG"])) {
$arFields["LANG"] = array();
}
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc");
while ($arLang = $db_lang->Fetch()) {
$bFound = False;
foreach ($arFields["LANG"] as $key => $res) {
if (is_array($res) && $res["LID"] == $arLang["LID"]) {
$arFields["LANG"][$key]["NAME"] = trim($res["NAME"]);
if (strLen($arFields["LANG"][$key]["NAME"]) > 0) {
$bFound = True;
break;
}
}
}
if (!$bFound) {
$aMsg[] = array("id" => 'POINTS[NAME][LID][' . $arLang["LID"] . ']', "text" => str_replace("#LANG#", $arLang["NAME"] . " [" . $arLang["LID"] . "]", GetMessage("FORUM_PE_ERROR_NONAME")));
}
}
}
if (is_set($arFields, "MIN_POINTS") || $ACTION == "ADD") {
$arFields["MIN_POINTS"] = trim($arFields["MIN_POINTS"]);
if (strLen($arFields["MIN_POINTS"]) <= 0) {
$aMsg[] = array("id" => 'POINTS[MIN_POINTS]', "text" => GetMessage("FORUM_PE_ERROR_MIN_POINTS_EMPTY"));
} elseif (preg_match("/[^0-9]/", $arFields["MIN_POINTS"])) {
$aMsg[] = array("id" => 'POINTS[MIN_POINTS]', "text" => GetMessage("FORUM_PE_ERROR_MIN_POINTS_BAD"));
} else {
$arFields["MIN_POINTS"] = intVal($arFields["MIN_POINTS"]);
$db_res = CForumPoints::GetList(array(), array("MIN_POINTS" => $arFields["MIN_POINTS"]));
if ($db_res && ($res = $db_res->GetNext())) {
if ($ACTION == "ADD" || $ID == 0 || $ID != $res["ID"]) {
$aMsg[] = array("id" => 'POINTS[MIN_POINTS]', "text" => GetMessage("FORUM_PE_ERROR_MIN_POINTS_EXIST"));
}
}
}
}
$arFields["VOTES"] = intval($arFields["VOTES"]);
if (!empty($aMsg)) {
$e = new CAdminException(array_reverse($aMsg));
$GLOBALS["APPLICATION"]->ThrowException($e);
return false;
}
return true;
}
示例5: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = "")
{
global $DB, $APPLICATION;
if ((is_set($arFields, "SORT") || $ACTION == "ADD") && IntVal($arFields["SORT"]) <= 0) {
$arFields["SORT"] = 100;
}
if ((is_set($arFields, "ID") || $ACTION == "ADD") && strlen($arFields["ID"]) <= 0) {
return false;
}
if (is_set($arFields, "ID") && strlen($ID) > 0 && $ID != $arFields["ID"]) {
return false;
}
if (is_set($arFields, "ID") && !preg_match("#[A-Za-z]#i", $arFields["ID"]) || strlen($ID) > 0 && !preg_match("#[A-Za-z]#i", $ID)) {
$APPLICATION->ThrowException(GetMessage("SKGS_ID_NOT_SYMBOL"), "ID");
return false;
}
if ($ACTION == "ADD") {
$arFields["ID"] = $DB->ForSql($arFields["ID"], 1);
$db_res = $DB->Query("SELECT ID FROM b_sale_status WHERE ID = '" . $arFields["ID"] . "'");
if ($db_res->Fetch()) {
$APPLICATION->ThrowException(GetMessage("SKGS_SALE_STATUS_ALREADY_EXISTS"), "ID");
return false;
}
}
if (is_set($arFields, "LANG")) {
$b = 'sort';
$o = 'asc';
$db_lang = CLangAdmin::GetList($b, $o, array("ACTIVE" => "Y"));
while ($arLang = $db_lang->Fetch()) {
$bFound = false;
foreach ($arFields["LANG"] as &$arOneLang) {
if ($arOneLang["LID"] == $arLang["LID"] && '' != $arOneLang["NAME"]) {
$bFound = true;
break;
}
}
if (isset($arOneLang)) {
unset($arOneLang);
}
if (!$bFound) {
return false;
}
}
}
return true;
}
示例6: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = "")
{
global $DB;
if ((is_set($arFields, "SORT") || $ACTION=="ADD") && IntVal($arFields["SORT"])<= 0) $arFields["SORT"] = 100;
if ((is_set($arFields, "ID") || $ACTION=="ADD") && strlen($arFields["ID"])<=0) return false;
if (is_set($arFields, "ID") && strlen($ID)>0 && $ID!=$arFields["ID"]) return false;
if((is_set($arFields, "ID") && !preg_match("#[A-Za-z]#i", $arFields["ID"])) || (strlen($ID)>0 && !preg_match("#[A-Za-z]#i", $ID)))
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGS_ID_NOT_SYMBOL"), "ERROR_ID_NOT_SYMBOL");
return false;
}
if ($ACTION=="ADD")
{
$arFields["ID"] = $DB->ForSql($arFields["ID"], 1);
$db_res = $DB->Query("SELECT ID FROM b_sale_status WHERE ID = '".$arFields["ID"]."' ");
if ($db_res->Fetch()) return false;
}
if (is_set($arFields, "LANG"))
{
$db_lang = CLangAdmin::GetList(($b="sort"), ($o="asc"), array("ACTIVE" => "Y"));
while ($arLang = $db_lang->Fetch())
{
$bFound = false;
foreach ($arFields["LANG"] as &$arOneLang)
{
if ($arOneLang["LID"] == $arLang["LID"] && '' != $arOneLang["NAME"])
{
$bFound = true;
break;
}
}
if (isset($arOneLang))
unset($arOneLang);
if (!$bFound) return false;
}
}
return true;
}
示例7: CheckFields
function CheckFields($ACTION, &$arFields, $ID = "")
{
global $DB;
if ((is_set($arFields, "SORT") || $ACTION == "ADD") && IntVal($arFields["SORT"]) <= "Y") {
$arFields["SORT"] = 100;
}
if ((is_set($arFields, "ID") || $ACTION == "ADD") && strlen($arFields["ID"]) <= 0) {
return false;
}
if (is_set($arFields, "ID") && strlen($ID) > 0 && $ID != $arFields["ID"]) {
return false;
}
if (is_set($arFields, "ID") && !preg_match("#[A-Za-z]#i", $arFields["ID"]) || strlen($ID) > 0 && !preg_match("#[A-Za-z]#i", $ID)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGS_ID_NOT_SYMBOL"), "ERROR_ID_NOT_SYMBOL");
return false;
}
if ($ACTION == "ADD") {
$arFields["ID"] = $DB->ForSql($arFields["ID"], 1);
$db_res = $DB->Query("SELECT ID FROM b_sale_status WHERE ID = '" . $arFields["ID"] . "' ");
if ($db_res->Fetch()) {
return false;
}
}
if (is_set($arFields, "LANG")) {
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc", array("ACTIVE" => "Y"));
while ($arLang = $db_lang->Fetch()) {
$bFound = False;
for ($i = 0; $i < count($arFields["LANG"]); $i++) {
if ($arFields["LANG"][$i]["LID"] == $arLang["LID"] && strlen($arFields["LANG"][$i]["NAME"]) > 0) {
$bFound = True;
}
}
if (!$bFound) {
return false;
}
}
}
return True;
}
示例8: UpdateCity
/**
* <p>Метод изменяет параметры города с кодом ID на значения из массива arFields. Метод динамичный.</p>
*
*
* @param int $ID Код города.
*
* @param array $arFields Массив с параметрами города должен содержать ключи: <ul> <li> <b>NAME</b> -
* название города (не зависящее от языка);</li> <li> <b>SHORT_NAME</b> -
* сокращенное название города - абревиатура (не зависящее от
* языка);</li> <li> <b><код языка></b> - ключем является код языка, а
* значением ассоциативный массив вида <pre class="syntax"> array("LID" => "код
* языка", "NAME" => "название города на этом языке", "SHORT_NAME" =>
* "сокращенное название города (аббревиатура) на этом языке")</pre> Эта
* пара ключ-значение должна присутствовать для каждого языка
* системы.</li> </ul>
*
* @return int <p>Возвращается код измененного города или <i>false</i> у случае
* ошибки.</p> <br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalelocation/csalelocation__updatecity.3fe4165d.php
* @author Bitrix
*/
public static function UpdateCity($ID, $arFields)
{
global $DB;
$ID = intval($ID);
if ($ID <= 0 || !CSaleLocation::CityCheckFields("UPDATE", $arFields)) {
return false;
}
foreach (GetModuleEvents("sale", "OnBeforeCityUpdate", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
return false;
}
}
if (self::isLocationProMigrated()) {
try {
$locId = self::getLocationIdByCityId($ID);
if (!$locId) {
return false;
}
$res = Location\LocationTable::update($locId, self::refineFieldsForSaveCRC($item['ID'], $arFields), array('REBALANCE' => false));
if ($res->isSuccess()) {
return $ID;
}
return false;
} catch (Exception $e) {
return false;
}
} else {
$strUpdate = $DB->PrepareUpdate("b_sale_location_city", $arFields);
$strSql = "UPDATE b_sale_location_city SET " . $strUpdate . " WHERE ID = " . $ID . "";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc", array("ACTIVE" => "Y"));
while ($arLang = $db_lang->Fetch()) {
if ($arCntLang = CSaleLocation::GetCityLangByID($ID, $arLang["LID"])) {
$strUpdate = $DB->PrepareUpdate("b_sale_location_city_lang", $arFields[$arLang["LID"]]);
$strSql = "UPDATE b_sale_location_city_lang SET " . $strUpdate . " WHERE ID = " . $arCntLang["ID"] . "";
} else {
$arInsert = $DB->PrepareInsert("b_sale_location_city_lang", $arFields[$arLang["LID"]]);
$strSql = "INSERT INTO b_sale_location_city_lang(CITY_ID, " . $arInsert[0] . ") " . "VALUES(" . $ID . ", " . $arInsert[1] . ")";
}
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
}
foreach (GetModuleEvents("sale", "OnCityUpdate", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
return $ID;
}
示例9: array
/** @var Bitrix\Sale\Order $saleOrder */
Admin\OrderEdit::initCouponsData($saleOrder->getUserId(), $ID);
CUtil::InitJSCore();
$APPLICATION->SetTitle(Loc::getMessage("SALE_OVIEW_TITLE", array("#ID#" => $saleOrder->getId(), "#NUM#" => strlen($saleOrder->getField('ACCOUNT_NUMBER')) > 0 ? $saleOrder->getField('ACCOUNT_NUMBER') : $saleOrder->getId(), "#DATE#" => $saleOrder->getDateInsert()->toString())));
\Bitrix\Main\Page\Asset::getInstance()->addJs("/bitrix/js/sale/admin/order_edit.js");
ob_start();
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/admin/order_history.php";
$historyContent = ob_get_contents();
ob_end_clean();
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
/* context menu */
$aMenu = array();
$aMenu[] = array("ICON" => "btn_list", "TEXT" => Loc::getMessage("SALE_OVIEW_TO_LIST"), "TITLE" => Loc::getMessage("SALE_OVIEW_TO_LIST_TITLE"), "LINK" => "/bitrix/admin/sale_order.php?lang=" . LANGUAGE_ID . GetFilterParams("filter_"));
$aMenu[] = array("TEXT" => Loc::getMessage("SALE_OVIEW_TO_EDIT"), "TITLE" => Loc::getMessage("SALE_OVIEW_TO_EDIT_TITLE"), "LINK" => "/bitrix/admin/sale_order_edit.php?ID=" . $ID . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_"));
$arSysLangs = array();
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc", array("ACTIVE" => "Y"));
while ($arLang = $db_lang->Fetch()) {
$arSysLangs[] = $arLang["LID"];
}
$arReports = array();
$dirs = array($_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin/reports/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/reports/");
foreach ($dirs as $dir) {
if (file_exists($dir)) {
if ($handle = opendir($dir)) {
while (($file = readdir($handle)) !== false) {
$file_contents = '';
if ($file == "." || $file == ".." || $file == ".access.php") {
continue;
}
if (is_file($dir . $file) && ToUpper(substr($file, -4)) == ".PHP") {
$rep_title = $file;
示例10: ClearVars
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
$forumPermissions = $APPLICATION->GetGroupRight("forum");
if ($forumPermissions == "D") {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/forum/include.php";
ClearVars();
IncludeModuleLangFile(__FILE__);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/forum/prolog.php";
$ID = IntVal($ID);
$langCount = 0;
$arSysLangs = $arSysLangNames = array();
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc");
$arError = array();
$message = false;
$bInitVars = false;
while ($arLang = $db_lang->Fetch()) {
$arSysLangs[$langCount] = $arLang["LID"];
$arSysLangNames[$langCount] = htmlspecialcharsbx($arLang["NAME"]);
$langCount++;
}
$arGroups = CForumGroup::GetByLang(LANGUAGE_ID);
array_unshift($arGroups, array("ID" => 0, "NAME" => "..."));
if ((strlen($save) > 0 || strlen($apply) > 0) && $REQUEST_METHOD == "POST" && $forumPermissions == "W" && check_bitrix_sessid()) {
$arFields = array("SORT" => intVal(intVal($SORT) <= 0 ? 150 : $SORT), "PARENT_ID" => $_REQUEST["FORUM_GROUP"]["PARENT_ID"]);
for ($i = 0; $i < count($arSysLangs); $i++) {
$arFields["LANG"][] = array("LID" => $arSysLangs[$i], "NAME" => $_REQUEST["FORUM_GROUP"]["LANG"][$arSysLangs[$i]]["NAME"], "DESCRIPTION" => $_REQUEST["FORUM_GROUP"]["LANG"][$arSysLangs[$i]]["DESCRIPTION"]);
}
if (!CForumGroup::CheckFields($ID > 0 ? "UPDATE" : "ADD", $arFields, $ID > 0 ? $ID : false)) {
示例11: UpdateRegion
/**
* The function modifies the parameters of the region
*
* @param int $ID region code
* @param array $arFields array with parameters region
* @return int $ID code region
*/
public static function UpdateRegion($ID, $arFields)
{
global $DB;
$ID = intval($ID);
if ($ID <= 0 || !CSaleLocation::RegionCheckFields("UPDATE", $arFields)) {
return false;
}
foreach (GetModuleEvents("sale", "OnBeforeRegionUpdate", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
return false;
}
}
$strUpdate = $DB->PrepareUpdate("b_sale_location_region", $arFields);
$strSql = "UPDATE b_sale_location_region SET " . $strUpdate . " WHERE ID = " . $ID . "";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc", array("ACTIVE" => "Y"));
while ($arLang = $db_lang->Fetch()) {
if ($arCntLang = CSaleLocation::GetRegionLangByID($ID, $arLang["LID"])) {
$strUpdate = $DB->PrepareUpdate("b_sale_location_region_lang", $arFields[$arLang["LID"]]);
//print_r($arFields);die();
$strSql = "UPDATE b_sale_location_region_lang SET " . $strUpdate . " WHERE ID = " . $arCntLang["ID"] . "";
} else {
$arInsert = $DB->PrepareInsert("b_sale_location_region_lang", $arFields[$arLang["LID"]]);
$strSql = "INSERT INTO b_sale_location_region_lang(REGION_ID, " . $arInsert[0] . ") " . "VALUES(" . $ID . ", " . $arInsert[1] . ")";
}
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
foreach (GetModuleEvents("sale", "OnRegionUpdate", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
return $ID;
}
示例12: array
}
return;
}
$currencyID = $currency['CURRENCY'];
$isEditMode = true;
}
$isBaseCurrency = $currencyID !== '' && $currencyID === $baseCurrencyID;
$currency['IS_ACCOUNTING_CURRENCY'] = $currencyID !== '' && $currencyID === CCrmCurrency::GetAccountCurrencyID();
$currency['IS_INVOICE_CURRENCY'] = $currencyID !== '' && $currencyID === CCrmCurrency::getInvoiceDefault();
$arResult['CURRENCY_ID'] = $currencyID;
$arResult['CURRENCY'] = $currency;
$arResult['FORM_ID'] = 'CRM_CURRENCY_EDIT';
$arResult['GRID_ID'] = 'CRM_CURRENCY_EDIT';
$arResult['BACK_URL'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CURRENCY_LIST'], array());
$langs = array();
$rsLang = CLangAdmin::GetList($by = 'sort', $order = 'asc');
while ($arLang = $rsLang->Fetch()) {
$lid = $arLang['LID'];
$langs[$lid] = array('NAME' => $arLang['NAME']);
}
$arResult['LANGS'] = $langs;
$currencyLocs = array();
if ($currencyID !== '') {
$rs = CCurrencyLang::GetList($by = '', $order = '', $currencyID);
while ($ary = $rs->GetNext()) {
$loc = array();
$loc['FULL_NAME'] = $ary['FULL_NAME'];
$loc['FORMAT_STRING'] = $ary['FORMAT_STRING'];
$loc['DEC_POINT'] = $ary['DEC_POINT'];
$loc['THOUSANDS_SEP'] = $ary['THOUSANDS_SEP'];
$loc['THOUSANDS_VARIANT'] = $ary['THOUSANDS_VARIANT'];
示例13: array
$arSelectFields = $lAdmin->GetVisibleHeaderColumns();
$arSelectFieldsMap = array();
foreach ($arSelectFields as &$strOneFieldName) {
$arSelectFieldsMap[$strOneFieldName] = true;
}
if (isset($strOneFieldName)) {
unset($strOneFieldName);
}
$mxKey = array_search('NAME_LID', $arSelectFields);
if (false !== $mxKey) {
unset($arSelectFields[$mxKey]);
}
$arLangList = array();
$arLangDefList = array();
if (array_key_exists('NAME_LID', $arSelectFieldsMap)) {
$rsPriceLangs = CLangAdmin::GetList($by1 = "sort", $order1 = "asc");
while ($arPriceLang = $rsPriceLangs->Fetch()) {
$arLangList[$arPriceLang['LID']] = true;
$arLangDefList[$arPriceLang['LID']] = str_replace('#LANG#', htmlspecialcharsex($arPriceLang['NAME']), GetMessage('BT_CAT_GROUP_ADM_LANG_MESS'));
}
}
if (array_key_exists("mode", $_REQUEST) && $_REQUEST["mode"] == "excel") {
$arNavParams = false;
} else {
$arNavParams = array("nPageSize" => CAdminResult::GetNavSize($sTableID));
}
$dbResultList = CCatalogGroup::GetList(array($by => $order), array(), false, $arNavParams, $arSelectFields);
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("group_admin_nav")));
$arRows = array();
示例14: GetLanguagesID
private static function GetLanguagesID()
{
if (self::$LANGS_ID) {
return self::$LANGS_ID;
}
self::$LANGS_ID = array();
$by = 'sort';
$order = 'asc';
$dbResult = CLangAdmin::GetList($by, $order);
while ($arResult = $dbResult->Fetch()) {
self::$LANGS_ID[] = $arResult['LID'];
}
return self::$LANGS_ID;
}
示例15: saleLocationImport
function saleLocationImport($arParams)
{
global $DB;
$arReturn = array('STEP' => false, 'ERROR' => '', 'AMOUNT' => 0, 'POS' => 0, 'MESSAGE' => '');
$step_length = intval($arParams["STEP_LENGTH"]);
if ($step_length <= 0) {
$step_length = 10;
}
define('ZIP_STEP_LENGTH', $step_length);
define('LOC_STEP_LENGTH', $step_length);
define('DLZIPFILE', $arParams["DLZIPFILE"]);
$STEP = intval($arParams['STEP']);
$CSVFILE = $arParams["CSVFILE"];
$LOADZIP = $arParams["LOADZIP"];
$bSync = $arParams["SYNC"] == "Y";
if (isset($arParams['TMP_PATH'])) {
$sTmpFilePath = $arParams['TMP_PATH'];
} else {
$sTmpFilePath = CTempFile::GetDirectoryName(12, 'sale');
}
if (strlen($CSVFILE) > 0 && !in_array($CSVFILE, array('loc_ussr.csv', 'loc_ua.csv', 'loc_kz.csv', 'loc_usa.csv', 'loc_cntr.csv', 'locations.csv'))) {
//echo GetMessage('SL_IMPORT_ERROR_FILES');
$arReturn['ERROR'] = GetMessage('SL_IMPORT_ERROR_FILES');
} else {
if ($STEP == 1 && strlen($CSVFILE) <= 0) {
if ($LOADZIP == 'Y') {
$STEP = 2;
} else {
$STEP = 3;
}
}
switch ($STEP) {
case 0:
$arReturn['MESSAGE'] = GetMessage('WSL_IMPORT_FILES_LOADING');
$arReturn['STEP'] = 1;
break;
case 1:
$time_limit = ini_get('max_execution_time');
if ($time_limit < LOC_STEP_LENGTH) {
set_time_limit(LOC_STEP_LENGTH + 5);
}
$start_time = time();
$finish_time = $start_time + LOC_STEP_LENGTH;
$file_url = $sTmpFilePath . $CSVFILE;
if (!file_exists($file_url)) {
$arReturn['ERROR'] = GetMessage('SL_IMPORT_ERROR_NO_LOC_FILE');
break;
}
$bFinish = true;
$arSysLangs = array();
$db_lang = CLangAdmin::GetList($b = "sort", $o = "asc", array("ACTIVE" => "Y"));
while ($arLang = $db_lang->Fetch()) {
$arSysLangs[$arLang["LID"]] = $arLang["LID"];
}
$arLocations = array();
if (!$bSync) {
if (!is_set($_SESSION["LOC_POS"])) {
CSaleLocation::DeleteAll();
}
} else {
$dbLocations = CSaleLocation::GetList(array(), array(), false, false, array("ID", "COUNTRY_ID", "REGION_ID", "CITY_ID"));
while ($arLoc = $dbLocations->Fetch()) {
$arLocations[$arLoc["ID"]] = $arLoc;
}
}
if (count($arLocations) <= 0) {
$bSync = false;
}
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/csv_data.php";
$csvFile = new CCSVData();
$csvFile->LoadFile($file_url);
$csvFile->SetFieldsType("R");
$csvFile->SetFirstHeader(false);
$csvFile->SetDelimiter(",");
$arRes = $csvFile->Fetch();
if (!is_array($arRes) || count($arRes) <= 0 || strlen($arRes[0]) != 2) {
$strWarning .= GetMessage('SL_IMPORT_ERROR_WRONG_LOC_FILE') . "<br />";
}
if (strlen($strWarning) <= 0) {
$DefLang = $arRes[0];
if (!in_array($DefLang, $arSysLangs)) {
$strWarning .= GetMessage('SL_IMPORT_ERROR_NO_LANG') . "<br />";
}
}
if (strlen($strWarning) > 0) {
$arReturn['ERROR'] = $strWarning . "<br />";
break;
}
if (is_set($_SESSION["LOC_POS"])) {
$csvFile->SetPos($_SESSION["LOC_POS"]);
$CurCountryID = $_SESSION["CUR_COUNTRY_ID"];
$CurRegionID = $_SESSION["CUR_REGION_ID"];
$numCountries = $_SESSION["NUM_COUNTRIES"];
$numRegiones = $_SESSION["NUM_REGIONES"];
$numCities = $_SESSION["NUM_CITIES"];
$numLocations = $_SESSION["NUM_LOCATIONS"];
} else {
$CurCountryID = 0;
$CurRegionID = 0;
$numCountries = 0;
//.........这里部分代码省略.........