if(!isset($tour_id) && empty($tour_id) && !is_int($tour_id)) { Object::raiseError("Invalid request parameters", __FILE__, __LINE__, E_USER_WARNING); $sid->assign("error", "strErrorInvalidRequestParameters"); Http::localRedirect("error"); } $tour_id = intval($tour_id); $tour = $db->selectObject( "select * from {$tblPref}Tours ". "where Tour_ID =".$tour_id." and Activated > 0", __CFG_MOST_FREQUENT_CACHE_LIFETIME ); if(false === $tour) { Object::raiseError("Invalid request parameters", __FILE__, __LINE__, E_USER_WARNING); $sid->assign("error", "strErrorInvalidRequestParameters"); Http::localRedirect("error"); } $cat_types = $db->selectObjects( "select * from {$tblPref}SubCategory ". "where Cat_ID =".$tour->Cat_ID." order by ToolbarPosition asc","SubCat_ID", __CFG_MOST_FREQUENT_CACHE_LIFETIME ); $tpl->assign("cat_types", $cat_types); $tour = $db->selectObject( "select t.*, group_concat(p.Filename separator '%%') as GalPictures, ". "group_concat(p.IsMain separator '%%') as IsMain, ". "group_concat(d.Day_ID order by d.DayNum asc separator '%%') as Day_ID ". "from {$tblPref}Tours t ". "left outer join {$tblPref}Album a ". "on (t.Gal_ID = a.Album_ID) ". "left outer join {$tblPref}AlbumPhoto p ". "on (a.Album_ID = p.Album_ID) ". "left outer join {$tblPref}ToursDays d ". "on (t.Tour_ID = d.Tour_ID) ". "where t.Tour_ID = ".$tour_id." ". "Group by t.Tour_ID", __CFG_MOST_FREQUENT_CACHE_LIFETIME ); $tours_days = $db->selectObjects( "select * ". "from {$tblPref}ToursDays ". "where Tour_ID = ".$tour_id." AND (DayType = 2 OR DayType = 0) order by DayNum asc" ); $tour->TDays = $tours_days; $tour->Availability = $db->selectRows( "select * ". "from {$tblPref}ToursDates ". "where Tour_ID = ".$tour_id , "Date_ID", __CFG_MOST_FREQUENT_CACHE_LIFETIME ); if (!empty($tour->Availability)) { $tour->start_tour_date = ""; foreach ($tour->Availability as $avail) { $now_date = date('Y-m-d'); if ($now_date <= $avail["Date"]) { $lang_availabilities = explode(' ', $avail["Availability"]); $available_languages = array(); foreach($lang_availabilities as $available){ $av = explode(":", $available); $available_languages[] = $av[0]; } foreach ($lang_availabilities as $lang_avail) { $lang_avail_id = explode(':', $lang_avail); if(!in_array(__CFG_DEFAULT_TOUR_LANG_ID, $available_languages)) $selected_lang = $available_languages[0]; else $selected_lang = __CFG_DEFAULT_TOUR_LANG_ID; if ($lang_avail_id[0] == $selected_lang) { $inactivity_period = __CFG_INACTIVITY_PERIOD; $fuse = subtract_dates($now_date, $avail["Date"]); if ((($lang_avail_id[1] == 1) || ($lang_avail_id[1] == 2)) && ($fuse > $inactivity_period)) { $tour->start_tour_date = $avail["Date"]; $explode_date = explode('-', $avail["Date"]); $tour->start_tour_year = $explode_date[0]; $tour->start_tour_month = $explode_date[1]; $tour->start_tour_day = $explode_date[2]; break; } } } } if ($tour->start_tour_date != "") { break; } } } $tour->Dates = $db->selectObjects( "select * ". "from {$tblPref}ToursDates ". "where Tour_ID = ".$tour_id." ". //"and Availability regexp '(^|[[:space:]])".__CFG_DEFAULT_TOUR_LANG_ID."' ". "and Availability != '' ". //"and (date_format(Date, '%Y%m') = date_format(now(), '%Y%m') or date_format(Date, '%Y%m') = date_format(date_add(now(), interval 1 month), '%Y%m')) " //"and (date_format(Date, '%Y%m') = date_format(now(), '%Y%m')) " "order by Date asc" , "Date_ID", __CFG_MOST_FREQUENT_CACHE_LIFETIME ); $dates = array(); $years = array(); if(!empty($tour->Dates) && sizeof($tour->Dates)){ $dates_filter = array(); $b = 0; foreach($tour->Dates as $date_id => $date_data) { if(date("Y"). date("m") <= substr($date_data->Date,0,4).substr($date_data->Date,5,2)){ $b++; if($b == 1){ $first_year = intval(substr($date_data->Date,0,4)); $first_month = intval(substr($date_data->Date,5,2)); } } if(!empty($first_year) && !empty($first_month) && intval(substr($date_data->Date,0,4)) == $first_year && intval(substr($date_data->Date,5,2)) == $first_month) { $tour->Dates_filtered[$date_id] = $date_data; } } if(!empty($tour->Dates_filtered)) $tour->Dates = $tour->Dates_filtered; foreach($tour->Dates as $date_id => $date_data) { $day = intval(substr($date_data->Date,8,2)); $year = intval(substr($date_data->Date,0,4)); $fuse = subtract_dates(date("Y-m-d"), $date_data->Date); $availability = explode(" ", $date_data->Availability); $available_languages = array(); foreach($availability as $available){ $av = explode(":", $available); $available_languages[] = $av[0]; } foreach($availability as $available){ $av = explode(":", $available); if(!in_array(__CFG_DEFAULT_TOUR_LANG_ID, $available_languages)) $def_lang = $av[0]; else $def_lang = __CFG_DEFAULT_TOUR_LANG_ID; list($language,$avail) = $av; if($language == $def_lang) { if($avail == 1 && $fuse > __CFG_INACTIVITY_PERIOD) $dates[$day]= array('javascript:void(null)', 'green'); else if($avail == 2 && $fuse > __CFG_INACTIVITY_PERIOD) $dates[$day]= array('javascript:void(null)', 'yellow'); else $dates[$day]= array('javascript:void(null)', 'red'); } } } $tour->Prices = $db->selectObjects( "select * ". "from {$tblPref}ToursPrices ". "where Tour_ID = ".$tour_id." ". "and '".substr(end($tour->Dates)->Date, 0, 4)."-".substr(end($tour->Dates)->Date, 5, 2)."-01' ". "between ValidFrom and ValidTill order by Price_ID", "Price_ID", __CFG_MOST_FREQUENT_CACHE_LIFETIME); } if(!empty($tour->Availability)){ $tour->Langs = array(); foreach($tour->Availability as $date_id => $d_data){ if(!empty($d_data['Availability'])){ $availability = explode(' ', $d_data['Availability']); foreach($availability as $available){ $language_ids = explode(':', $available); $tour->Langs[] = $language_ids[0]; } } } $tour->Languages = $db->selectRows("SELECT Lang_ID, LangCode FROM {$tblPref}Language where Lang_ID in (".implode(', ', $tour->Langs).") order by Lang_ID", "Lang_ID", __CFG_MOST_FREQUENT_CACHE_LIFETIME); } $tour->GalPictures = preg_split("`%%`", $tour->GalPictures, -1, PREG_SPLIT_NO_EMPTY); $tour->IsMain = preg_split("`%%`", $tour->IsMain, -1, PREG_SPLIT_NO_EMPTY); $tour->Day_ID = preg_split("`%%`", $tour->Day_ID, -1, PREG_SPLIT_NO_EMPTY); $tour->GalPictures = array_unique($tour->GalPictures); /*if(sizeof($tour->Day_ID) && $tour->SubCat_ID != '17' ) { $temp_prime = array(); $temp_double = array(); $i = 1; foreach($tour->Day_ID as $day_id){ if($i%2) $temp_prime[] = $day_id; else $temp_double[] = $day_id; $i++; } if(sizeof($temp_double)) foreach($temp_double as $day_id) $temp_prime[] = $day_id; $tour->Day_ID = $temp_prime; }*/ //Mantas request if($tour->Tour_ID == 46) { unset($tour->Day_ID); } $tour->PicInfo = $db->selectRows( "select * ". "from {$tblPref}ToursPicInfo ". "where Tour_ID = ".$tour->Tour_ID,"PicNum", __CFG_MOST_FREQUENT_CACHE_LIFETIME); $tpl->assign("tour", $tour); if (empty($def_lang)) { $def_lang = 1; } $tpl->assign("def_lang", $def_lang); $tpl->assign("dates", $dates); $tpl->assign("c_id", $tour->Cat_ID); $tpl->assign("t_id", $tour->SubCat_ID); $tour_encoding_id = 1; switch ($tour->SubCat_ID) { case 20: $tour_encoding_id = 24; break; case 18: $tour_encoding_id = 23; break; case 19: $tour_encoding_id = 21; break; default: $tour_encoding_id = 1; break; } $query = "SELECT B.Translation FROM {$tblPref}StrConst AS A JOIN {$tblPref}StrConstTranslation AS B ON A.Constant_ID = B.Constant_ID WHERE A.VarName = 'TblHdrTourStop' AND B.Encoding_ID = ".$tour_encoding_id; $trans = $db->selectObject($query, __CFG_MOST_FREQUENT_CACHE_LIFETIME); if ($trans !== false) { $tpl->assign('strTblHdrTourStop_', $trans->Translation); } $query = "SELECT B.Translation FROM {$tblPref}StrConst AS A JOIN {$tblPref}StrConstTranslation AS B ON A.Constant_ID = B.Constant_ID WHERE A.VarName = 'TblHdrTourIncl' AND B.Encoding_ID = ".$tour_encoding_id; $trans = $db->selectObject($query, __CFG_MOST_FREQUENT_CACHE_LIFETIME); if ($trans !== false) { $tpl->assign('strTblHdrTourIncl_', $trans->Translation); } $query = "SELECT B.Translation FROM {$tblPref}StrConst AS A JOIN {$tblPref}StrConstTranslation AS B ON A.Constant_ID = B.Constant_ID WHERE A.VarName = 'TblHdrTourStaying' AND B.Encoding_ID = ".$tour_encoding_id; $trans = $db->selectObject($query, __CFG_MOST_FREQUENT_CACHE_LIFETIME); if ($trans !== false) { $tpl->assign('strTblHdrTourStaying_', $trans->Translation); } $query = "SELECT B.Translation FROM {$tblPref}StrConst AS A JOIN {$tblPref}StrConstTranslation AS B ON A.Constant_ID = B.Constant_ID WHERE A.VarName = 'TblHdrTourExtras' AND B.Encoding_ID = ".$tour_encoding_id; $trans = $db->selectObject($query, __CFG_MOST_FREQUENT_CACHE_LIFETIME); if ($trans !== false) { $tpl->assign('strTblHdrTourExtras_', $trans->Translation); } $query = "SELECT B.Translation FROM {$tblPref}StrConst AS A JOIN {$tblPref}StrConstTranslation AS B ON A.Constant_ID = B.Constant_ID WHERE A.VarName = 'TblHdrImportantNote' AND B.Encoding_ID = ".$tour_encoding_id; $trans = $db->selectObject($query, __CFG_MOST_FREQUENT_CACHE_LIFETIME); if ($trans !== false) { $tpl->assign('strTblHdrImportantNote_', $trans->Translation); } $query = "SELECT B.Translation FROM {$tblPref}StrConst AS A JOIN {$tblPref}StrConstTranslation AS B ON A.Constant_ID = B.Constant_ID WHERE A.VarName = 'TblHdrTourGallery' AND B.Encoding_ID = ".$tour_encoding_id; $trans = $db->selectObject($query, __CFG_MOST_FREQUENT_CACHE_LIFETIME); if ($trans !== false) { $tpl->assign('strTblHdrTourGallery_', $trans->Translation); } /*$query = "SELECT B.Translation FROM {$tblPref}StrConst AS A JOIN {$tblPref}StrConstTranslation AS B ON A.Constant_ID = B.Constant_ID WHERE A.VarName = 'DaysNights' AND B.Encoding_ID = ".$tour_encoding_id; $trans = $db->selectObject($query); if ($trans !== false) { $tpl->assign('strDaysNights_', $trans->Translation); }*/ //PREPOST Hotels $hotels_sid = array(); $query = "SELECT * FROM ". "{$tblPref}HotelsTour AS A JOIN {$tblPref}HotelsPrices AS B ON A.Hotel_ID = B.Hotel_ID ". "WHERE (B.ValidFrom <= '".date('Y-m-d')."') AND (B.ValidTill >= '".date('Y-m-d')."')". " AND (A.Tour_ID = ".$tour->Tour_ID." AND (A.PrePost = '1:1' OR A.PrePost = '1:0' OR A.PrePost = '0:1'))"; $hotels = $db->selectObjects($query, "HotelTour_ID", __CFG_MOST_FREQUENT_CACHE_LIFETIME); foreach ($hotels as $index=>$hotel) { $query = "SELECT PrimaryPic FROM {$tblPref}Hotels WHERE Hotel_ID = ".$hotel->Hotel_ID; $h = $db->selectObject($query, __CFG_MOST_FREQUENT_CACHE_LIFETIME); $query = "SELECT * FROM {$tblPref}HotelsPicInfo WHERE Hotel_ID = ".$hotel->Hotel_ID." AND PicNum = ".$h->PrimaryPic; $Pictures = $db->selectObject($query, __CFG_MOST_FREQUENT_CACHE_LIFETIME); if ($Pictures !== false) { $hotels[$index]->Picture = $Pictures; $hotels_sid[] = $hotel->Hotel_ID; } } $sid->assign("hotel_ids", $hotels_sid); $tpl->assign("prepost", $hotels); //END PREPOST Hotels ?>
LT |  EN   

0 dienos(ų) / 0 naktys(ų)

:
Hotels befor and after tour: