public function process()
 {
     parent::process();
     //echo "vao day";die;
     if (self::$cookie->RoleID == 1) {
         Tools::redirect('hotelpage.php?mid=' . self::$cookie->HotelID);
     }
     $continentCode = Tools::getUserContinentCode(self::$cookie->CompanyID);
     $search_form = array();
     $search_form['CityId'] = 0;
     $search_form['AreaId'] = 0;
     if ((self::$cookie->RoleID == 2 || self::$cookie->RoleID == 3) && self::$cookie->OldLoginUserName == NULL) {
         $search_form['CheckIn'] = date('Y-m-d', strtotime(date('Y-m-d') . " + 5 days"));
         $search_form['Nights'] = 1;
         $search_form['CheckOut'] = date('Y-m-d', strtotime($search_form['CheckIn'] . " + {$search_form['Nights']} days"));
     }
     $search_form['HotelClassId'] = 0;
     $search_form['HotelName'] = '';
     $search_form['ContinentCode'] = $continentCode;
     $roomtype_list = RoomPlan::getRoomTypeList();
     $roomtype_form_list = array();
     foreach ($roomtype_list as $roomtype) {
         $roomTypeId = $roomtype['RoomTypeId'];
         $roomtype_form_list[$roomTypeId] = 0;
     }
     $search_form['RoomTypeVals'] = $roomtype_form_list;
     self::$smarty->assign("roomTypeList", $roomtype_list);
     self::$smarty->assign("search_form", $search_form);
     self::$smarty->assign("classList", Tools::getAllHotelClasses());
     self::$smarty->assign("areaList", Tools::getJapanAreas());
     //get Hotel List and Promotion List
     $promotionList = Promotion::getHomePromotionList(Promotion::$TYPE_PROMOTION);
     self::$smarty->assign('homePromotionList', $promotionList);
     $eventList = Promotion::getHomePromotionList(Promotion::$TYPE_EVENT);
     self::$smarty->assign('homeEventList', $eventList);
     // Get Popular Hotel List
     $poList = HotelDetail::getPopularHotelList(3);
     // 東京・横浜 - 関東 areaid = 3
     $popularList = array();
     global $cookie;
     $iso = Language::getIsoById((int) $cookie->LanguageID);
     foreach ($poList as $popular) {
         $image = HotelDetail::getFirstFileOfHotel($popular['HotelId'], 150, 150);
         if (is_file(_TAS_ROOT_DIR_ . "/asset/" . $image['w5_path'])) {
             $popular['HotelFilePath'] = $image['w5_path'];
             $popular['w5'] = $image['w5'];
             $popular['h5'] = $image['h5'];
         }
         $popular['LowestPrice'] = HotelDetail::getLowestPriceOfHotel($popular['HotelId']);
         $popular['AreaName'] = HotelDetail::getAreaName($popular['HotelArea']);
         $HotelNameKey = 'HotelName_' . $iso;
         $popular['HotelName'] = $popular[$HotelNameKey];
         $popularList[] = $popular;
     }
     //self::$smarty->assign('homeAreaList', Db::getInstance()->ExecuteS("select *, AreaName_".$this->iso." as AreaName from HT_Area where AreaId in (3, 5, 8, 12)"));
     self::$smarty->assign('homeAreaList', Db::getInstance()->ExecuteS('select  *, AreaName_' . $this->iso . ' as AreaName from `HT_Area` where isPopular = 1'));
     self::$smarty->assign("popularList", $popularList);
 }
 public function process()
 {
     global $cookie;
     parent::process();
     $roomtype_list = RoomPlan::getRoomTypeList();
     $roomtype_form_list = array();
     $search_form = array();
     // get contient code
     self::$cookie->UserID;
     $continentCode = Tools::getUserContinentCode(self::$cookie->CompanyID);
     if (Tools::isSubmit("search")) {
         $search_form = Tools::element_copy($_REQUEST, 'CityId', 'AreaId', 'CheckIn', 'CheckOut', 'Nights', 'HotelClassId', 'HotelName', 'SortBy', 'SortOrder');
         if (self::$cookie->RoleID == 2 || self::$cookie->RoleID == 3) {
             $search_form['ContinentCode'] = $continentCode;
             $search_form['HideRQ'] = @$_REQUEST['HideRQ'];
             $search_form['Role'] = 'Agent';
         }
         foreach ($roomtype_list as $roomtype) {
             $roomTypeId = $roomtype['RoomTypeId'];
             $roomtype_form_list[$roomTypeId] = $_REQUEST['RoomType_' . $roomTypeId];
         }
         $search_form['RoomTypeVals'] = $roomtype_form_list;
         if (self::$cookie->RoleID == 2 || self::$cookie->RoleID == 3 || $search_form['CheckIn'] && $search_form['CheckOut']) {
             $search_form['Role'] = 'Agent';
             $hotel_roomplan_count = RoomPlan::searchHotelRoomPlanCount($search_form);
             parent::pagination($hotel_roomplan_count);
             $hotel_roomplan_list = RoomPlan::searchHotelRoomPlan($search_form, $this->p, $this->n);
         } else {
             $hotel_roomplan_count = HotelDetail::getHotelByAreaCityCount($search_form);
             parent::pagination($hotel_roomplan_count);
             $hotel_roomplan_list = HotelDetail::getHotelByAreaCity($search_form, $this->p, $this->n);
         }
     } else {
         // redirect
         Tools::redirect('index.php');
     }
     self::$smarty->assign("hotel_roomplan_list", $hotel_roomplan_list);
     self::$smarty->assign("hotel_roomplan_count", $hotel_roomplan_count);
     self::$smarty->assign("search_form", $search_form);
     self::$smarty->assign("search_city_name", Tools::getCityName($search_form['CityId']));
     self::$smarty->assign("search_area_name", Tools::getAreaName($search_form['AreaId']));
     self::$smarty->assign("roomTypeList", $roomtype_list);
     self::$smarty->assign("classList", Tools::getAllHotelClasses());
     self::$smarty->assign("areaList", Tools::getJapanAreas());
 }
 public function process()
 {
     parent::process();
     global $cookie;
     $iso = Language::getIsoById((int) $cookie->LanguageID);
     $mid = $this->mid;
     //Tools::getValue("mid")!="" ? Tools::getValue("mid") : ((self::$cookie->RoleID==1) ? self::$cookie->HotelID : "");
     $hotel = new HotelDetail($mid);
     $HotelNameKey = 'HotelName_' . $iso;
     $hotel->HotelName = $hotel->{$HotelNameKey};
     $HotelAddressKey = 'HotelAddress_' . $iso;
     $hotel->HotelAddress = $hotel->{$HotelAddressKey};
     $HotelDescriptionKey = 'HotelDescription_' . $iso;
     $hotel->HotelDescription = $hotel->{$HotelDescriptionKey};
     $HotelPoliciesKey = 'HotelPolicies_' . $iso;
     $hotel->HotelPolicies = $hotel->{$HotelPoliciesKey};
     $UsefulInformationKey = 'UsefulInformation_' . $iso;
     $hotel->UsefulInformation = $hotel->{$UsefulInformationKey};
     $continentCode = Tools::getUserContinentCode(self::$cookie->CompanyID);
     // get CityName and AreaName of Hotel
     $hotel->HotelAreaName = Tools::getAreaName($hotel->HotelArea);
     $hotel->HotelCityName = Tools::getCityName($hotel->HotelCity);
     $hotel->HotelClassName = $hotel->getClassName();
     $number_star = 0;
     if ($hotel->HotelClass == 1 || $hotel->HotelClass == 4 || $hotel->HotelClass == 7) {
         $number_star = 5;
     } elseif ($hotel->HotelClass == 2 || $hotel->HotelClass == 5 || $hotel->HotelClass == 8) {
         $number_star = 4;
     } elseif ($hotel->HotelClass == 3 || $hotel->HotelClass == 6 || $hotel->HotelClass == 9) {
         $number_star = 3;
     }
     $isOnsen = 0;
     $isResort = 0;
     if ($hotel->HotelClass == 4 || $hotel->HotelClass == 5 || $hotel->HotelClass == 6) {
         $isOnsen = 1;
     } elseif ($hotel->HotelClass == 9 || $hotel->HotelClass == 8 || $hotel->HotelClass == 7) {
         $isResort = 1;
     }
     self::$smarty->assign("number_star", $number_star);
     self::$smarty->assign("isOnsen", $isOnsen);
     self::$smarty->assign("isResort", $isResort);
     self::$smarty->assign("hotel", $hotel);
     self::$smarty->assign("featureList", $hotel->getAllFeatures());
     $photoList = HotelDetail::getAllHotelFiles($hotel->HotelId);
     foreach ($photoList as $key => $var) {
         $iso_name = 'HotelFileName_' . $iso;
         $photoList[$key]['HotelFileName'] = $photoList[$key][$iso_name];
         //d($photoList[$key]);
     }
     self::$smarty->assign("photoList", $photoList);
     self::$smarty->assign("photoCount", sizeof($photoList));
     self::$smarty->assign("mid", $mid);
     // Get Similar Hotel List
     $simList = $hotel->getSimilarHotelList();
     $similarList = array();
     foreach ($simList as $similar) {
         $image = HotelDetail::getFirstFileOfHotel($similar['HotelId'], 145, 145);
         if (is_file(_TAS_ROOT_DIR_ . "/asset/" . $image['w5_path'])) {
             $similar['HotelFilePath'] = $image['w5_path'];
             $similar['w5'] = $image['w5'];
             $similar['h5'] = $image['h5'];
         }
         $similar['LowestPrice'] = HotelDetail::getLowestPriceOfHotel($similar['HotelId']);
         $similar['AreaName'] = Tools::getAreaName($similar['HotelArea']);
         $HotelNameKey = 'HotelName_' . $iso;
         $similar['HotelName'] = $similar[$HotelNameKey];
         $similarList[] = $similar;
     }
     self::$smarty->assign("similarList", $similarList);
     $roomtype_list = RoomPlan::getRoomTypeList();
     $roomtype_form_list = array();
     if (Tools::isSubmit("search")) {
         // search result
         $search_form = Tools::element_copy($_REQUEST, 'CheckIn', 'CheckOut', 'Nights', 'SortBy', 'SortOrder');
         $search_form['HotelId'] = $mid;
         foreach ($roomtype_list as $roomtype) {
             $roomTypeId = $roomtype['RoomTypeId'];
             $roomtype_form_list[$roomTypeId] = $_REQUEST['RoomType_' . $roomTypeId];
         }
         $search_form['RoomTypeVals'] = $roomtype_form_list;
         if (self::$cookie->RoleID == 2 || self::$cookie->RoleID == 3) {
             $search_form['ContinentCode'] = $continentCode;
             $search_form['Role'] = 'Agent';
         }
         $hotel_roomplan_count = RoomPlan::searchHotelRoomPlanCount($search_form);
         parent::pagination($hotel_roomplan_count);
         $hotel_roomplan_list = RoomPlan::searchHotelRoomPlan($search_form, $this->p, $this->n);
         // print_r($hotel_roomplan_list);
         self::$smarty->assign("hotel_roomplan_list", $hotel_roomplan_list);
         self::$smarty->assign("hotel_roomplan_count", $hotel_roomplan_count);
         self::$smarty->assign("search_form", $search_form);
     } else {
         $search_form = array();
         $search_form['CityId'] = 0;
         $search_form['AreaId'] = 0;
         if (self::$cookie->RoleID == 2 || self::$cookie->RoleID == 3) {
             $search_form['Role'] = 'Agent';
             $search_form['CheckIn'] = Tools::get_default_val($_REQUEST['CheckIn'], date('Y-m-d', strtotime(date('Y-m-d') . " + 5 days")));
             $search_form['Nights'] = Tools::get_default_val($_REQUEST['Nights'], 1);
             $search_form['CheckOut'] = date('Y-m-d', strtotime($search_form['CheckIn'] . " + {$search_form['Nights']} days"));
         }
         $search_form['HotelClassId'] = 0;
         $search_form['HotelName'] = '';
         $search_form['HotelId'] = $mid;
         foreach ($roomtype_list as $roomtype) {
             $roomTypeId = $roomtype['RoomTypeId'];
             $roomtype_form_list[$roomTypeId] = Tools::get_default_val($_REQUEST['RoomType_' . $roomTypeId], 0);
         }
         $search_form['RoomTypeVals'] = $roomtype_form_list;
         if (self::$cookie->RoleID == 2 || self::$cookie->RoleID == 3) {
             $search_form['ContinentCode'] = $continentCode;
             $search_form['Role'] = 'Agent';
         }
         self::$smarty->assign("search_form", $search_form);
         if (self::$cookie->RoleID == 1 && self::$cookie->HotelID == $mid || (self::$cookie->RoleID == 4 || self::$cookie->RoleID == 5)) {
             $search_form = array();
             $search_form['CityId'] = 0;
             $search_form['AreaId'] = 0;
             // $search_form['ContinentCode'] = $continentCode;
             $search_form['HotelClassId'] = 0;
             $search_form['HotelName'] = '';
             $search_form['HotelId'] = $mid;
             // $hotel_roomplan_list = RoomPlan::getRoomPlanListDetailByHotelId($mid);
             $hotel_roomplan_count = RoomPlan::searchHotelRoomPlanCount($search_form);
             parent::pagination($hotel_roomplan_count);
             $hotel_roomplan_list = RoomPlan::searchHotelRoomPlan($search_form, $this->p, $this->n);
             self::$smarty->assign("hotel_roomplan_list", $hotel_roomplan_list);
         } else {
             $temp = 0;
             foreach ($roomtype_form_list as $roomtype) {
                 if ($roomtype != 0) {
                     $temp = $roomtype;
                 }
             }
             $hotel_roomplan_count = RoomPlan::searchHotelRoomPlanCount($search_form);
             parent::pagination($hotel_roomplan_count);
             $hotel_roomplan_list = RoomPlan::searchHotelRoomPlan($search_form, $this->p, $this->n);
             if ($temp == 0) {
                 $hotel_roomplan_list = array();
             }
             self::$smarty->assign("hotel_roomplan_list", $hotel_roomplan_list);
             self::$smarty->assign("hotel_roomplan_count", $hotel_roomplan_count);
         }
     }
     self::$smarty->assign("roomTypeList", $roomtype_list);
 }
 public function process()
 {
     global $cookie;
     parent::process();
     // get hotel id
     // its value will retain from session.
     // get room plan list by hotel id
     $hotelId = $this->hotelId;
     //
     // action switch
     global $cookie;
     $iso = Language::getIsoById((int) $cookie->LanguageID);
     // show default list page
     $resRoomPlanList = RoomPlan::getRoomPlanListByHotelId($hotelId);
     // print_r($resRoomPlanList);
     $roomPlanList = array();
     foreach ($resRoomPlanList as $roomPlan) {
         $RoomPlanNameKey = 'RoomPlanName_' . $iso;
         $roomPlan['RoomPlanName'] = $roomPlan[$RoomPlanNameKey];
         $RoomPlanDescriptionKey = 'RoomPlanDescription_' . $iso;
         $roomPlan['RoomPlanDescription'] = addslashes($roomPlan[$RoomPlanDescriptionKey]);
         $roomPlan['FileIdList'] = RoomFile::getRoomFileListByRoomPlanId($roomPlan['RoomPlanId']);
         $photoList = RoomFile::getRoomFileListByRoomPlanId($roomPlan['RoomPlanId']);
         foreach ($photoList as $key => $var) {
             $iso_name = 'RoomFileName_' . $iso;
             $photoList[$key]['RoomFileName'] = $photoList[$key][$iso_name];
         }
         $roomPlan['FileIdList'] = $photoList;
         $roomPlanList[] = $roomPlan;
     }
     $roomTypeList = RoomPlan::getRoomTypeList();
     $today = date('Y-m-d');
     $tomorrow = date('Y-m-d', strtotime($today . " + 1 days"));
     self::$smarty->assign("roomPlanList", $roomPlanList);
     self::$smarty->assign("roomTypeList", $roomTypeList);
     self::$smarty->assign("hid", $hotelId);
     self::$smarty->assign("today", $today);
     self::$smarty->assign("tomorrow", $tomorrow);
 }