function display($tpl = null) { global $option, $mainframe; $model =& $this->getModel(); $menu =& JMenu::getInstance('site'); $item = $menu->getActive(); $params =& $menu->getParams($item->id); //get controller $controller = new VnffhotelController(); $cityid = $params->get('cityid', '1'); $cityid = JRequest::getVar('cityid', $cityid); //if($cityid==1) $hotels = $model->getHotelsByCity($cityid); $pagination = $model->getPagination(); for ($i = 0; $i < count($hotels); $i++) { $hotels[$i]->images = $model->getHotelImages($hotels[$i]->hotel_ID, 'm'); if (count($hotels[$i]->images) == 0) { $image->image_Name = "noimage.png"; $hotels[$i]->images[0] = $image; } $hotels[$i]->shortDes = $controller->cutDes($hotels[$i]->Overview, 30); $hotels[$i]->linkToHotel = $controller->linkToHotel($hotels[$i]->hotel_ID); } //get controller $mainframe->setPageTitle(JTEXT::_("HOTELS IN") . " " . $hotels[0]->city_Name); //echo $hotels[0]->images[0]->image_Name; //echo $hotels[0]->city_ID."hehehejhe"; $this->assignRef('hotels', $hotels); $this->assignRef('pagination', $pagination); $this->assignRef('controller', $controller); //echo $this->cutDes("thang nay khung qua di thoi"); parent::display($tpl); }
function display($tpl = null) { global $option, $mainframe; $model =& $this->getModel(); //$menu =& JMenu::getInstance('site'); // $item = $menu->getActive(); // $params =& $menu->getParams($item->id); //get controller $controller = new VnffhotelController(); //echo substr("h_sdfsdf_sfssf", -3); $mainframe->setPageTitle(JTEXT::_("PROMOTIONS LIST")); //$cityid = $params->get('cityid', '32'); $hotels = $model->getHotelsPromotion(); $pagination = $model->getPagination(); for ($i = 0; $i < count($hotels); $i++) { $hotels[$i]->images = $model->getHotelImages($hotels[$i]->hotel_ID, 'm'); if (count($hotels[$i]->images) == 0) { $image->image_Name = "noimage.png"; $hotels[$i]->images[0] = $image; } $hotels[$i]->shortDes = $controller->cutDes($hotels[$i]->Overview, 30); $hotels[$i]->linkToHotel = $controller->linkToHotel($hotels[$i]->hotel_ID, "4"); } //get controller //echo $hotels[0]->images[0]->image_Name; //echo $hotels[0]->city_ID."hehehejhe"; $this->assignRef('hotels', $hotels); $this->assignRef('pagination', $pagination); $this->assignRef('controller', $controller); //echo $this->cutDes("thang nay khung qua di thoi"); parent::display($tpl); }
function VnffhotelBuildRoute(&$query) { $segments = array(); if ($query['view'] == 'hotel') { //$segments[0] = $query['view']; unset($query['view']); //get controller $controller = new VnffhotelController(); $hotel_name = $controller->getHotelName($query['hid']); $hotel_name = explode(" ", $hotel_name); $hotel_name = implode("_", $hotel_name); $segments[0] = "h_" . $hotel_name . "_" . $query['hid']; unset($query['hid']); $segments[1] = $query['stab']; unset($query['stab']); } else { if ($query['view'] == 'home') { $segments[0] = $query['view']; unset($query['view']); } else { if ($query['view'] == 'city') { //$segments[0] = $query['view']; unset($query['view']); //get controller $controller = new VnffhotelController(); $city_name = $controller->getCityName($query['cityid']); $city_name = explode(" ", $city_name); $city_name = implode("_", $city_name); $segments[0] = "c_hotels_in_" . $city_name . "_" . $query['cityid']; unset($query['cityid']); } else { if ($query['view'] == 'promotion') { $segments[0] = 'hotels_with_promotion'; unset($query['view']); } } } } return $segments; }
function display($tpl = null) { global $option, $mainframe; $model =& $this->getModel(); $menu =& JMenu::getInstance('site'); $item = $menu->getActive(); $params =& $menu->getParams($item->id); //get controller $controller = new VnffhotelController(); $hotel_keywords = JRequest::getVar('hotel_keywords', ''); $destination = JRequest::getVar('destination', '-1'); $stars = JRequest::getVar('stars', '-1'); $prices = JRequest::getVar('prices', '0_9999'); //$cityid = $params->get('cityid', '32'); $hotels = $model->getHotels($hotel_keywords, $destination, $stars, $prices); $pagination = $model->getPagination(); $cities = $model->getCities(); $mainframe->setPageTitle(JTEXT::_("SEARCH")); for ($i = 0; $i < count($hotels); $i++) { $hotels[$i]->images = $model->getHotelImages($hotels[$i]->hotel_ID, 'm'); if (count($hotels[$i]->images) == 0) { $image->image_Name = "noimage.png"; $hotels[$i]->images[0] = $image; } $hotels[$i]->shortDes = $controller->cutDes($hotels[$i]->Overview, 30); $hotels[$i]->linkToHotel = $controller->linkToHotel($hotels[$i]->hotel_ID); $hotels[$i]->hotel_Name = str_ireplace($hotel_keywords, '<span id="hightlight" >' . $hotel_keywords . '</span>', $hotels[$i]->hotel_Name); } //echo $hotels[0]->images[0]->image_Name; //echo $hotels[0]->city_ID."hehehejhe"; $this->assignRef('hotels', $hotels); $this->assignRef('cities', $cities); $this->assignRef('pagination', $pagination); $this->assignRef('controller', $controller); //echo $this->cutDes("thang nay khung qua di thoi"); parent::display($tpl); }
<?php //O day chi xu ly de lien ket cac file trong com, khong can chinh code day. defined('_JEXEC') or die('Restricted access'); require_once JApplicationHelper::getPath('admin_html'); require_once JPATH_COMPONENT . DS . 'controller.php'; JTable::addIncludePath(JPATH_COMPONENT . DS . 'tables'); $controller = new VnffhotelController(array('default_task' => 'showHotel')); $controller->execute(JRequest::getVar('task')); $controller->redirect();
function display($tpl = null) { global $option, $mainframe; $func = JRequest::getVar('func', ''); if ($func == 'photoAlbum') { $this->photoAlbum(); return; } $model =& $this->getModel(); $today = getdate(); $next2day = getdate(($today["0"] / (60 * 60 * 24) + 2) * (60 * 60 * 24)); //echo $next2day["mday"]; $hid = JRequest::getVar('hid', ''); $checkin_date = JRequest::getVar('checkin_date', $today["mday"] . '/' . $today["mon"] . '/' . $today["year"]); $checkout_date = JRequest::getVar('checkout_date', $next2day["mday"] . '/' . $next2day["mon"] . '/' . $next2day["year"]); //echo $checkin_date . $checkout_date; //get controller $controller = new VnffhotelController(); $checkin_date_r = explode('/', $checkin_date); $checkout_date_r = explode('/', $checkout_date); $day_count = round((-mktime(0, 0, 0, $checkin_date_r[1], $checkin_date_r[0], $checkin_date_r[2]) + mktime(0, 0, 0, $checkout_date_r[1], $checkout_date_r[0], $checkout_date_r[2])) / (60 * 60 * 24), 0); //echo $day_count; if ($day_count < 1) { $checkin_date = $today["mday"] . '/' . $today["mon"] . '/' . $today["year"]; $checkout_date = $next2day["mday"] . '/' . $next2day["mon"] . '/' . $next2day["year"]; $checkin_date_r = explode('/', $checkin_date); $checkout_date_r = explode('/', $checkout_date); $day_count = 2; echo '<div class="wrong_date">' . JTEXT::_("WRONG SELECTED DATE") . '</div>'; } $checkin_datez = getdate(mktime(0, 0, 0, $checkin_date_r[1], $checkin_date_r[0], $checkin_date_r[2])); $ratesAll = $model->getRatesAll($hid); //echo $ratesAll[0]->room_Name; //echo $checkout_date; ?> <table cellspacing="0" cellpadding="0" border="0" style="width: 100%;" id="Default1_Rates1_tblRate"> <tbody> <tr> <td style="border-bottom: solid 2px #aed0ea;"> <table cellspacing="0" cellpadding="0" border="0" style="width: 100%;"> <tbody> <tr> <td colspan="1" style="padding-top: 20px;"> </td> </tr> <tr> <td style="height: 15px;min-width: 130px;"></td> <td class="ui-state-default ui-corner-top" colspan="<?php echo $day_count; ?> " width="70%"></td> <td style="min-width: 100px;"></td> </tr> <tr> <td valign="middle" nowrap="" style="padding: 0px 5px 0px 10px; background-image: url(/Images/hp.tl.gif); background-repeat: no-repeat; background-position: left top; background-color: #aed0ea;"> <span style="font-family: Arial; font-size: 12px; font-weight: bold;"> <?php echo JTEXT::_("ROOM DESCRIPTION"); ?> </span> </td> <?php for ($i = 0; $i < $day_count; $i++) { $date = getdate($checkin_datez["0"] + $i * (60 * 60 * 24)); ?> <td valign="middle" align="center" style="border: 1px solid #aed0ea; width: 100px; padding-bottom: 8px; padding-top: 8px; background-color: White;"> <span style="font-family: Arial; font-size: 11px;"> <b><?php echo JTEXT::_(strtoupper($date["weekday"])); ?> </b><br/><?php echo $date["mday"] . '/' . $date["mon"]; ?> </span></td> <?php } ?> <td style="background-image: url(/Images/hp.tr.gif); background-repeat: no-repeat; background-position: right top; background-color: #aed0ea;"> </td> </tr> <?php for ($n = 0; $n < count($ratesAll); $n++) { ?> <tr> <td valign="middle" style="border-top: 1px solid #aed0ea; border-left: 1px solid #aed0ea; background-color: White; padding-left: 5px;"> <strong> <?php echo $ratesAll[$n]->room_Name; ?> </strong> </td> <?php for ($i = 0; $i < $day_count; $i++) { $date = getdate($checkin_datez["0"] + $i * (60 * 60 * 24)); ?> <td valign="middle" nowrap="nowrap" align="center" style="border-top: 1px solid #aed0ea; border-left: 1px solid #aed0ea; border-right: 1px solid #aed0ea; height: 40px; background-color: White;"> <span style="font-family: Arial; font-size: 14px; font-weight: bold; color: rgb(251, 110, 16);"> $<?php echo $ratesAll[$n]->price; ?> </span> </td> <?php } ?> <td valign="middle" align="center" width="84px" style="border-top: 1px solid #aed0ea; border-right: 1px solid #aed0ea; padding-right: 10px; padding-left: 10px;"> <a class="ui-state-default ui-corner-all" id="button" href="<?php echo $controller->linkToBookHotel($hid, $checkin_date, $checkout_date, $ratesAll[$n]->room_ID); ?> " style="font-size: 11px;float:left;padding: 2px;margin-top: 0px;">» <?php echo JTEXT::_("BOOK NOW"); ?> </a> </td> </tr> <?php } ?> </tbody></table> </td> </tr> </tbody> </table> <?php }