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); }
<!-- Author: quyennd Description: display weather --> <?php $_smarty_tpl->tpl_vars["request_uri"] = new Smarty_variable($_SERVER['REQUEST_URI'], null, null); if (strstr($_smarty_tpl->getVariable('request_uri')->value, "hoteldetail") || strstr($_smarty_tpl->getVariable('request_uri')->value, "hotelpage")) { ?> <?php $_smarty_tpl->tpl_vars["mid"] = new Smarty_variable($_GET['mid'], null, null); ?> <?php $_smarty_tpl->tpl_vars['hotel'] = new Smarty_variable(HotelDetail::getHotelDescription($_smarty_tpl->getVariable('mid')->value), null, null); ?> <?php $_smarty_tpl->tpl_vars['cityName'] = new Smarty_variable(HotelDetail::getCityName($_smarty_tpl->getVariable('hotel')->value['HotelCity']), null, null); } else { ?> <?php $_smarty_tpl->tpl_vars['cityName'] = new Smarty_variable('Tokyo', null, null); } ?> <!-- left navigation end --> <!-- include flatWeatherPlugin.js --> <script src="themes/default/js/jquery.flatWeatherPlugin.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var example3 = $("#weather").flatWeatherPlugin({ location: " <?php echo $_smarty_tpl->getVariable('cityName')->value;
public static function emailHotel($orderid, $orderstatus) { //1.获取订单信息 $bookingInfo = Booking::getBookingOrder($orderid); $BookingNo = $bookingInfo['BookingNo']; //订单编号 $ContactName = $bookingInfo['contact_name']; //1.Customer Information $ContactEmail = $bookingInfo['contact_email']; $ContactTel = $bookingInfo['contact_tel']; $CheckIn = $bookingInfo['checkin']; $CheckOut = $bookingInfo['checkout']; //2.获取下订单的用户信息 $userid = $bookingInfo['OrderUserId']; $userinfo = Member::getUserInfoById($userid); $AgentName = $userinfo['Name']; $AgentPhoneNo = $userinfo['Tel']; $AgentEmail = $userinfo['Email']; //3.获取酒店用户信息 $hotelid = $bookingInfo['hotel_id']; $hoteluserinfo = Member::getUserInfoByHotelId($hotelid); $UserName = $hoteluserinfo['Name']; $prefFax = $hoteluserinfo['PrefFax']; $prefEmail = $hoteluserinfo['PrefEmail']; $Fax = $hoteluserinfo['Fax']; $to = $hoteluserinfo['Email']; $languageid = $hoteluserinfo['LanguageID']; $iso = $hoteluserinfo['LanguageShortName']; if (!isset($hoteluserinfo['LanguageID'])) { $languageid = 4; } //4.获取酒店信息 $hotelinfo = HotelDetail::getHotelDescription($hotelid, $iso); $HotelName = $hotelinfo['HotelName']; $HotelAddress = $hotelinfo['HotelAddress']; $HotelContactNo = $hotelinfo['HotelContactNo']; $orderroominfo = RoomPlan::getOrderRoomInfo($orderid, $iso); $RoomList = ''; $RoomListFax = ''; $id = 1; foreach ($orderroominfo as $orderroom) { $RoomList .= "<table width='100%' cellspacing='10' style='font-size:12px;'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span style='color:#000000;font-weight:bold;font-zie:14px;'>- Room " . $id . "</span></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span>Room Plan(宿泊プラン):</span> " . $orderroom['RoomPlanName'] . " </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span>Room Type(ルームタイプ):</span> " . $orderroom['RoomTypeName'] . " </td>\t\t\t\t\n\t\t\t\t</tr> \n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span>Guest Name(宿泊者名):</span> " . $orderroom['CustomerName'] . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width='30%'><span>Breakfast(朝食):</span> " . $orderroom['Breakfast'] . "</td>\t\t\t\n\t\t\t\t\t<td><span>Dinner(夕食):</span> " . $orderroom['Dinner'] . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span>Special Request(特別リクエスト):</span> " . $orderroom['Special'] . " </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span>* All Special request are subjects to availability </span></td>\n\t\t\t\t</tr>\n\t\t\t</table>"; $RoomListFax .= "<table width=190 >\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2 size=11>- Room " . $id . "</td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2>Room Plan(宿泊プラン): " . $orderroom['RoomPlanName'] . " </td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2>Room Type(ルームタイプ): " . $orderroom['RoomTypeName'] . " </td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2>Guest Name(宿泊者名): " . $orderroom['CustomerName'] . "</td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td>Breakfast(朝食): " . $orderroom['Breakfast'] . "</td>\n \t\t\t\t\t<td>Dinner(夕食): " . $orderroom['Dinner'] . "</td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2>Special Request(特別リクエスト): " . $orderroom['Special'] . " </td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2>* All Special request are subjects to availability </td>\n \t\t\t\t</tr>\n \t\t\t</table>"; $id++; } $RoomString = RoomPlan::getRoomString($orderid, $iso); include_once substr(dirname(__FILE__), 0, -8) . '/config/mail.config.php'; global $from, $message, $subject; $search = array('{#BookingNo}', '{#HotelName}', '{#UserName}', '{#HotelAddress}', '{#HotelContactNo}', '{#ContactName}', '{#ContactEmail}', '{#ContactTel}', '{#CheckIn}', '{#CheckOut}', '{#RoomString}', '{#RoomList}', '{#AgentName}', '{#AgentPhoneNo}', '{#AgentEmail}'); $replace = array($BookingNo, $HotelName, $UserName, $HotelAddress, $HotelContactNo, $ContactName, $ContactEmail, $ContactTel, $CheckIn, $CheckOut, $RoomString, $RoomList, $AgentName, $AgentPhoneNo, $AgentEmail); $replaceFax = array($BookingNo, $HotelName, $UserName, $HotelAddress, $HotelContactNo, $ContactName, $ContactEmail, $ContactTel, $CheckIn, $CheckOut, $RoomString, $RoomListFax, $AgentName, $AgentPhoneNo, $AgentEmail); $msg = str_replace($search, $replace, $message[10][5][$languageid]); // $faxmsg = str_replace($search, $replaceFax, $message[21][5][$languageid]); $faxmsg = str_replace($search, $replaceFax, $message[21][5][4]); $sub = str_replace('{#BookingNo}', $BookingNo, $subject[$orderstatus][5][$languageid]); if ($orderstatus == 7) { $msg = str_replace('下記の予約をお願いいたします', '下記の予約のキャンセルをお願いいたします', $msg); $faxmsg = str_replace('下記の予約をお願いいたします', '下記の予約のキャンセルをお願いいたします', $faxmsg); } if ($prefEmail) { $headers = "From: {$from}" . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-Type: text/html; charset=utf-8' . "\r\n"; $headers .= 'Bcc: booking@tas-agent.com'; //echo $sub."<br/><br/><br/>".$msg; if ($sub != '' && $msg != '') { global $emailTail; $msgBody = $msg . $emailTail; self::sendEmail($to, $sub, $msg); //@mail($to, $sub, $msgBody, $headers); $Insertmsg = htmlentities($msg); $sql = 'insert into `HT_Mail`(MailTo, MailFrom, SubjectName, Body) value("' . $to . '", "' . $from . '", "' . $sub . '", "' . $Insertmsg . '")'; Db::getInstance()->ExecuteS($sql); } } if ($prefFax) { global $toemail, $faxTail, $faxHead; $emailBody = "<p>需要给酒店发送传真.</p>\n\t\t\t\t\t\t<p>传真号为: {$Fax}</p>\n\t\t\t\t\t\t<p>订单状态为: {$orderstatus}</p>"; $emailBody = "fax"; $faxsub = $faxHead[$orderstatus]; $faxsub2 = "<TAS-Agent.com> Booking ID:" . $BookingNo; $prefix = time(); require_once _TAS_TOOL_DIR_ . "/tfpdf/pdffax.inc.php"; $defFont = 'MyFont'; $pdf = new PDFTable(); $pdf->AddFont($defFont, '', 'ARIALUNI.TTF', true); $pdf->AddFont($defFont . 'B', '', 'ARIALUNI.TTF', true); $pdf->SetMargins(10, 2); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0); $pdf->SetPadding(0); $pdf->SetSpacing(0, 0); $pdf->AddPage(); //header $pdf->SetFont($defFont, '', 10); $pdf->Image(_TAS_THEME_DIR_ . "/img/logo_pdf.png", 140, 15, 60); $pdf->htmltable("<table width=190><tr><td size=20 > </td></tr></table>", 1); $pdf->Ln(2); $pdf->htmltable("<table width=190><tr><td size=14 colspan=2>" . $faxsub . " </td></tr>\n \t </table>", 1); $pdf->Image(_TAS_THEME_DIR_ . "/img/linep.png", 10, $pdf->y, 190); //内容 $pdf->htmltable($faxmsg); //footer $pdf->SetY(-30); $pdf->Image(_TAS_THEME_DIR_ . "/img/linep.png", 10, $pdf->y, 190); $pdf->Ln(1); $pdf->Image(_TAS_THEME_DIR_ . "/img/bottom_logo_pdf.png", 12, $pdf->y + 2, 20); $pdf->x = 35; $pdf->htmltable("<table width=90>\n \t <tr><td size=9>TAS Agent / TAS Co.Ltd<br>TEL 03-5565-5850<br>FAX 03-5565-5850<br>booking@tas-agent.com</td></tr>\n \t </table>", 0); $pdf->htmltable("<table width=190>\n \t <tr><td size=9>※TAS Agent はTAS Co.,Ltdが運営しております。 上記予約の内容については直接TASまでご連絡ください。\n \t </td></tr></table>", 1); $attachment_file = _TAS_ROOT_DIR_ . "/classes/temp/attachment_" . $prefix . ".pdf"; //$attachment_file=_TAS_ROOT_DIR_."/config/attachment_".$prefix.".pdf"; $pdf->Output($attachment_file); require_once _TAS_TOOL_DIR_ . "/PHPMailer/class.phpmailer.php"; $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; // set the SMTP port for the GMAIL server $mail->Username = "******"; // GMAIL username $mail->Password = "******"; // GMAIL password $mail->SetFrom('*****@*****.**', 'fax'); $mail->AddReplyTo("*****@*****.**", "fax"); $mail->Subject = $faxsub2; $mail->MsgHTML($emailBody); $toemail = $Fax . "@efaxsend.com"; $mail->AddAddress($toemail, $Fax); $mail->AddAttachment($attachment_file); // attachment $mail->Send(); //发邮件 if (file_exists($attachment_file)) { unlink($attachment_file); //删除文件 } } }
public function preProcess() { global $cookie; $iso = Language::getIsoById((int) $cookie->LanguageID); if (Tools::isSubmit("getcity")) { $areaid = (int) Tools::getValue("cityid"); $cityList = Tools::getCitys($areaid); $rstr = ""; foreach ($cityList as $city) { $rstr .= $city['CityId'] . "," . $city['CityName'] . "," . $city['HotelNum'] . "|"; } echo substr($rstr, 0, strlen($rstr) - 1); exit; } if (!Tools::hasFunction('hotel_detail_edit')) { Tools::redirect('index.php'); } $mid = (int) Tools::getValue("mid"); if ($mid == 0) { $this->brandNavi[] = array("name" => "Add Hotel", "url" => "hoteldetail.php"); } else { if (self::$cookie->RoleID > 1) { $hotel = new HotelDetail($mid); $HotelNameKey = 'HotelName_' . $iso; $this->brandNavi[] = array("name" => $hotel->{$HotelNameKey}, "url" => "hotelpage.php?mid=" . $this->mid); } $this->brandNavi[] = array("name" => "Hotel Detail Edit", "url" => "hoteldetail.php"); } if ($mid == 0 && self::$cookie->RoleID == 1) { $mid = self::$cookie->HotelID; } if ($mid == 0 && self::$cookie->RoleID > 1) { $hotelDetail = new HotelDetail(); $hotelDetail->HotelCode = "_"; $hotelDetail->HotelClass = 0; $hotelDetail->HotelCity = 0; $hotelDetail->HotelArea = 0; $hotelDetail->add(true, false); $hotelDetail->HotelCode = "JP" . str_pad($hotelDetail->HotelId, 6, "0", STR_PAD_LEFT); $hotelDetail->update(false); $mid = $hotelDetail->HotelId; } $hotel = new HotelDetail($mid); if (Tools::isSubmit("Submit")) { //$hotel->HotelCode = trim(Tools::getValue("HotelCode")); $HotelNameKey = 'HotelName_' . $iso; $hotel->{$HotelNameKey} = trim(Tools::getValue("HotelName")); $hotel->HotelCity = trim(Tools::getValue("HotelCity")); $hotel->HotelArea = trim(Tools::getValue("HotelArea")); $HotelAddressKey = 'HotelAddress_' . $iso; $hotel->{$HotelAddressKey} = trim(Tools::getValue("HotelAddress")); //$hotel->HotelCode = trim(Tools::getValue("HotelCode")); $hotel->HotelClass = trim(Tools::getValue("HotelClass")); $hotel->HotelContactNo = trim(Tools::getValue("HotelContactNo")); $HotelDescriptionKey = 'HotelDescription_' . $iso; $hotel->{$HotelDescriptionKey} = trim(Tools::getValue("HotelDescription")); $HotelPoliciesKey = 'HotelPolicies_' . $iso; $hotel->{$HotelPoliciesKey} = trim(Tools::getValue("HotelPolicies")); $UsefulInformationKey = 'UsefulInformation_' . $iso; $hotel->{$UsefulInformationKey} = trim(Tools::getValue("UsefulInformation")); $hotel->HotelFax = trim(Tools::getValue("HotelFax")); $hotel->HotelEmail = trim(Tools::getValue("HotelEmail")); $prefCon = trim(Tools::getValue("prefCon")); if ($prefCon == 'prefFax') { $hotel->PrefEmail = 0; $hotel->PrefFax = 1; } elseif ($prefCon == 'prefEmail') { $hotel->PrefEmail = 1; $hotel->PrefFax = 0; } elseif ($prefCon == 'prefAll') { $hotel->PrefEmail = 1; $hotel->PrefFax = 1; } elseif ($prefCon == 'prefNone') { $hotel->PrefEmail = 0; $hotel->PrefFax = 0; } else { $hotel->PrefEmail = 0; $hotel->PrefFax = 0; } /*if (empty($hotel->HotelCode)) { $this->errors[] = Tools::displayError("Hotel Code required"); }*/ if (empty($hotel->{$HotelNameKey})) { $this->errors[] = Tools::displayError("Hotel Name required"); } if ((int) $hotel->HotelCity == 0) { $this->errors[] = Tools::displayError("Hotel City required"); } if (empty($hotel->{$HotelAddressKey})) { $this->errors[] = Tools::displayError("Hotel Address required"); } if (!sizeof($this->errors)) { if ($hotel->HotelId > 0) { //echo $hotel->getHotelName($hotel->HotelId, 'en'); $hid = $hotel->HotelId; $HotelName = trim(Tools::getValue("HotelName")); $HotelAddress = trim(Tools::getValue("HotelAddress")); $HotelDescription = trim(Tools::getValue("HotelDescription")); $HotelPolicies = trim(Tools::getValue("HotelPolicies")); $UsefulInformation = trim(Tools::getValue("UsefulInformation")); if ($hotel->getHotelName($hotel->HotelId, 'en') == null) { $hotel->HotelName_en = $HotelName; } if ($hotel->getHotelName($hotel->HotelId, 'jp') == null) { $hotel->HotelName_jp = $HotelName; } if ($hotel->getHotelName($hotel->HotelId, 'S_CN') == null) { $hotel->HotelName_S_CN = $HotelName; } if ($hotel->getHotelName($hotel->HotelId, 'T_CN') == null) { $hotel->HotelName_T_CN = $HotelName; } if ($hotel->getHotelInfo($hid, 'HotelAddress', 'en') == null) { $hotel->HotelAddress_en = $HotelAddress; } if ($hotel->getHotelInfo($hid, 'HotelAddress', 'jp') == null) { $hotel->HotelAddress_jp = $HotelAddress; } if ($hotel->getHotelInfo($hid, 'HotelAddress', 'S_CN') == null) { $hotel->HotelAddress_S_CN = $HotelAddress; } if ($hotel->getHotelInfo($hid, 'HotelAddress', 'T_CN') == null) { $hotel->HotelAddress_T_CN = $HotelAddress; } if ($hotel->getHotelInfo($hid, 'HotelDescription', 'en') == null) { $hotel->HotelDescription_en = $HotelDescription; } if ($hotel->getHotelInfo($hid, 'HotelDescription', 'jp') == null) { $hotel->HotelDescription_jp = $HotelDescription; } if ($hotel->getHotelInfo($hid, 'HotelDescription', 'S_CN') == null) { $hotel->HotelDescription_S_CN = $HotelDescription; } if ($hotel->getHotelInfo($hid, 'HotelDescription', 'T_CN') == null) { $hotel->HotelDescription_T_CN = $HotelDescription; } if ($hotel->getHotelInfo($hid, 'HotelPolicies', 'en') == null) { $hotel->HotelPolicies_en = $HotelPolicies; } if ($hotel->getHotelInfo($hid, 'HotelPolicies', 'jp') == null) { $hotel->HotelPolicies_jp = $HotelPolicies; } if ($hotel->getHotelInfo($hid, 'HotelPolicies', 'S_CN') == null) { $hotel->HotelPolicies_S_CN = $HotelPolicies; } if ($hotel->getHotelInfo($hid, 'HotelPolicies', 'T_CN') == null) { $hotel->HotelPolicies_T_CN = $HotelPolicies; } if ($hotel->getHotelInfo($hid, 'UsefulInformation', 'en') == null) { $hotel->UsefulInformation_en = $UsefulInformation; } if ($hotel->getHotelInfo($hid, 'UsefulInformation', 'jp') == null) { $hotel->UsefulInformation_jp = $UsefulInformation; } if ($hotel->getHotelInfo($hid, 'UsefulInformation', 'S_CN') == null) { $hotel->UsefulInformation_S_CN = $UsefulInformation; } if ($hotel->getHotelInfo($hid, 'UsefulInformation', 'T_CN') == null) { $hotel->UsefulInformation_T_CN = $UsefulInformation; } $hotel->update(false); } else { $hotel->HotelId = $mid; $hotel->add(); self::$cookie->HotelID = $mid; } // Update HotelFeatureLink $fidList = $_POST['fids'] == '' ? '' : $_POST['fids']; $hotel->deleteAllFeatures(); $hotel->updateFeatures($fidList); // Update Name and Order of hotel images $imageids = Tools::getValue("hotelFileId"); $imagenames = Tools::getValue("hotelFileName"); if ($imageids != "" && sizeof($imageids)) { for ($i = 0; $i < sizeof($imageids); $i++) { HotelDetail::updateHotelImage($imageids[$i], $imagenames[$i], $i, $iso); } } if ($_POST['admin_add_hotel'] == 1) { Tools::redirect('auth.php?prev_page=hotellist&nohotel=1&hid=' . $mid); } else { Tools::redirect('hotelpage.php?mid=' . $mid); } } } else { if ('upload' == $_REQUEST['action']) { // insert image file $fileArray = HotelDetail::insertHotelFiles($mid, 1); foreach ($fileArray as $file) { echo $file[0] . "|||" . $file[1] . "|||" . $file[2] . "*"; } exit; } else { if (Tools::isSubmit("delimage")) { $fid = Tools::getValue("fid"); HotelDetail::delHotelFile($fid); exit; } } } $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}; self::$smarty->assign("mid", $mid); self::$smarty->assign("hotel", $hotel); if ($hotel->HotelCity > 0) { self::$smarty->assign("cityList", Tools::getCitys($hotel->HotelArea)); } self::$smarty->assign("featureList", $hotel->getAllFeatures()); $photoList = HotelDetail::getAllHotelFiles($mid); foreach ($photoList as $key => $var) { $iso_name = 'HotelFileName_' . $iso; $photoList[$key]['HotelFileName'] = $photoList[$key][$iso_name]; //d($photoList[$key]); } self::$smarty->assign("photoList", $photoList); }
public static function buildBookingInfoFromPost($companyId) { //从Post表单中建立预定信息 $booking_info = array(); $booking_info = Tools::element_copy($_POST, 'order_id', 'hotel_id', 'checkin', 'checkout', 'contact_name', 'contact_email', 'contact_tel', 'contact_hp'); $booking_info['order_id'] = Tools::get_default_val(@$_POST['order_id'], 0); //获取订单编号,没有则认为是0 $nights = (strtotime($booking_info['checkout']) - strtotime($booking_info['checkin'])) / (24 * 60 * 60); // diff day $booking_info['nights'] = $nights; //计算预定几个晚上 $booking_info['hotel_info'] = HotelDetail::getHotelDescription($_POST['hotel_id']); //获取酒店信息 //OrderRoom表中会用到 $ids = $_POST['ids']; $orid_list = array(); $rpid_list = array(); foreach ($ids as $id) { $orid_list[] = $_POST['or_ids_' . $id]; $rpid_list[] = $_POST['roomplan_ids_' . $id]; } //获取房间列表 $roomplan_list = RoomPlan::getRoomPlanListForBooking($rpid_list, $booking_info['checkin'], $booking_info['checkout']); $total_price = 0.0; //计算总价格 $org_total_price = 0.0; //计算不含手数料总价格 $booked_roomplan_list = array(); foreach ($roomplan_list as $key => $booked_roomplan) { $id = $ids[$key]; $orid = $orid_list[$id]; $booked_roomplan['OrderRoomId'] = $orid; $booked_roomplan['req_nonsmoking'] = Tools::get_default_val($_POST['req_nonsmoking_' . $id], 0); $booked_roomplan['req_smoking'] = Tools::get_default_val($_POST['req_smoking_' . $id], 0); $booked_roomplan['req_adjoin'] = Tools::get_default_val($_POST['req_adjoin_' . $id], 0); $booked_roomplan['req_remark'] = Tools::get_default_val($_POST['req_remark_' . $id], ''); $customer_info_list = array(); if (array_key_exists('customer_fnames_' . $id, $_POST)) { foreach ($_POST['customer_fnames_' . $id] as $i => $val) { if ($_POST['customer_fnames_' . $id][$i] != '' || $_POST['customer_gnames_' . $id][$i] != '') { $customer_info = array(); $customer_info['customer_fnames'] = $_POST['customer_fnames_' . $id][$i]; $customer_info['customer_gnames'] = $_POST['customer_gnames_' . $id][$i]; $customer_info['customer_sex'] = Tools::get_default_val($_POST['customer_sex_' . $id . "_{$i}"], 0); $customer_info['customer_country'] = $_POST['customer_country_' . $id][$i]; $customer_info['customer_country_name'] = Tools::getCountryName($customer_info['customer_country']); $customer_info_list[] = $customer_info; } } } else { // empty customers info for ($i = 0; $i < $booked_roomplan['RoomMaxPersons']; $i++) { // default value $customer_info['customer_fnames'] = ''; $customer_info['customer_gnames'] = ''; $customer_info['customer_sex'] = 1; // male $customer_info['customer_country'] = 109; // japan $customer_info_list[] = $customer_info; } } $booked_roomplan['customer_info_list'] = $customer_info_list; $price_result = Booking::calculation_roomplan_price($booked_roomplan['RoomPlanId'], $booking_info['checkin'], $booking_info['checkout'], $companyId); $booked_roomplan['Price'] = $price_result['Price']; $booked_roomplan['PriceString'] = $price_result['PriceString']; $total_price += $booked_roomplan['Price']; $booked_roomplan['Check_0'] = $price_result['check_0']; $booked_roomplan['OrgPrice'] = $price_result['OrgPrice']; $org_total_price += $booked_roomplan['OrgPrice']; $booked_roomplan_list[] = $booked_roomplan; } $booking_info['TotalPrice'] = $total_price; $booking_info['TotalPriceString'] = Tools::money($total_price); $booking_info['booked_roomplan_list'] = $booked_roomplan_list; $booking_info['OrgTotalPrice'] = $org_total_price; //由于此处只有初次下订单时才经过,所以otherPrice必定为0 $booking_info['otherPrice'] = 0; $booking_info['PaidIn'] = Tools::money($booking_info['otherPrice']); $booking_info['money'] = $booking_info['TotalPrice'] - $booking_info['otherPrice']; $booking_info['UnPaid'] = Tools::money($booking_info['money']); $booking_info['org_money'] = $booking_info['OrgTotalPrice'] - $booking_info['otherPrice']; return $booking_info; }
<?php if (!$_smarty_tpl->getVariable('content_only')->value) { ?> <div class="left right_content_outer"> <?php } ?> <?php $_smarty_tpl->tpl_vars["roleid"] = new Smarty_variable($_smarty_tpl->getVariable('cookie')->value->RoleID, null, null); if ($_GET['mid'] > 0 && ($_smarty_tpl->getVariable('roleid')->value > 3 || $_smarty_tpl->getVariable('roleid')->value == 1)) { ?> <?php $_smarty_tpl->tpl_vars['hotel'] = new Smarty_variable(HotelDetail::getHotelByUserId($_GET['mid']), null, null); ?> <div style="float:right;font-weight:bold;"> <?php $_template = new Smarty_Internal_Template($_smarty_tpl->getVariable('tpl_dir')->value . "./common/sub_menu.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null); echo $_template->getRenderedTemplate(); unset($_template); ?> </div> <?php } ?> <form method="post" action="auth.php" name="registerFrm" id="registerFrm" > <input type="hidden" name="nohotel" value="<?php echo $_GET['nohotel'];
protected function getHotelCode($hotelinfo) { $hotelinfo['HotelClass'] = $this->getHotelClassId($hotelinfo['HotelClass']); $hotelinfo['HotelCity'] = $this->getCityId($hotelinfo['CityName_en']); $hotelinfo['HotelArea'] = $this->getAreaId($hotelinfo['AreaName_en']); if (!$hotelinfo['HotelClass'] || !$hotelinfo['HotelCity'] || !$hotelinfo['HotelArea']) { return -1; } $searchinfo = HotelDetail::getHotelInfoByExcel($hotelinfo); if ($searchinfo['HotelCode']) { return $searchinfo['HotelCode']; } else { return 0; } }
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 static function searchHotelRoomPlan($criteria, $p, $n) { global $cookie; $iso = Language::getIsoById((int) $cookie->LanguageID); $where_cond = RoomPlan::getCriteriaWhereClause($criteria); $having_cond = RoomPlan::getCriteriaHavingClause($criteria); $price_field = RoomPlan::getCriteriaPriceField($criteria); $having_cond2 = RoomPlan::getCriteriaHavingClause2($criteria); $role = RoomPlan::getCriteriaRole($criteria); $usecond_cond = ' '; if (array_key_exists('CheckIn', $criteria) && '' != $criteria['CheckIn'] && array_key_exists('CheckOut', $criteria) && '' != $criteria['CheckOut']) { // $usecond_cond .= " , if(C.UseCon = 1, (DATE_ADD(\"{$criteria['CheckIn']}\", INTERVAL C.Nights-1 DAY) <= C.`ConToTime`) AND (DATE_SUB(\"{$criteria['CheckOut']}\",INTERVAL 1 DAY) >= C.`ConFromTime`) , 0) as UseCon "; $usecond_cond .= " , if(C.UseCon = 1, DATEDIFF(LEAST(C.`ConToTime`, DATE_SUB(\"{$criteria['CheckOut']}\",INTERVAL 1 DAY)) , GREATEST(\"{$criteria['CheckIn']}\", C.`ConFromTime`)) >= (C.Nights - 1), 0) as UseCon "; } $order_by = ''; if (array_key_exists('SortBy', $criteria) && '' != $criteria['SortBy'] && array_key_exists('SortOrder', $criteria) && '' != $criteria['SortOrder']) { if ($criteria['SortBy'] == 'price' && array_key_exists('ContinentCode', $criteria)) { $order_by = " MinPrice " . $criteria['SortOrder']; } else { if ($criteria['SortBy'] == 'class') { $order_by = ' HotelClassName ' . $criteria['SortOrder']; } else { if ($criteria['SortBy'] == 'name') { $order_by = ' A.HotelName ' . $criteria['SortOrder']; } } } } $sql = ' select A.HotelId,A.HotelName_' . $iso . ' as HotelName, A.HotelClass, A.HotelAddress_' . $iso . ' as HotelAddress, F.HotelClassName, A.HotelCity, G.CityName_' . $iso . ' as CityName, A.HotelArea, H.AreaName_' . $iso . ' as AreaName ,A.HotelDescription_' . $iso . ' as HotelDescription, C.RoomPlanId, C.RoomTypeId, J.`RoomTypeName`, C.RoomPlanName_' . $iso . ' as RoomPlanName, C.RoomMaxPersons,C.zaiku , C.Breakfast, C.Dinner, E.HotelOrder, C.`StartTime` , F.HotelClassName , C.`EndTime` ' . $usecond_cond . $price_field; if ($role == 'Agent') { $sql .= ', min(I.`Amount`) as MinAmount'; } $sql .= ' FROM HT_Hotel as A, HT_HotelRoomPlanLink as B, HT_RoomPlan as C'; if ($role == 'Agent') { $sql .= ', `HT_RoomStockAndPrice` as I'; } $sql .= ',( SELECT HotelId, @curRow := @curRow + 1 AS HotelOrder FROM ( select * From ( select (A.HotelId), A.HotelName, F.HotelClassName, C.RoomTypeId ' . $price_field . ' from HT_Hotel as A, HT_HotelRoomPlanLink as B, HT_RoomPlan as C,'; if ($role == 'Agent') { $sql .= '`HT_RoomStockAndPrice` as I,'; } $sql .= 'HT_HotelClass as F where A.HotelId = B.HotelId and B.RoomPlanId = C.RoomPlanId and F.HotelClassId = A.HotelClass '; if ($role == 'Agent') { $sql .= ' AND C.`RoomPlanId` = I.`RoomPlanId`'; } $sql .= $where_cond; if ($role == 'Agent') { $sql .= ' GROUP BY I.`RoomPlanId`'; } $sql .= $having_cond; if ($order_by != '') { $sql .= ' ORDER BY ' . $order_by; } $sql .= ' ) AS A GROUP BY HotelId ' . $having_cond2; if ($order_by != '') { $sql .= ' ORDER BY ' . $order_by; } $sql .= ' LIMIT ' . ($p - 1) * $n . ',' . $n; $sql .= ') AS A join (SELECT @curRow := 0) r ) AS E, HT_HotelClass as F, HT_City as G, HT_Area as H, HT_RoomType as J WHERE A.HotelId = E.HotelId and A.HotelId = B.HotelId and B.RoomPlanId = C.RoomPlanId AND A.HotelClass = F.HotelClassId AND A.HotelCity = G.CityId AND A.HotelArea = H.AreaId AND C.`RoomTypeId` = J.`RoomTypeId`'; if ($role == 'Agent') { $sql .= ' AND C.`RoomPlanId` = I.`RoomPlanId`'; } $sql .= $where_cond; if ($role == 'Agent') { $sql .= ' GROUP BY I.`RoomPlanId`'; } $sql .= $having_cond . ' ORDER BY E.HotelOrder ASC'; if ($order_by != '') { $sql .= ', ' . $order_by; } else { $sql .= ', C.`RoomPlanId` ASC'; } //echo $sql; $res = Db::getInstance()->ExecuteS($sql); if (!$res) { return null; } // indexed by hotel id $search_result = array(); $pre_buy_plans = array(); // foreach ($res as $hotel_roomplan) { if ($hotel_roomplan['zaiku'] == '1' && $hotel_roomplan['MinAmount'] == '0') { continue; } // key $hotel_id = $hotel_roomplan['HotelId']; $search_record = array(); $new_roomplan = Tools::element_copy($hotel_roomplan, 'RoomPlanId', 'RoomTypeId', 'RoomTypeName', 'RoomPlanName', 'RoomMaxPersons', 'UseCon', 'Breakfast', 'Dinner', 'RoomPriceId', 'ApplyDate', 'MinPrice', 'MinAmount'); if (array_key_exists($hotel_id, $search_result)) { // get hotel record $search_record = $search_result[$hotel_id]; } else { // It's new a hotel key // create new hotel info $search_record = Tools::element_copy($hotel_roomplan, 'HotelId', 'HotelName', 'HotelClass', 'HotelClassName', 'HotelAddress', 'HotelCity', 'CityName', 'HotelArea', 'AreaName', 'HotelDescription'); // pre-calculation price for display // but user can reselect room type and count $search_record['BookingPrice'] = 0; // get hotel first image $image = HotelDetail::getFirstFileOfHotel($search_record['HotelId']); $search_record['HotelFilePath'] = $image['HotelFilePath']; $search_record['w5_path'] = $image['w5_path']; $search_record['w5'] = $image['w5']; $search_record['h5'] = $image['h5']; // $search_record['RoomPlanList'] = array(); } $new_roomplan['PreSelect'] = 0; if ($criteria['RoomTypeVals'][$new_roomplan['RoomTypeId']] > 0) { if (!array_key_exists($hotel_id, $pre_buy_plans)) { $pre_buy_plans[$hotel_id] = array(); } // check already selected same room type if (!array_key_exists($new_roomplan['RoomTypeId'], $pre_buy_plans[$hotel_id])) { $new_roomplan['PreSelect'] = 1; $pre_buy_plans[$hotel_id][$new_roomplan['RoomTypeId']] = 1; // pre-select $search_record['BookingPrice'] += $new_roomplan['MinPrice'] * $criteria['RoomTypeVals'][$new_roomplan['RoomTypeId']]; } } // insert image information $rp_images = RoomFile::getRoomFileListByRoomPlanId($hotel_roomplan['RoomPlanId']); $file_id = $rp_images[0]['RoomFileId']; $res = RoomFile::getRoomFile($file_id); if (!$res) { $w2 = 0; $h2 = 0; } else { $filepath = $res[0]['RoomFilePath']; list($width, $height, $type, $attr) = getimagesize($filepath); if ($width < 100 && $height < 75) { $w2 = width; $h2 = $height; } else { $ratio1 = $width / 100; $ratio2 = $height / 75; if ($ratio1 < $ratio2) { $w2 = 100; $h2 = intval($height / $ratio1); } else { $h2 = 75; $w2 = intval($width / $ratio2); } } $pos = strpos($filepath, "asset"); $new_roomplan['img_path'] = substr($filepath, $pos); } $new_roomplan['img_width'] = $w2; $new_roomplan['img_height'] = $h2; // insert new roomplan-stock info $search_record['RoomPlanList'][] = $new_roomplan; // add or reset search result record $search_result[$hotel_id] = $search_record; } return $search_result; }
public static function checkHotelCodeUseful($HotelCode, $UserId) { $hotelinfo = HotelDetail::getHotelByHotelCode($HotelCode); $HotelId = $hotelinfo['HotelId']; if (!$HotelId) { return 0; } $sql = "select UserID from HT_User where 1=1 "; $sql .= $HotelId ? "and HotelId='{$HotelId}' " : ""; $sql .= $UserId ? "and UserID <> '{$UserId}' " : ""; $userinfo = Db::getInstance()->getRow($sql); $userId = $userinfo['UserID']; if ($userId) { return 0; } return $HotelId; }
public function preProcess() { parent::preProcess(); if (Tools::isSubmit("checkemail")) { if (Member::isExistEmail(Tools::getValue("email"), Tools::getValue("mid"))) { echo "false"; } else { echo "true"; } exit; } else { if (Tools::isSubmit("checkid")) { if (Member::isExistLoginUserName(Tools::getValue("loginUserName"))) { echo "false"; } else { echo "true"; } exit; } else { if (Tools::isSubmit("agentid")) { if (Company::isExistAgentID(Tools::getValue("agentID"), Tools::getValue("cid"))) { echo "false"; } else { echo "true"; } exit; } } } if (Tools::getValue("mod") == "hotel" || Tools::getValue("mod") == "agent" || Tools::getValue("mod") == "agent") { if (self::$cookie->isLogged()) { Tools::redirect("index.php"); } } $this->member = new Member((int) Tools::getValue("mid")); $this->company = new Company($this->member->CompanyID); if (!self::$cookie->isLogged()) { $this->content_only = true; } else { if (Tools::getValue("prev_page") == "adminlist") { $this->brandNavi[] = array("name" => "Admin List", "url" => "adminlist.php"); } else { if (Tools::getValue("prev_page") == "agentlist") { if (self::$cookie->RoleID == 3) { $this->brandNavi[] = array("name" => "User Management", "url" => "agentlist.php"); } else { $this->brandNavi[] = array("name" => "Agent List", "url" => "agentlist.php"); } } else { if (Tools::getValue("prev_page") == "hotellist") { $this->brandNavi[] = array("name" => "Hotel List", "url" => "hotellist.php"); } else { if (self::$cookie->RoleID > 1 && Tools::getValue("mod") == "self") { $this->brandNavi[] = array("name" => "My Information", "url" => "auth.php?mod=self&mid=" . Tools::getValue("mid")); } else { if (self::$cookie->RoleID == 1 && Tools::getValue("mod") == "self") { $this->brandNavi[] = array("name" => "My Information", "url" => "auth.php?mod=self&mid=" . Tools::getValue("mid")); } } } } } } $myinfo = false; $editCompany = true; $editLanguage = true; $editRole = false; $editDelete = false; $editPref = false; $editPayment = false; if (!self::$cookie->isLogged() && Tools::getValue("mod") != "hotel") { $myinfo = true; } if (Tools::getValue("prev_page") == "adminlist") { $editCompany = false; $editLanguage = false; $editRole = true; $roleList = array(4 => "Admin", 5 => "Super Admin"); } else { if (Tools::getValue("prev_page") == "agentlist" && self::$cookie->RoleID > 3) { $editRole = true; $roleList = array(2 => "Normal", 3 => "Admin"); $editPayment = true; } else { if (Tools::getValue("prev_page") == "hotellist" || self::$cookie->RoleID == 1 || Tools::getValue("mod") == "hotel") { $editPref = true; } } } if (self::$cookie->RoleID == 3 && Tools::getValue("mod") != "self") { $editCompany = false; $editDelete = true; } if (self::$cookie->RoleID == 2) { $editCompany = false; } if (self::$cookie->RoleID > 3 && Tools::getValue("prev_page") == "hotellist" && Tools::getValue("mid")) { $hotelinfo = HotelDetail::getHotelByUserId(Tools::getValue("mid")); $this->member->HotelCode = $hotelinfo['HotelCode']; $editHotel = true; } if (Tools::isSubmit('SubmitRegister')) { /** Company Create **/ if (Tools::isSubmit("agentID")) { $this->company->AgentID = Tools::getValue("agentID"); } $this->company->CompanyName = trim(Tools::getValue('companyName')); $this->company->CountryId = trim(Tools::getValue('countryId')); $this->company->City = trim(Tools::getValue('city')); $this->company->Address = trim(Tools::getValue('address')); $this->company->Website = trim(Tools::getValue('website')); $this->company->ManagingDirector = trim(Tools::getValue('managingDirector')); $this->company->Tel = trim(Tools::getValue('companyTel')); $this->company->Fax = trim(Tools::getValue('companyFax')); $this->company->ShouShu = trim(Tools::getValue('ShouShu')); $this->company->ShouShuType = trim(Tools::getValue('ShouShuType')); if ($editPayment) { $this->company->PaymentMethod = trim(Tools::getValue("paymentMethod")); } if ($editPref) { $this->company->PrefFax = trim(Tools::getValue("prefFax")) == "on" ? 1 : 0; $this->company->PrefEmail = trim(Tools::getValue("prefEmail")) == "on" ? 1 : 0; } if ($editCompany) { if (empty($this->company->CompanyName)) { $this->errors[] = Tools::displayError('Company Name required'); } if (empty($this->company->CountryId)) { $this->errors[] = Tools::displayError('Country required'); } if (empty($this->company->City)) { $this->errors[] = Tools::displayError('Company City required'); } if (empty($this->company->Website)) { $this->errors[] = Tools::displayError('Company Website required'); } if (empty($this->company->ManagingDirector)) { $this->errors[] = Tools::displayError('Managing Director required'); } if (empty($this->company->Tel)) { $this->errors[] = Tools::displayError('Company TEL required'); } elseif (!Validate::isPhoneNumber($this->company->Tel)) { $this->errors[] = Tools::displayError('Invalid Compnay TEL number'); } } /** Member Create **/ if ($this->member->UserID == 0) { $this->member->LoginUserName = trim(Tools::getValue('loginUserName')); } $this->member->Name = trim(Tools::getValue('name')); $password = trim(Tools::getValue('password')); $con_password = trim(Tools::getValue('con_password')); $this->member->Email = trim(Tools::getValue('email')); $this->member->Tel = trim(Tools::getValue('tel')); $this->member->LanguageID = trim(Tools::getValue('languageId')); $hotelCode = trim(Tools::getValue('HotelCode')); if ($editRole) { $this->member->RoleID = trim(Tools::getValue('roleId')); } else { if (self::$cookie->RoleID == 3 && $this->member->UserID == 0) { $this->member->RoleID = 2; $this->member->CompanyID = self::$cookie->CompanyID; $this->member->IsActive = 1; } } if (self::$cookie->RoleID > 3 && $this->member->RoleID > 3 && $this->member->UserID == 0) { $this->member->IsActive = 1; } if ($editDelete) { $this->member->IsDelete = trim(Tools::getValue('isDelete')); } if ($this->member->UserID == 0 && empty($this->member->LoginUserName)) { $this->errors[] = Tools::displayError('User ID required'); } if (empty($this->member->Name)) { $this->errors[] = Tools::displayError('Your Name is required'); } if ($this->member->UserID == 0 && empty($password)) { $this->errors[] = Tools::displayError('Password is required'); } else { if ($con_password != $password) { $this->errors[] = Tools::displayError('Password confirmation is not mismatch'); } elseif (Tools::strlen($passwd) > 32) { $this->errors[] = Tools::displayError('Password is too long'); } } if (empty($this->member->Email)) { $this->errors[] = Tools::displayError('Your Email is required'); } elseif (!Validate::isEmail($this->member->Email)) { $this->errors[] = Tools::displayError('Invalid Email Address'); } if ($editLanguage) { if (empty($this->member->Tel)) { $this->errors[] = Tools::displayError('Your TEL is required'); } elseif (!Validate::isPhoneNumber($this->member->Tel)) { $this->errors[] = Tools::displayError('Invalid TEL number'); } if (empty($this->member->LanguageID)) { $this->errors[] = Tools::displayError('Language is required'); } } if ($editHotel) { if (empty($hotelCode)) { $this->errors[] = Tools::displayError('Your HotelCode is required.'); } $hotelId = Member::checkHotelCodeUseful($hotelCode, $this->member->UserID); if (!$hotelId) { $this->errors[] = Tools::displayError('Invalid HotelCode number.'); } else { $this->member->HotelId = $hotelId; } } if (!sizeof($this->errors)) { // duplicate check user id if ($this->member->UserID == 0 && Member::isExistLoginUserName($this->member->LoginUserName) != false) { $this->errors[] = Tools::displayError('Duplicate Login ID.'); } else { if ($this->member->UserID == 0 && Member::isExistEmail($this->member->Email, 0) != false) { $this->errors[] = Tools::displayError('Duplicate User E-mail.'); } else { if ($editCompany) { if ($this->company->CompanyId > 0) { $regCompany = $this->company->update(); } else { $regCompany = $this->company->add(); } } if (!$editCompany || $editCompany && $regCompany) { if ($password != "") { $this->member->Password = $password; } if ($this->member->UserID > 0) { // check if one more agent admin user if (Tools::getValue("prev_page") == "agentlist" && $this->member->RoleID == 3) { $this->member->resetCompanyUser(); /*if ($this->member->isExistAgentAdmin() > 0) { $this->errors[] = Tools::displayError("There exist only one agent admin in a company"); }*/ } else { if (Tools::getValue("prev_page") == "agentlist" && $this->member->RoleID == 2) { if ($this->member->isExistAgentAdmin() == 0) { $this->errors[] = Tools::displayError("A company has a one agent admin."); } } } // check if there are any super admin user if (Tools::getValue("prev_page") == "adminlist" && $this->member->RoleID == 4) { if ($this->member->isExistSuperAdmin() == 0) { $this->errors[] = Tools::displayError("There must be existed one more Super Admin."); } } if (!sizeof($this->errors)) { $this->regSuccess = $this->member->update(); } if ($this->member->UserID == self::$cookie->UserID) { self::$cookie->Name = $this->member->Name; } } else { if ($editCompany) { $this->member->CompanyID = $this->company->id; } if (Tools::getValue("mod") == "agent") { $this->member->RoleID = 3; } else { if (Tools::getValue("mod") == "hotel") { $this->member->RoleID = 1; } } $this->regSuccess = $this->member->add(); // add hotel detail class if ($this->member->RoleID == 1) { if ($_POST['nohotel'] == 1) { $this->member->HotelId = $_POST['hotelid']; $this->member->update(); } else { $hotelDetail = new HotelDetail(); $hotelDetail->HotelName = $this->company->CompanyName; $hotelDetail->HotelCode = "_"; $hotelDetail->HotelClass = 0; $hotelDetail->HotelCity = 0; $hotelDetail->HotelArea = 0; $hotelDetail->add(true, false); $hotelDetail->HotelCode = "JP" . str_pad($hotelDetail->HotelId, 6, "0", STR_PAD_LEFT); $hotelDetail->update(false); $this->member->HotelId = $hotelDetail->HotelId; $this->member->update(); } } } if ($this->regSuccess && Tools::getValue("prev_page")) { Tools::redirect(Tools::getValue("prev_page") . ".php"); } if ($this->regSuccess && self::$cookie->UserID == 0) { // Send Email To User if ($this->member->LanguageID == 4) { $title = "<TAS Agent> ご登録ありがとうございます。"; $content = $this->member->Name . " 様<br/><br/>\n\t\t\t\t\t\t\t\tTAS Agentへの登録を頂きましてありがとうございます。<br/>\n\t\t\t\t\t\t\t\t審査後、改めてTAS Agent よりご連絡いたします。<br/><br/>\n\t\t\t\t\t\t\t\tTas-agent.com <br/>\n\t\t\t\t\t\t\t\tweb@tas-agent.com"; } else { $title = "<TAS Agent> Thank you very much for registration"; $content = "Dear " . $this->member->Name . " <br/><br/>\n\t\t\t\t\t\t\t\tThank you very much for registration.<br/>\n\t\t\t\t\t\t\t\tWe will get back to you soon for your account information. <br/><br/>\n\t\t\t\t\t\t\t\tTas-agent.com <br/>\n\t\t\t\t\t\t\t\tweb@tas-agent.com"; } //$headers = 'From: web@tas-agent.com'."\r\n"; //$headers .= 'MIME-Version: 1.0'."\r\n"; //$headers .= 'Content-Type: text/html; charset=utf-8'."\r\n"; //mail($this->member->Email, $title, $content, $headers); Tools::sendEmail($this->member->Email, $title, $content); } } else { $this->errors[] = Tools::displayError('Error in update company.'); } } } //if (!$authentication OR !$member->UserID) //{ /* Handle brute force attacks */ /* sleep(1); $this->errors[] = Tools::displayError('Login failed'); } else { self::$cookie->UserID = (int)($member->UserID); self::$cookie->LoginUserName = $member->LoginUserName; self::$cookie->logged = 1; self::$cookie->Password = $member->Password; self::$cookie->Email = $member->Email; self::$cookie->LanguageID = $member->LanguageID; self::$cookie->RoleID = $member->RoleID; Tools::redirect('index.php'); }*/ } } self::$smarty->assign(array('languages' => Tools::getLanguages(), 'sl_lang' => self::$cookie->LanguageID, 'countries' => Tools::getCountries(), 'reg_success' => $this->regSuccess, 'member' => $this->member, 'company' => $this->company, 'mid' => Tools::getValue("mid"), 'prev_page' => Tools::getValue("prev_page"), 'editCompany' => $editCompany, 'editLanguage' => $editLanguage, 'myinfo' => $myinfo, 'editRole' => $editRole, 'roleList' => $roleList, 'mod' => Tools::getValue("mod"), 'editDelete' => $editDelete, 'editPayment' => $editPayment, 'editPref' => $editPref, 'editHotel' => $editHotel)); }
public static function getHotelByAreaCity($search_form, $p, $n, $iso = "") { global $cookie; if ($iso == "") { $iso = Language::getIsoById((int) $cookie->LanguageID); } $areaid = $search_form['AreaId']; $cityid = $search_form['CityId']; $hotelclass = $search_form['HotelClassId']; $hotelname = $search_form['HotelName']; $sql = ' SELECT A.HotelId, A.HotelName_' . $iso . ' as HotelName, A.HotelClass, B.`HotelClassName`, A.HotelAddress_' . $iso . ' as HotelAddress, A.`HotelCity`, D.`CityName_' . $iso . '` as CityName, A.HotelArea, C.`AreaName_' . $iso . '` as AreaName, A.HotelDescription_' . $iso . ' as HotelDescription FROM HT_Hotel as A LEFT JOIN (`HT_HotelClass` as B, HT_Area as C, HT_City as D) ON (A.`HotelClass` = B.`HotelClassId` AND A.`HotelArea` = C.`AreaId` AND A.`HotelCity` = D.CityId) '; if ($cityid == 0 && $areaid == 0) { $sql .= 'WHERE A.`HotelArea` >0 '; } else { $sql .= 'WHERE A.`HotelArea` = ' . $areaid; $sql .= $cityid != 0 ? ' AND `HotelCity` = ' . $cityid : ''; $sql .= $hotelclass != 0 ? ' AND `HotelClass` = ' . $hotelclass : ''; } $sql .= $hotelname != "" ? " AND `HotelName_{$iso}` like '%{$hotelname}%' " : ''; $sql .= ' LIMIT ' . ($p - 1) * $n . ',' . $n; $res = Db::getInstance()->ExecuteS($sql); if (!$res) { return null; } $search_result = array(); foreach ($res as $hotel_roomplan) { $hotel_id = $hotel_roomplan['HotelId']; $search_record = array(); if (array_key_exists($hotel_id, $search_result)) { $search_record = $search_result[$hotel_id]; } else { $search_record = Tools::element_copy($hotel_roomplan, 'HotelId', 'HotelName', 'HotelClass', 'HotelClassName', 'HotelAddress', 'HotelCity', 'CityName', 'HotelArea', 'AreaName', 'HotelDescription'); $image = HotelDetail::getFirstFileOfHotel($search_record['HotelId']); $search_record['HotelFilePath'] = $image['HotelFilePath']; $search_record['w5_path'] = $image['w5_path']; $search_record['w5'] = $image['w5']; $search_record['h5'] = $image['h5']; } $search_result[$hotel_id] = $search_record; } return $search_result; }