/** * Get the availability data for a hotel */ public function getCalendar() { // hotel_id $hotel_id = $this->getHotelId(); if (!$hotel_id) { throw new Exception(CHClient::string('error_resource_not_found'), 404); } // load search $search = CHClient::getSearch(); // get month start and end dates $default_month = substr($search->start_date, 0, -3); $month_date = $this->app->getUserStateFromRequest('chclient.month', 'month', $default_month, 'string'); // init calendar object $calendar = new stdClass(); $calendar->month = CHLibDate::getMonth($month_date); $calendar->months_list = CHLibDate::getMonthsList(); // get ari from api $request = (object) ['hotel_id' => $hotel_id, 'start_date' => $calendar->month->start, 'end_date' => $calendar->month->end, 'currency' => $search->currency, 'lang' => JFactory::getLanguage()->getTag()]; $api_request = $this->apiRequest('ari_get', $request); // check for errors if ($api_request->errors->errors) { return $api_request; } // finalise calendar object $calendar->ari = $api_request->response; return $calendar; }
/** * Constructor */ public function __construct($config = array()) { // get app & config $this->app = CHClient::getApp(); $this->config = CHClient::getConfig(); $this->search = CHClient::getSearch(); // construct parent::__construct($config); }
/** * Constructor */ public function __construct($config = array()) { // init view $this->search = CHClient::getSearch(); // params $this->params = JComponentHelper::getParams('com_chclient'); $app_params = JFactory::getApplication()->getParams(); $this->params->merge($app_params); // init data $this->data = (object) []; // parent construct parent::__construct($config); }
<?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(); // hotel data $hotel = $this->availability->hotel; // currency $currency = CHLibDisplay::currencySymbol($this->availability->request->currency); // prepare data $unit = $this->available_unit; $rates = $this->availability->results->search_rooms[$unit]; $party = $rates->party; $first_unit = $this->first_unit; $class_active = $this->first_unit ? 'ch-active' : ''; $class_available = $this->available ? '' : 'ch-unavailable'; ?> <div <?php echo $this->available ? 'data-ch-available-item="' . $unit . '-' . $this->room->id . '"' : ''; ?> class="uk-width-medium-1-1 ch-available-unit ch-available-list <?php echo $class_active; ?> <?php
<?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; // 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')) { echo 'CloudHotelier libraries not found'; return false; } // load helper JLoader::import('chclient', JPATH_ROOT . '/components/com_chclient/helpers'); // get the currency and currencies array $currency = CHClient::getSearch()->currency; $currencies = array_map('trim', explode(',', $params->get('currencies'))); if (!$currencies) { return false; } // render display require JModuleHelper::getLayoutPath('mod_chcurrency', $params->get('chlayout', 'default'));