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());
 }
Example #2
0
<?php

/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2012 PrestaShop SA
*  @version  Release: $Revision: 14007 $
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
$controller = new FrontController();
$controller->pagination();
 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 hookProductTabContent($params)
 {
     global $smarty, $cookie, $link, $isBetaUser;
     $id_guest = !($id_customer = (int) $cookie->id_customer) ? (int) $cookie->id_guest : false;
     $customerComment = ProductComment::getByCustomer((int) Tools::getValue('id_product'), (int) $cookie->id_customer, true, (int) $id_guest);
     $averages = ProductComment::getAveragesByProduct((int) Tools::getValue('id_product'), (int) $cookie->id_lang);
     $averageTotal = 0;
     foreach ($averages as $average) {
         $averageTotal += (double) $average;
     }
     $averageTotal = count($averages) ? $averageTotal / count($averages) : 0;
     //'too_early' => ($customerComment AND (strtotime($customerComment['date_add']) + Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME')) > time()),
     $too_early = $customerComment;
     $smarty->assign(array('logged' => (int) $cookie->id_customer, 'action_url' => '', 'comments' => ProductComment::getByProduct((int) Tools::getValue('id_product')), 'criterions' => ProductCommentCriterion::getByProduct((int) Tools::getValue('id_product'), (int) $cookie->id_lang), 'averages' => $averages, 'product_comment_path' => $this->_path, 'averageTotal' => $averageTotal, 'allow_guests' => (int) Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'), 'too_early' => $too_early, 'delay' => Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME')));
     $controller = new FrontController();
     $controller->pagination((int) ProductComment::getCommentNumber((int) Tools::getValue('id_product')));
     if ($isBetaUser) {
         return $this->display(__FILE__, 'beta/productcomments.tpl');
     } else {
         return $this->display(__FILE__, '/productcomments.tpl');
     }
 }