function getAllExcursions()
 {
     $userData = $_SESSION['userData'];
     $orderBy = "";
     $this->searchParams = array();
     $this->searchParams["orderBy"] = $userData->orderBy;
     $this->searchParams["keyword"] = $userData->keyword;
     $this->searchParams["orderBy"] = $userData->orderBy;
     $this->searchParams["adults"] = $userData->adults;
     $this->searchParams["startDate"] = $userData->start_date;
     $this->searchParams["endDate"] = $userData->end_date;
     $this->searchParams["languageTag"] = JRequest::getVar('_lang');
     $this->searchParams["city"] = JRequest::getVar('city');
     $this->searchParams["showAll"] = JRequest::getVar('showAll');
     $this->searchParams["adults"] = $userData->adults;
     $this->searchParams["children"] = $userData->children;
     $this->searchParams["type"] = JRequest::getVar('jhotelreservation_type');
     $orderByPrice = false;
     if ($userData->orderBy == 'lowest_hotel_price asc' || $userData->orderBy == 'starting_price_offers asc') {
         $orderByPrice = true;
     }
     if (!isset($userData->noDates)) {
         $userData->noDates = 0;
     }
     $this->searchParams["no-dates"] = $userData->noDates;
     $excursions = ExcursionsService::getHotelExcursions(HOTEL_EXCURSIONS, -1, $userData->start_date, $userData->end_date, null, null, $userData->adults, $userData->children);
     $this->_total = count($excursions);
     if (count($excursions)) {
         UserDataService::setCurrency($excursions[0]->country_currency_short, $excursions[0]->country_currency);
     }
     return $excursions;
 }
Esempio n. 2
0
 function getOffers()
 {
     $userData = UserDataService::getUserData();
     $offers = HotelService::getHotelOffers($this->getState('hotel.id'), $userData->start_date, $userData->end_date, array(), $userData->adults, $userData->children);
     BookingService::setRoomAvailability($offers, $userData->reservedItems, $this->getState('hotel.id'), $userData->start_date, $userData->end_date);
     return $offers;
 }
Esempio n. 3
0
 function searchHotels()
 {
     //initialize search criteria
     UserDataService::initializeUserData();
     //remove user data
     JRequest::setVar("view", "hotels");
     parent::display();
 }
 public function profile()
 {
     $content = UserDataService::getUserInfo($this->getUserId());
     if (isset($content[0])) {
         $profile = $this->view->render(VIEW_DIR . "templates/Users/view-profile.html", $content[0]);
     }
     $this->setContent($profile);
 }
Esempio n. 5
0
 function searchRooms()
 {
     //initialize search criteria
     UserDataService::initializeUserData();
     //remove user data
     JRequest::setVar("view", "roomlisting");
     parent::display();
 }
Esempio n. 6
0
 public function getExtraOptions()
 {
     $userData = UserDataService::getUserData();
     $roomReserved = $userData->reservedItems[count($userData->reservedItems) - 1];
     $roomReservedInfo = explode("|", $roomReserved);
     //dmp($userData);
     $extraOptions = ExtraOptionsService::getHotelExtraOptions($userData->hotelId, $userData->start_date, $userData->end_date, array(), $roomReservedInfo[1], $roomReservedInfo[0]);
     return $extraOptions;
 }
Esempio n. 7
0
 function editaccount()
 {
     $model = $this->getModel();
     $userData = UserDataService::getUserData();
     $personalData = $model->getClientData();
     $this->row = $personalData;
     $tpl = 'editaccount';
     return $tpl;
 }
Esempio n. 8
0
 function display($tpl = null)
 {
     $this->extraOptions = $this->get("ExtraOptions");
     $this->state = $this->get('State');
     $this->userData = UserDataService::getUserData();
     $this->hotel = HotelService::getHotel($this->userData->hotelId);
     $this->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
     //dmp($this->userData);
     parent::display($tpl);
 }
 function reserveCourses()
 {
     $data = JRequest::get("post");
     if (isset($data["excursions"])) {
         $reservedItem = UserDataService::addExcursions($data["excursions"]);
     }
     if ($data["excursionRedirect"] == 1) {
         $this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&task=hotels.searchHotels', false));
     } else {
         $this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&task=excursionslisting.searchExcursions&excursion_type=excursions&excursionRedirect=1', false));
     }
 }
Esempio n. 10
0
 function back()
 {
     UserDataService::removeLastRoom();
     $userData = UserDataService::getUserData();
     if ($userData->hotelId > 0) {
         $hotel = HotelService::getHotel($userData->hotelId);
         $link = JHotelUtil::getHotelLink($hotel);
     } else {
         $link = JRoute::_('index.php?option=com_jhotelreservation&task=excursionslisting.searchExcursions', false);
         UserDataService::initializeExcursions();
     }
     $this->setRedirect($link);
 }
Esempio n. 11
0
 function getReservationDetails()
 {
     $userData = UserDataService::getUserData();
     $reservationData = new stdClass();
     $reservationData->userData = $userData;
     $reservationData->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
     $reservationData->hotel = HotelService::getHotel($userData->hotelId);
     $reservationService = new ReservationService();
     $reservationDetails = $reservationService->generateReservationSummary($reservationData);
     UserDataService::setReservationDetails($reservationDetails);
     $reservationDetails->reservationData = $reservationData;
     return $reservationDetails;
 }
Esempio n. 12
0
 function reserveRoom()
 {
     $data = JRequest::get("post");
     $reservedItems = JRequest::getVar("reservedItems");
     $extraOptions = JRequest::getVar("extraOptions");
     $reservedItem = UserDataService::reserveRoom($data["hotel_id"], $data["reserved_item"], $data["current"]);
     $reservedItems = empty($reservedItems) ? $reservedItem : $reservedItems . "||" . $reservedItem;
     $extraParam = "";
     if (!empty($extraOptions)) {
         $extraParam = "&extraOptions=" . $extraOptions;
     }
     $current = count(explode('#', $reservedItems));
     $this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&task=extraoptions.showExtras&hotelId=' . $data["hotel_id"] . '&current=' . $current . '&reservedItems=' . $reservedItems . $extraParam, false));
 }
Esempio n. 13
0
 function display($tpl = null)
 {
     $this->hotel = $this->get("Item");
     $this->state = $this->get('State');
     $this->offers = $this->get("Offers");
     $this->rooms = $this->get("Rooms");
     $this->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
     if ($this->appSettings->is_enable_reservation == 0) {
         JHotelUtil::getInstance()->showUnavailable();
     }
     $this->userData = UserDataService::getUserData();
     $this->currencies = CurrencyService::getAllCurrencies();
     //dmp($this->userData);
     parent::display($tpl);
 }
Esempio n. 14
0
 function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->reservationDetails = $this->get("ReservationDetails");
     $this->paymentMethods = $this->get('paymentMethods');
     $this->guestTypes = JHotelReservationHelper::getGuestTypes();
     $this->userData = UserDataService::getUserData();
     $this->hotel = HotelService::getHotel($this->userData->hotelId);
     $this->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
     $doc = JFactory::getDocument();
     $tag = JHotelUtil::getJoomlaLanguage();
     $doc->addStyleSheet('administrator/components/' . getBookingExtName() . '/assets/js/validation/css/validationEngine.jquery.css');
     $doc->addScript('administrator/components/' . getBookingExtName() . '/assets/js/validation/js/languages/jquery.validationEngine-' . $tag . '.js');
     $doc->addScript('administrator/components/' . getBookingExtName() . '/assets/js/validation/js/jquery.validationEngine.js');
     parent::display($tpl);
 }
Esempio n. 15
0
 public static function getNumberOfBookingsPerDay($hoteId, $startDate, $endDate, $reservationId = null)
 {
     $reservedRooms = array();
     $bookedRooms = array();
     $db = JFactory::getDBO();
     $reservationFilter = "";
     if (isset($reservationId) && $reservationId > 0) {
         //exclude the current reservation
         $reservationFilter = "and c.confirmation_id <> {$reservationId}";
         //build count of rooms added to reservation
         $reservedItems = UserDataService::getUserData()->reservedItems;
         $bookedRooms = self::getReservationBookedRooms($reservedItems);
     }
     $query = "select hcr.room_id, c.start_date, c.end_date\r\n\t\t\t\t\tfrom #__hotelreservation_confirmations_rooms hcr\r\n\t\t\t\t\tleft join #__hotelreservation_confirmations c on c.confirmation_id= hcr.confirmation_id\r\n\t\t\t\t\twhere (c.start_date <'{$endDate}' and c.end_date >='{$startDate}') \r\n\t\t\t\t\t\tand c.reservation_status <> " . CANCELED_ID . " \r\n\t\t\t\t\t\t{$reservationFilter}\r\n\t\t\t\t\t\tand c.hotel_id = {$hoteId}";
     //echo $query;
     $db->setQuery($query);
     $reservationInfos = $db->loadObjectList();
     //dmp($bookedRooms);
     for ($d = strtotime($startDate); $d <= strtotime($endDate);) {
         $dayString = date("Y-m-d", $d);
         foreach ($reservationInfos as $reservationInfo) {
             if (strtotime($reservationInfo->start_date) == $d || $d < strtotime($reservationInfo->end_date) && $d > strtotime($reservationInfo->start_date)) {
                 if (!isset($reservedRooms[$reservationInfo->room_id]) || !isset($reservedRooms[$reservationInfo->room_id][$dayString])) {
                     $reservedRooms[$reservationInfo->room_id][$dayString] = 0;
                 }
                 $reservedRooms[$reservationInfo->room_id][$dayString] = $reservedRooms[$reservationInfo->room_id][$dayString] + 1;
             }
         }
         //add to the total booked the number of added rooms
         if (count($bookedRooms)) {
             foreach ($bookedRooms as $key => $bookedRoom) {
                 if (!isset($reservedRooms[$key][$dayString])) {
                     $reservedRooms[$key][$dayString] = 0;
                 }
                 $reservedRooms[$key][$dayString] += $bookedRoom;
             }
         }
         $d = strtotime(date('Y-m-d', $d) . ' + 1 day ');
     }
     //dmp($reservedRooms);exit;
     return $reservedRooms;
 }
Esempio n. 16
0
 function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->countries = $this->get('Countries');
     $this->guestTypes = JHotelReservationHelper::getGuestTypes();
     $this->userData = UserDataService::getUserData();
     $this->hotel = HotelService::getHotel($this->userData->hotelId);
     $this->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
     if ($this->appSettings->save_all_guests_data) {
         UserDataService::prepareGuestDetails();
     }
     $hotelId = JRequest::getVar("hotel_id");
     $reservedItems = JRequest::getVar("reservedItems");
     if (!empty($reservedItems)) {
         UserDataService::updateRooms($hotelId, $reservedItems);
     }
     $this->reservationDetails = $this->get("ReservationDetails");
     $this->showDiscounts = true;
     parent::display($tpl);
 }
Esempio n. 17
0
 function getReservationDetails($data)
 {
     $userData = $this->populateReservationDetails($data);
     //dmp($userData);
     $reservationData = new stdClass();
     $reservationData->userData = $userData;
     $reservationData->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
     $reservationData->hotel = HotelService::getHotel($userData->hotelId);
     UserDataService::setReservedItems($userData->reservedItems);
     $reservationService = new ReservationService();
     $reservationDetails = $reservationService->generateReservationSummary($reservationData, false);
     $reservationDetails->reservationData = $reservationData;
     UserDataService::setReservationDetails($reservationDetails);
     return $reservationDetails;
 }
 function back()
 {
     UserDataService::removeLastRoom();
     $userData = UserDataService::getUserData();
     $hotel = HotelService::getHotel($userData->hotelId);
     $link = JHotelUtil::getHotelLink($hotel);
     $this->setRedirect($link);
 }
/**
 * @copyright	Copyright (C) 2008-2009 CMSJunkie. All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
JHTML::_('stylesheet', 'modules/mod_jreservationinfo/assets/css/style.css');
require_once JPATH_SITE . '/administrator/components/com_jhotelreservation/helpers/defines.php';
require_once JPATH_SITE . '/administrator/components/com_jhotelreservation/helpers/utils.php';
// Include the syndicate functions only once
require_once dirname(__FILE__) . DS . 'helper.php';
$userData = UserDataService::getUserData();
$hotel = HotelService::getHotel($userData->hotelId);
$reservationData = new stdClass();
$reservationData->userData = $userData;
$reservationData->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
$reservationData->hotel = $hotel;
$reservationService = new ReservationService();
$reservationDetails = $reservationService->generateReservationSummary($reservationData);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
require JModuleHelper::getLayoutPath('mod_jreservationinfo', $params->get('layout', 'default'));
 function getReservation($reservationId = null, $hotelId = null, $checkAvailability = true)
 {
     if (!isset($reservationId)) {
         $reservationId = JRequest::getInt("reservationId");
     }
     $confirmationTable = JTable::getInstance('Confirmations', 'Table', array());
     $reservation = $confirmationTable->getReservationData($reservationId);
     if (!$reservationId) {
         $reservation = UserDataService::createUserData(array());
         $reservation->hotelId = $hotelId;
     } else {
         $reservation->reservedItems = explode(",", $reservation->items_reserved);
         $reservation->extraOptionIds = explode(",", $reservation->extraOptionIds);
         $reservation->hotelId = $reservation->hotel_id;
         $reservation->guestDetails = $this->prepareGuestDetails($reservation->guestDetails);
         $reservation->roomGuests = explode(",", $reservation->total_adults);
         $reservation->total_adults = 0;
         if (isset($reservation->roomGuests) && count($reservation->roomGuests) >= 1) {
             foreach ($reservation->roomGuests as $guestPerRoom) {
                 $values = explode("|", $guestPerRoom);
                 $reservation->total_adults += $values[0];
             }
         }
         $reservation->roomGuestsChildren = explode(",", $reservation->children);
         $reservation->total_children = 0;
         if (isset($reservation->roomGuestsChildren) && count($reservation->roomGuestsChildren) >= 1) {
             foreach ($reservation->roomGuestsChildren as $guestPerRoom) {
                 $values = explode("|", $guestPerRoom);
                 $reservation->total_children += $values[0];
             }
         }
     }
     //dmp($reservation->total_adults);
     //dmp($reservation->roomGuests);
     //dmp($reservation);
     if (!isset($reservation->totalPaid)) {
         $reservation->totalPaid = 0;
     }
     $hotel = HotelService::getHotel($reservation->hotelId);
     $reservation->currency = HotelService::getHotelCurrency($hotel);
     $reservationData = new stdClass();
     $reservationData->userData = $reservation;
     $reservationData->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
     $reservationData->hotel = $hotel;
     $extraOptionIds = isset($reservationData->userData->extraOptionIds) ? $reservationData->userData->extraOptionIds : null;
     $extraOptions = array();
     if (is_array($extraOptionIds) && count($extraOptionIds) > 0) {
         foreach ($extraOptionIds as $key => $value) {
             if (strlen($value) > 1) {
                 $extraOption = explode("|", $value);
                 $extraOptions[$key] = $extraOption;
             }
         }
     }
     //dmp($_SESSION["extras"]);
     $reservationData->extraOptions = ExtraOptionsService::getHotelExtraOptions($reservationData->userData->hotelId, $reservationData->userData->start_date, $reservationData->userData->end_date, $_SESSION["extras"], 0, 0, false);
     $reservationDetails = new stdClass();
     if ($reservationId) {
         $reservationDetails = $this->generateReservationSummary($reservationData, $checkAvailability);
     }
     $reservationDetails->reservationData = $reservationData;
     $reservationDetails->billingInformation = $this->getBillingInformation($reservationData->userData, $reservationData->appSettings->hide_user_email);
     $reservationDetails->confirmation_id = $reservation->confirmation_id;
     $paymentDetails = PaymentService::getConfirmationPaymentDetails($reservation->confirmation_id);
     if (isset($paymentDetails) && $paymentDetails->confirmation_id != 0) {
         $reservationDetails->paymentInformation = $this->getPaymentInformation($paymentDetails, $reservationDetails->total, $reservationDetails->cost);
     }
     //dmp($reservationDetails);
     return $reservationDetails;
 }
Esempio n. 21
0
                }
                ?>
											</select>
										<?php 
            }
        }
        ?>
										<br/>
										<?php 
        if ($item->is_per_day == 1 || $item->is_per_day == 2) {
            ?>
											<?php 
            echo $item->is_per_day == 1 ? JText::_('LNG_NUMBER_OF_DAYS', true) : JText::_('LNG_NUMBER_OF_NIGHTS', true);
            ?>
											<?php 
            $nrDays = UserDataService::getNrDays();
            ?>
											<select id="days-<?php 
            echo $item->id;
            ?>
" name="extra-option-days-<?php 
            echo $item->id;
            ?>
" onchange="upateExtraOption()"  <?php 
            echo $item->map_per_length_of_stay == 1 ? 'onfocus="this.oldvalue=this.value;this.blur();" onchange="this.value=this.oldvalue;"' : '';
            ?>
 >
												<?php 
            for ($i = 1; $i < 21; $i++) {
                ?>
													<option value="<?php 
}
$menuId = $session->get('menuId');
if (!empty($appSettings->menu_id) && ($menuId == $menu->getDefault() || empty($menuId))) {
    $menuId = $appSettings->menu_id;
}
if (!empty($menuId)) {
    JFactory::getApplication()->getMenu()->setActive($menuId);
}
$task = JRequest::getCmd('task');
$task = trim($task);
$view = JRequest::getCmd('view');
$view = trim($view);
if (empty($task) && empty($view)) {
    return;
}
//$log = Logger::getInstance(JPATH_COMPONENT."/logs/site-log-".date("d-m-Y").'.log',1);
//$log->LogDebug("-------Start execution--------task: ".$task."--------view:".$view);
JHotelUtil::loadSiteLanguage();
JHotelUtil::loadClasses();
if ($task != "hotel.getRoomCalendars" && $task != "hotel.checkReservationPendingPayments") {
    UserDataService::initializeUserData();
}
if (strpos($_SERVER['REQUEST_URI'], "buckarooautomaticresponse")) {
    $task = "paymentoptions.processAutomaticResponse";
    JRequest::setVar('task', $task);
    JRequest::setVar('processor', "buckaroo");
}
//$log->LogDebug($task);
$controller = JControllerLegacy::getInstance('JHotelReservation');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
Esempio n. 23
0
 function getCourses()
 {
     $userData = UserDataService::getUserData();
     $excursions = ExcursionsService::getHotelExcursions(HOTEL_COURSES, $this->getState('hotel.id'), $userData->start_date, $userData->end_date, array(), $userData->adults, $userData->children);
     return $excursions;
 }
Esempio n. 24
0
 public function viewLoanSubsidiary($loanno)
 {
     $data = UserDataService::getLoanSubsidiary($loanno);
     $tpl = VIEW_DIR . "templates/Loans/view-subsidiary-loan.php";
     return require_once $tpl;
 }