当前位置: 首页>>代码示例>>PHP>>正文


PHP CSaleLocation::DeleteAll方法代码示例

本文整理汇总了PHP中CSaleLocation::DeleteAll方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleLocation::DeleteAll方法的具体用法?PHP CSaleLocation::DeleteAll怎么用?PHP CSaleLocation::DeleteAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSaleLocation的用法示例。


在下文中一共展示了CSaleLocation::DeleteAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:location_import.php


注:本文中的CSaleLocation::DeleteAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。