Example #1
0
 /**
  * Get the hotel data
  */
 public function getPromo()
 {
     // determine hotel
     $hotel_id = $this->getHotelId();
     // get the vars
     @(list($type_id, $slug) = explode('-', CHLib::input()->getString('id'), 2));
     @(list($type, $promo_id) = explode(':', $type_id));
     // check vars
     if (!$type || !$slug || !$hotel_id || !$promo_id) {
         throw new Exception(CHClient::string('error_bad_request'), 404);
     }
     // check type
     if (!in_array($type, ['discount', 'extra', 'pack'])) {
         throw new Exception(CHClient::string('error_bad_request'), 404);
     }
     // get the hotel
     $hotel = parent::getHotel($hotel_id);
     if (!$hotel) {
         throw new Exception(CHClient::string('error_resource_not_found'), 404);
     }
     // promo type array
     $type_array = $type . 's';
     $promo = CHLibData::getObjectFromList($hotel->{$type_array}, $promo_id, 'id');
     $promo->promo_type = $type;
     return $promo;
 }
Example #2
0
 /**
  * Display the view
  */
 function display($cachable = false, $urlparams = false)
 {
     // set default view
     CHLib::input()->set('view', CHLib::input()->get('view', 'body'));
     // display
     parent::display($cachable, $urlparams);
 }
Example #3
0
 /**
  * Display
  */
 public function display($tpl = null)
 {
     // get the hotel
     $this->hotel = $this->get('Hotel');
     $this->calendar = $this->get('Calendar');
     $this->room = CHLib::input()->getInt('room_id');
     // ajax update month
     if ($this->isRaw()) {
         $tpl = 'month';
     }
     // check availability
     if (isset($this->calendar->errors)) {
         // load hotel
         $this->setLayout('errors');
     }
     // display the view
     parent::display($tpl);
 }
Example #4
0
 /**
  * Display
  */
 public function display($tpl = null)
 {
     // determine return view
     $view = 'booking';
     $booking = $this->get('Booking');
     if ($booking) {
         // processing status
         if ($booking->booking_status >= 40) {
             $view = 'confirm';
         }
         // confirmed status
         if ($booking->booking_status < 20) {
             $view = 'confirmed';
         }
     }
     $layout = new JLayoutFile('chclient_return', JPATH_ROOT . '/components/com_chclient/layouts');
     CHLib::rawExit($layout->render(['view' => $view]));
 }
Example #5
0
 /**
  * Get the hotel data
  */
 public function getRoom()
 {
     // get the vars
     $hotel_id = $this->getHotelId();
     $id = CHLib::input()->getInt('id');
     // check vars
     if (!$hotel_id || !$id) {
         throw new Exception(CHClient::string('error_bad_request'), 404);
     }
     // get the hotel
     $hotel = parent::getHotel($hotel_id);
     if (!$hotel) {
         throw new Exception(CHClient::string('error_resource_not_found'), 404);
     }
     // promo type array
     $room = CHLibData::getObjectFromList($hotel->rooms, $id, 'id');
     return $room;
 }
Example #6
0
 /**
  * Display the view
  */
 function display($tpl = null)
 {
     // load app
     $app = JFactory::getApplication();
     // get the items
     $this->items = $this->get('Items');
     $this->tags = $this->get('Tags');
     $this->pagination = $this->get('Pagination');
     // params
     $this->params = JComponentHelper::getParams('com_jkit');
     $app_params = $app->getParams();
     $this->params->merge($app_params);
     // lists
     $this->data = (object) [];
     // layout
     $layout = $this->params->get('jkitlayout');
     if ($layout) {
         $this->setLayout($layout);
     }
     // list views
     $this->tag = $this->get('Tag');
     $this->archive = $this->get('Archive');
     $this->author = $this->get('Author');
     // prepare document
     $this->prepareDocument();
     // jkit views
     if ($this->tag || $this->archive || $this->author || CHLib::input()->getUInt('start', 0)) {
         $this->data->subheading = '';
         if ($this->tag) {
             $this->data->subheading = JText::sprintf('COM_JKIT_ITEMS_TITLE_TAG', $this->tag->title);
         } elseif ($this->archive) {
             $this->data->subheading = JText::sprintf('COM_JKIT_ITEMS_TITLE_ARCHIVE', $this->archive->title);
         } elseif ($this->author) {
             $this->data->subheading = JText::sprintf('COM_JKIT_ITEMS_TITLE_AUTHOR', $this->author->title);
         }
         $tpl = 'list';
         $this->document->setTitle($this->data->title . ' | ' . $this->data->subheading);
     }
     // display the view
     parent::display($tpl);
 }
Example #7
0
 /**
  * load Plugin Dispatcher
  */
 private function loadPluginDispatcher()
 {
     // load the payment plugin
     $loaded = JPluginHelper::importPlugin('chclient', $this->config->confirm_payment_plugin);
     if (!$loaded) {
         CHLib::log(json_encode(['Bad configuration: unable to load payment plugin: chclient/' . $this->config->confirm_payment_plugin, CHLib::input()->get->getArray(), CHLib::input()->post->getArray()], JSON_PRETTY_PRINT), 'warning', 'com_chclient');
         return false;
     }
     // load the result from the plugin
     return JEventDispatcher::getInstance();
 }
Example #8
0
<?php

/**
 * @package		JKit
 * @copyright	Copyright (C) CloudHotelier. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/gpl.html>
 * @author		Xavier Pallicer <*****@*****.**>
 */
defined('_JEXEC') or die;
// load language files
JFactory::getLanguage()->load('com_jkit');
// load libraries
JLoader::import('chlib', JPATH_LIBRARIES . '/chlib');
JLoader::import('chassets', JPATH_LIBRARIES . '/chassets');
JLoader::import('chuikit', JPATH_LIBRARIES . '/chuikit');
// check libraries
if (!class_exists('CHLib') || !class_exists('CHAssets') || !class_exists('CHUikit')) {
    throw new Exception('CloudHotelier libraries not found', 500);
}
// load helpers
JLoader::import('jkit', JPATH_COMPONENT . '/helpers');
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/image.php';
// load and execute the controller
$controller = JControllerLegacy::getInstance('JKit');
$controller->execute(CHLib::input()->get('task'));
$controller->redirect();
 /**
  * Asyncronous email notification
  * 
  * @todo check sign
  */
 public function asyncNotification()
 {
     // get the booking id
     $booking_id = CHLib::input()->getInt('booking_id');
     // load the booking
     $booking = $this->getBooking($booking_id);
     // send notification
     CHClientBooking::emailNotification($booking);
     // return
     return 'notification sent';
 }
?>
"> 
		<input type="hidden" name="currency" value="<?php 
echo $this->availability->request->currency;
?>
"> 
		<input type="hidden" name="party" value="<?php 
echo $this->escape(CHLib::input()->get('party'));
?>
"> 
		<input type="hidden" name="rooms" value="<?php 
echo $this->escape(CHLib::input()->get('rooms'));
?>
"> 
		<input type="hidden" name="extras" value="<?php 
echo $this->escape(CHLib::input()->get('extras'));
?>
"> 

		<fieldset>

			<legend><?php 
echo CHClient::string('your_details');
?>
</legend>

			<?php 
if ($config->display_book_sign_in) {
    ?>
				<p><?php 
    echo CHClient::string('book_sign_in');
<?php

/**
 * @package		CHClient
 * @copyright	Copyright (C) CloudHotelier. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/gpl.html>
 * @author		Xavier Pallicer <*****@*****.**>
 */
defined('_JEXEC') or die;
// get search
$search = CHClient::getSearch();
$results = $this->results;
$link = CHClient::route('availability', ['hotel_id' => $results->hotel_id, 'promo_code' => CHLib::input()->getString('promo_code'), 'start_date' => CHLib::input()->getString('start_date'), 'end_date' => CHLib::input()->getString('end_date'), 'party' => CHLib::input()->getString('party')]);
$this->lowest_rate = 999999999;
$currency = CHLibDisplay::currencySymbol($this->availability->request->currency);
?>

<?php 
foreach ($results->search_rooms as $i => $search_room) {
    ?>

	<?php 
    $party = $search_room->party;
    ?>

	<p class="uk-margin-small">
		<strong>
			<?php 
    if (count($search->party) > 1) {
        ?>
				<?php 
Example #12
0
 /**
  * Get author data
  * TODO rewrite queries to sql object
  * @return type
  */
 public function getAuthor()
 {
     if (isset($this->author)) {
         return $this->author;
     }
     if (!CHLib::input()->getCmd('author')) {
         $this->author = false;
         return false;
     }
     // get the user info
     $author_alias = $this->_db->quote(CHLib::input()->getCmd('author'));
     $author_query = "SELECT * FROM `#__jkit_users` WHERE `alias` = {$author_alias}";
     $this->author = $this->_db->setQuery($author_query)->loadObject();
     return $this->author;
 }
Example #13
0
 /**
  * Asyncronous email notification
  * External operation performed basically on remote card form submission
  */
 function async_notification()
 {
     // load model
     $model = $this->getModel('Booking');
     // execute action
     $response = $model->asyncNotification();
     // exit app
     CHLib::rawExit($response);
 }
$config = CHClient::getConfig();
$search = CHClient::getSearch();
// get currency display
$currency = CHLibDisplay::currencySymbol($this->availability->request->currency);
// hotel data
$hotel = $this->availability->hotel;
?>

<!-- summary -->
<div class="uk-hidden-small" data-uk-sticky="{boundary: true, top: 10, media: 640}">

	<div class="ch-availability-summary uk-panel uk-panel-box">

		<!-- hotel -->
		<?php 
if (CHLib::input()->get('hotel_id')) {
    ?>
			<div class="ch-ratio ch-ratio-3-2" style="background-image: url(<?php 
    echo $hotel->image->med;
    ?>
);">
				<div class="ch-ratio-content">
					<a class="ch-ratio ch-ratio-3-2 ch-image-overlay" href="#ch-modal-hotel-<?php 
    echo $hotel->id;
    ?>
" data-uk-modal data-ch-engine-modal-link="0">
						<div class="ch-ratio-content uk-text-center">
							<div class="ch-vertical-align"><i class="uk-icon-search"></i></div>
						</div>
					</a>
				</div>
 /**
  * Print Voucher 
  */
 private function printVoucher()
 {
     // render and quit app
     CHLib::rawExit(CHClientDisplay::renderVoucher($this->booking));
 }
Example #16
0
 /**
  * getLangCode
  * 
  * @return string
  */
 private function getLangCode()
 {
     $langs = ['es' => '001', 'en' => '002', 'ca' => '003', 'fr' => '004', 'de' => '005', 'nl' => '006', 'it' => '007', 'sv' => '008', 'pt' => '009', 'pl' => '011', 'gl' => '012', 'eu' => '013', 'da' => '014'];
     $lang = substr(CHLib::lang(), 0, 2);
     $langCons = isset($langs[$lang]) ? $langs[$lang] : '0';
     return $langCons;
 }
Example #17
0
 /**
  * loadExtrasFromRequest
  * @param string $extras_input
  * @return mixed
  * @throws Exception
  */
 static function loadExtrasFromRequest($extras_input = false)
 {
     $extras = explode('-', $extras_input ? $extras_input : CHLib::input()->get('extras'));
     if (!$extras[0]) {
         return false;
     }
     // get & check extras
     $rooms_extras = [];
     foreach ($extras as $extra) {
         $values = explode('.', $extra);
         $room = (int) $values[0];
         if (!isset($values[0]) || !isset($values[1]) || !isset($values[2]) || !(int) $values[1] || !(int) $values[2]) {
             throw new Exception(CHClient::string('error_bad_request'), 400);
         }
         if (!isset($rooms_extras[$room])) {
             $rooms_extras[$room] = [];
         }
         $rooms_extras[$room][] = (object) ['id' => (int) $values[1], 'units' => (int) $values[2]];
     }
     return $rooms_extras;
 }