if (global_common::isCLogin()) { //get user info //$c_userInfo = $_SESSION[consts::SES_C_USERINFO]; //if ($objMenu->getMenuByName($_pgR['name'])) { // echo global_common::convertToXML($arrHeader, array("rs",'info'), array(0,global_common::STRING_NAME_EXIST), array(0,1)); // return; //} $cityID = $_pgR['CityID']; $cityID = global_editor::rteSafe(html_entity_decode($cityID, ENT_COMPAT, 'UTF-8')); $cityName = $_pgR['CityName']; $cityName = global_editor::rteSafe(html_entity_decode($cityName, ENT_COMPAT, 'UTF-8')); $status = $_pgR['Status']; $status = global_editor::rteSafe(html_entity_decode($status, ENT_COMPAT, 'UTF-8')); //$strName = $_pgR['name']; //$strName = global_editor::rteSafe(html_entity_decode($strName,ENT_COMPAT ,'UTF-8' )); $resultID = $objCity->insert($cityID, $cityName, $status); if ($resultID) { $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, $result), array(0, 1)); return; } else { echo global_common::convertToXML($arrHeader, array("rs", "info"), array(0, "Input data is invalid"), array(0, 1)); return; } } else { echo global_common::convertToXML($arrHeader, array("rs", 'info'), array(0, global_common::STRING_REQUIRE_LOGIN), array(0, 1)); } return; } elseif ($_pgR['act'] == model_City::ACT_UPDATE) { if (global_common::isCLogin()) {
echo 'Start import stores with file :' . $file . ' Count:' . count($stores) . '<br>'; foreach ($stores as $store) { //print_r($store); //return; $storeRefID = '7009-' . $store['Id']; $storeName = $store['Name']; $checkExisted = $objStore->getStoreByRefID($storeRefID); //print_r($checkExisted); ; if (!$checkExisted) { $cityName = $store['City']; $city = $objCity->getCityByName($cityName); //print_r($city); if ($city) { $cityID = $city[global_mapping::CityID]; } else { $cityID = $objCity->insert($cityName); } $districtName = $store['District']; $district = $objDistrict->getDistrictByName($districtName); //print_r($district); if ($district) { $districtID = $district[global_mapping::DistrictID]; } else { $districtID = $objDistrict->insert($districtName, $cityID); } echo 'DistricID:' . $districtID . '<br>'; echo 'Adding...' . $storeName . '<br>'; $result = $objStore->insert($storeName, $store['Address'], $districtID, $cityID, '', '', $store['Latitude'], $store['Longitude'], '', $store['MainCategoryId'], $store['PicturePath'], $store['PicturePath'], '', $createdBy, global_common::nowSQL(), $updatedBy, global_common::nowSQL(), null, null, $storeRefID); if ($result) { $categoryID = 0; foreach ($allCats as $cat) {