foreach ($ids as $i) { $tour = new Tour(); $tour->retrieve($i); if ($synced[$i] = $tour->sync()) { $tour->synced = true; $tour->save(); } } $response = json_encode($synced); } else { return false; } } } else { if ($action == "get_tour_num") { $response = Tour::get_tour_num(); } else { if ($action == "get_destination_by_area") { if (isset($_POST['area'])) { $area_id = $_POST['area']; $department = $_POST['department']; $country_id = $_POST['country_id']; $destinations = Destination::getDestinationsByArea($country_id, $area_id, $department); $response = get_select_options_with_id($destinations, ''); } } else { if ($action == "get_cities_by_areas") { if (isset($_POST['areas'])) { $areas = $_POST['areas']; $areas = explode("|", $areas); $countries = explode(",", $_POST['country']);
} else { if (preg_match('/^(' . $frame_types_pattern . ')(' . $area_pattern . ')(\\d+)(\\/)(\\w+)$/', $focus->tour_code, $matches)) { $tour_frame_type = $matches[1]; $tour_code_area = $matches[2]; $tour_code_num = $matches[3]; $tour_code_department = $matches[5]; } else { $tour_num = Tour::get_tour_num(); } } } if (empty($focus->id)) { $tour_code_area = ""; $tour_code_num = ""; $tour_code_department = ""; $tour_num = Tour::get_tour_num(); } $ss->assign("TOUR_CODE_AREA", $tour_frame_type . $tour_code_area); $ss->assign("TOUR_CODE_DEPARTMENT", $tour_code_department); $ss->assign("TOUR_CODE_NUM", $tour_code_num); $ss->assign("TOUR_NUM", $tour_num); $ss->assign("country_id", $focus->country_id); //$ss->assign("TOURCODE", $focus->tour_code); $ss->assign("TOUR_NAME", $focus->tour_name); //$ss->assign("TO_PLACE", $focus->to_place); //$ss->assign("FROM_PLACE", $focus->from_place); $ss->assign("DESTINATION_TO_ID", $focus->destination_to_id); $ss->assign("DESTINATION_FROM_ID", $focus->destination_from_id); $ss->assign("START_DATE", $focus->start_date); $ss->assign("END_DATE", $focus->end_date); $ss->assign("VALUECONTRACT", $focus->contract_value);