/** * 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; }
/** * 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); }
/** * Display */ public function display($tpl = null) { // load app $this->app = CHClient::getApp(); // get the booking info $this->booking = $this->get('Booking'); // no booking found if (!$this->booking) { $this->setLayout('errors'); parent::display($tpl); return; } // processing booking if ($this->booking->booking_status >= 40) { return $this->displayProcessing(); } // new booking analytics tracking $this->new_booking = false; if ($this->app->getUserState('chclient.new_booking', false)) { $this->new_booking = (object) ['booking_id' => $this->booking->booking_id, 'hotel' => $this->booking->hotel->title, 'total' => $this->booking->amounts->total, 'currency' => $this->booking->currency]; $this->new_booking->rooms = []; foreach ($this->booking->rooms as $room) { $new_booking_room = (object) ['title' => $room->title, 'reference' => $room->reference, 'total' => $room->amounts->total]; $this->new_booking->rooms[] = $new_booking_room; } $this->app->setUserState('chclient.new_booking', null); } // determine free cancellation $this->data = (object) []; $this->data->free_cancellation = 1; $this->data->deadline = ''; $deadline = 00; foreach ($this->booking->rooms as $room) { $rate_deadline = CHLIbdate::sqlToInt($room->rate->deadline); if ($rate_deadline > $deadline) { $this->data->deadline = $room->rate->deadline; } if (!in_array($room->rate->conditions, ['pay_at_hotel', 'deposit_refundable', 'prepay_refundable'])) { $this->data->free_cancellation = 0; } } if ($this->data->free_cancellation) { $this->data->free_cancellation = CHLibDate::isGreater($this->data->deadline, CHLibDate::dateToSql(false)); } // print voucher ? if ($this->booking && CHLib::input()->get('print')) { return $this->printVoucher(); } // set document title $this->document->setTitle(CHClient::string('your_booking') . ' - ' . $this->booking->booking_id); // display parent::display($tpl); }
/** * 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); }
/** * 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; }
/** * 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); }
/** * Load the payment form * * @param object $booking * @return object */ public function loadForm($booking) { // action $test = $this->params->get('test', 0); $action = $test ? 'https://sis-t.redsys.es:25443/sis/realizarPago' : 'https://sis.redsys.es/sis/realizarPago'; // urls $urlMer = JRoute::_('index.php?Itemid=' . CHLib::input()->get('Itemid') . '&view=notify', true, JFactory::getURI()->isSSL() ? 1 : -1); $urlOK = JRoute::_('index.php?Itemid=' . CHLib::input()->get('Itemid') . '&view=return', true, JFactory::getURI()->isSSL() ? 1 : -1); // carga redsys api $redsys_api_object = new RedsysAPI(); // parametros foreach (['Ds_Merchant_Titular' => $booking->customer->first_name . ' ' . $booking->customer->last_name, 'Ds_Merchant_Amount' => round($booking->amounts->deposit * 100), 'Ds_Merchant_MerchantData' => $booking->booking_id, 'Ds_Merchant_MerchantCode' => $this->params->get('MerchantCode'), 'Ds_Merchant_Terminal' => $this->params->get('Terminal'), 'Ds_Merchant_Currency' => '978', 'Ds_Merchant_MerchantURL' => $urlMer, 'Ds_Merchant_UrlKO' => $urlOK, 'Ds_Merchant_UrlOK' => $urlOK, 'Ds_Merchant_MerchantName' => $this->params->get('MerchantName'), 'Ds_Merchant_Order' => date('ymdHis'), 'Ds_Merchant_ConsumerLanguage' => $this->getLangCode(), 'Ds_Merchant_TransactionType' => '0', 'Ds_Merchant_PayMethods' => 'T'] as $key => $value) { $redsys_api_object->setParameter($key, $value); } $parameters = $redsys_api_object->createMerchantParameters(); // signature $signature = $redsys_api_object->createMerchantSignature($this->params->get('Signature')); // form $form = (object) ['action' => $action, 'method' => 'post', 'iframe' => $this->params->get('iframe', 1), 'fields' => ['Ds_SignatureVersion' => 'HMAC_SHA256_V1', 'Ds_MerchantParameters' => $parameters, 'Ds_Signature' => $signature]]; return $form; }
/** * 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(); }
<?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');
/** * 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; }
/** * 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; }
$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>
<?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