/** * Display the view */ public function display($tpl = null) { // get the data $this->months = $this->get('Months'); $this->month_days = $this->get('MonthDays'); $this->month_start = $this->get('MonthStart'); $this->month_16 = $this->get('Month16'); $this->hotels = $this->get('Hotels'); $this->hotel = $this->get('Hotel'); $this->inventory = $this->get('Inventory'); $this->bookings_in_progress = $this->get('BookingsInProgress'); // filters $this->state = $this->get('State'); // default dates $app = JFactory::getApplication(); $date_format = CHPanelHelper::getDateFormat(JText::_('COM_CHPANEL_LOCALE')); // start & end $this->start = $app->getUserStateFromRequest('com_chpanel.manage.start', 'start', JFactory::getDate()->format($date_format), 'string'); $this->end = $app->getUserStateFromRequest('com_chpanel.manage.end', 'end', JFactory::getDate('+ 1 day')->format($date_format), 'string'); // title $date = new JDate('01-' . $this->state->get('filter.month')); $this->title = $this->hotel ? $this->hotel->title . ' - ' . $date->format('F Y') : $date->format('F Y'); // toolbar CHPanelHelper::getToolbar('manage'); // sidebar $this->sidebar = JHtmlSidebar::render(); // display the view layout parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->item = $this->get('Item'); $this->translation = $this->get('Translation'); $this->language = CHPanelHelperLangs::getLangTitle(JRequest::getCmd('lang')); $this->params = JComponentHelper::getParams('com_chpanel'); // create the toolbar CHPanelHelper::getToolbar(false, true, $this->item->title . ' (' . JText::sprintf('COM_CHPANEL_TRANSLATION_TITLE', $this->language) . ')'); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get model data $this->info = $this->get('Info'); $this->banner = $this->get('Banner'); $this->bookings = $this->get('Bookings'); $this->checkins = $this->get('Checkins'); // create the toolbar CHPanelHelper::getToolbar('panel'); // sidebar $this->sidebar = JHtmlSidebar::render(); // display the view layout parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); // filters $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); // toolbar and sidbar CHPanelHelper::getToolbar('images', $this->state->get('filter.state') == -2); $this->sidebar = JHtmlSidebar::render(); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // get the image $imageHelper = new CHPanelHelperImage(JComponentHelper::getParams('com_chpanel')); $this->image = $imageHelper->getImage($this->item->id, 'rooms'); // get params $this->params = JComponentHelper::getParams('com_chpanel'); // create the toolbar CHPanelHelper::getToolbar(false, $this->item->id, $this->item->title); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); // filters $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); // start & end $app = JFactory::getApplication(); $this->date = $app->getUserStateFromRequest('com_chpanel.bookings.date', 'date', '', 'string'); $this->start = $app->getUserStateFromRequest('com_chpanel.bookings.start', 'start', '', 'string'); $this->end = $app->getUserStateFromRequest('com_chpanel.bookings.end', 'end', '', 'string'); // toolbar and sidbar CHPanelHelper::getToolbar('bookings', $this->state->get('filter.state') == -2); $this->sidebar = JHtmlSidebar::render(); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // get params $this->params = JComponentHelper::getParams('com_chpanel'); // get the image $imageHelper = new CHPanelHelperImage(JComponentHelper::getParams('com_chpanel')); $this->image = $imageHelper->getImage($this->item->id, 'hotels'); // create the toolbar CHPanelHelper::getToolbar(false, $this->item->id, $this->item->title); // load com_hotel language (for categories titles) $lpath = JPATH_ROOT . '/components/com_hotel'; JFactory::getLanguage()->load('com_hotel', $lpath, 'en-GB', true); JFactory::getLanguage()->load('com_hotel', $lpath, null, true); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); // filters $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); // lists $this->lists = new stdClass(); $this->lists->langs = CHPanelHelperLangs::getLangs(); $this->lists->translations = CHPanelHelperLangs::getTranslations($this->items); // toolbar and sidbar if ($this->getLayout() !== 'modal') { CHPanelHelper::getToolbar('hotels', $this->state->get('filter.state') == -2); $this->sidebar = JHtmlSidebar::render(); } // display the view layout parent::display($tpl); }
<div class="form-horizontal"> <fieldset> <legend><?php echo JText::_('COM_CHPANEL_TRANSLATION_IMAGES'); ?> </legend> <?php foreach ($this->item->images as $i => $image) { $field = "image_" . $image->id; $label = JText::_('COM_CHPANEL_ANY_IMAGE') . ' #' . ($i + 1); CHPanelHelper::renderTranslateText($field, $image->title, @$this->translation->data->{$field}, $label, $gtranslate); if ($image->info) { echo '<div class="chpanel-translate-image-info">'; $field = "image_info_" . $image->id; $label = ' '; CHPanelHelper::renderTranslateTextArea($field, $image->info, @$this->translation->data->{$field}, $label, $gtranslate); echo '</div>'; } } ?> </fieldset> </div> <?php } ?> </div> </div> <!--/main -->
<h4><?php echo JText::_('COM_CHPANEL_BOOKINGS_FILTER_DATES'); ?> </h4> <div class="chpanel-bookings-datefilters"> <div class="chpanel-bookings-datefilter"> <label for="chpanel-bookings-date"><?php echo JText::_('COM_CHPANEL_BOOKINGS_FILTER_DATE'); ?> </label> <select name="date" id="chpanel-bookings-date" class="input input-medium"> <?php echo JHtml::_('select.options', CHPanelHelper::getBookingFilterDates(), null, null, $this->date, true); ?> </select> </div> <label for="chpanel-bookings-start"><?php echo JText::_('COM_CHPANEL_BOOKINGS_FILTER_START'); ?> </label> <div class="input-prepend"> <span class="add-on"><i class="icon-calendar"></i></span> <input class="input-small chpanel-bookings-datepicker" name="start" id="chpanel-bookings-start" type="text" value="<?php echo $this->start; ?> " autocomplete="off" readonly="readonly"> </div>
echo CHPanelHelper::getControlGroup($params, 'cat100'); ?> <?php echo CHPanelHelper::getControlGroup($params, 'cat200'); ?> <?php echo CHPanelHelper::getControlGroup($params, 'cat300'); ?> <?php echo CHPanelHelper::getControlGroup($params, 'cat400'); ?> <?php echo CHPanelHelper::getControlGroup($params, 'cat500'); ?> <?php echo CHPanelHelper::getControlGroup($params, 'cat600'); ?> </fieldset> </div> </div> <!-- sidebar --> <div class="span3"> <!-- image --> <div class="well"> <h3><?php echo JText::_('COM_CHPANEL_ANY_FIELDSET_IMAGE'); ?> </h3>
/** * Get the translations and override strings */ private function loadTranslations($items, $ids) { // get the translations $qids = implode(',', $ids); $db = JFactory::getDbo(); $lang = $db->quote(JFactory::getLanguage()->getTag()); $query_translation = $db->getQuery(true)->select('*')->from('#__chpanel_translations')->where("lang = {$lang}")->where("hotel_id IN ({$qids})"); $translations = $db->setQuery($query_translation)->loadObjectList('hotel_id'); if ($translations) { foreach ($items as $item) { if (isset($translations[$item->id])) { $item = CHPanelHelper::applyTranslation($item, $translations[$item->id]); } } } return $items; }
/** * Update inventory */ public function update() { // get the hotel $hotel = $this->getHotel(); if (!$hotel) { $this->setError(JText::_('COM_CHPANEL_MANAGE_ERROR_HOTEL')); return false; } // prepare check $db = JFactory::getDbo(); $app = JFactory::getApplication(); $date_format = CHPanelHelper::getDateFormat(JText::_('COM_CHPANEL_LOCALE')); // start $start = $app->getUserStateFromRequest('com_chpanel.manage.start', 'start', JFactory::getDate()->format($date_format), 'string'); $date_start = new JDate(CHPanelHelper::correctDateFormat($start)); $this->start_date = $date_start->format('Y-m-d'); // end $end = $app->getUserStateFromRequest('com_chpanel.manage.end', 'end', JFactory::getDate('+ 1 day')->format($date_format), 'string'); $date_end = new JDate(CHPanelHelper::correctDateFormat($end)); $this->end_date = $date_end->format('Y-m-d'); // check dates if (!$this->start_date || !$this->end_date) { $this->setError(JText::_('COM_CHPANEL_MANAGE_ERROR_DATES')); return false; } // check period if ($date_end->format('Ymd') < $date_start->format('Ymd')) { $this->setError(JText::_('COM_CHPANEL_MANAGE_ERROR_DATES')); return false; } // check values $rids = array(); foreach ($hotel->rooms as $room) { if (JRequest::getString('availability_' . $room->id, '', 'post') != '') { $rids[] = $room->id; } if (JRequest::getString('rate_' . $room->id, '', 'post') != '') { $rids[] = $room->id; } } if (!$rids) { $this->setError(JText::_('COM_CHPANEL_MANAGE_ERROR_INVENTORY')); return false; } // set filter_month state JFactory::getApplication()->setUserState('com_chpanel.manage.filter.month', $date_start->format('m-Y')); // get the rooms ids $room_ids = array_unique($rids); // update inventory per room foreach ($room_ids as $room_id) { // get the room default rate foreach ($hotel->rooms as $room) { if ($room->id == $room_id) { $default_rate = $room->rate; } } // get the room current inventory $inventory_rows = $this->getRoomInventory($room_id); // prepare loop dates $date = $date_start->toUnix(); $while_date = $date_start->format('Ymd'); $while_end = $date_end->format('Ymd'); $current_date = $date_start->format('Y-m-d'); // update inventory while ($while_date <= $while_end) { // new object query $row = new stdClass(); // get row values if (JRequest::getString('availability_' . $room_id, '', 'post') != '') { $row->availability = JRequest::getInt('availability_' . $room_id, 0, 'post'); } if (JRequest::getString('rate_' . $room_id, '', 'post') != '') { $row->rate = JRequest::getFloat('rate_' . $room_id, 0, 'post'); } // update or insert inventory row if (isset($inventory_rows[$current_date])) { // update row $row->id = $inventory_rows[$current_date]->id; $db->updateObject('#__chpanel_inventory', $row, 'id'); } else { // default availability, 0 for new rows if (!isset($row->availability)) { $row->availability = 0; } // default rate, room rack rate if (!isset($row->rate)) { $row->rate = $default_rate; } // insert row $row->room_id = $room_id; $row->date = $current_date; $db->insertObject('#__chpanel_inventory', $row); } // update loop conditions $date = strtotime('+1 day', $date); $j_date = JFactory::getDate($date); $while_date = $j_date->format('Ymd'); $current_date = $j_date->format('Y-m-d'); } } // return ok JFactory::getApplication()->enqueueMessage(JText::_('COM_CHPANEL_MANAGE_APPLY_OK')); return true; }
/** * Query */ protected function getListQuery() { // main query $query = $this->_db->getQuery(true); $query->select('a.*, a.first_name AS title'); $query->from('#__chpanel_bookings AS a'); // joins $query->select('h.title AS hotel')->join('LEFT', '#__chpanel_hotels AS h ON h.id = a.hotel_id'); $query->select('r.title AS room, r.reference')->join('LEFT', '#__chpanel_rooms AS r ON r.id = a.room_id'); $query->select('l.title AS language_title')->join('LEFT', '#__languages AS l ON l.lang_code = h.language'); // checked out $query->select('uc.name AS editor'); $query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out_time'); // status filter $status = $this->getState('filter.status'); if (is_numeric($status)) { if ($status % 100 == 0) { $statuses = array($status + 1, $status + 2, $status + 3); $query->where('a.status IN (' . implode(',', $statuses) . ')'); } else { $query->where('a.status = ' . $status); } } else { $query->where('a.status IN (201,202,203)'); // confirmed bookings } // state filter $state = $this->getState('filter.state'); if (is_numeric($state)) { $query->where('a.state = ' . (int) $state); } else { if ($state != '*') { $query->where('a.state = 1'); } } // search filter $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = ' . (int) substr($search, 3)); } else { $search = $this->_db->Quote('%' . $this->_db->escape($search, true) . '%'); $query->where('(a.first_name LIKE ' . $search . ')'); } } // other standard filters foreach (array('hotel') as $filter_name) { $filter_value = $this->getState('filter.' . $filter_name); if (is_numeric($filter_value)) { $query->where('a.' . $filter_name . '_id = ' . $filter_value); } } // date filters $db = JFactory::getDbo(); $app = JFactory::getApplication(); $start = $app->getUserStateFromRequest('com_chpanel.bookings.start', 'start', '', 'string'); $end = $app->getUserStateFromRequest('com_chpanel.bookings.end', 'end', '', 'string'); $date = $app->getUserStateFromRequest('com_chpanel.bookings.date', 'date', 'created', 'string'); if (in_array($date, array('created', 'checkin', 'checkout'))) { if ($start) { $date_start = new JDate(CHPanelHelper::correctDateFormat($start)); $query_start = $db->quote($date_start->format('Y-m-d')); $query->where("{$query_start} <= DATE(a.{$date})"); } if ($end) { $date_end = new JDate(CHPanelHelper::correctDateFormat($end)); $query_end = $db->quote($date_end->format('Y-m-d')); $query->where("DATE(a.{$date}) <= {$query_end}"); } } // ordering clause $orderCol = $this->state->get('list.ordering'); $orderDirn = $this->state->get('list.direction'); $query->order($this->_db->escape("{$orderCol} {$orderDirn}")); // echo nl2br(str_replace('#__', 'jos_', $query)); return $query; }
<?php } else { ?> <p class="alert alert-warning"><?php echo JText::_('COM_CHPANEL_PANEL_CHECKINS_NO'); ?> </p> <?php } ?> <div class="clearfix"> <?php $today = JFactory::getDate()->format(CHPanelHelper::getDateFormat(JText::_('COM_CHPANEL_LOCALE'))); $link = JRoute::_('index.php?option=com_chpanel&view=bookings&filter[hotel]=&filter[status]=&filter[state]=&list[fullordering]=a.checkin%20ASC&date=checkin&end=&start=' . $today); ?> <a class="btn btn-small pull-right" href="<?php echo $link; ?> "><?php echo JText::_('COM_CHPANEL_PANEL_VIEW_MORE'); ?> </a> </div> </div> </div>
* @author Xavier Pallicer <*****@*****.**> */ defined('_JEXEC') or die; JHtml::_('formbehavior.chosen', 'select'); $context = 'items'; $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'a.ordering'; if ($saveOrder) { JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), 'index.php?option=com_chpanel&task=' . $context . '.saveOrderAjax&tmpl=component'); } $archived = $this->state->get('filter.state') == 2 ? true : false; $trashed = $this->state->get('filter.state') == -2 ? true : false; $imageHelper = new CHPanelHelperImage(JComponentHelper::getParams('com_chpanel')); $image_path = JURI::root() . "/images/chpanel/{$context}/"; $types = CHPanelHelper::defaultTypes(); ?> <!-- adminForm --> <form action="<?php echo JRoute::_('index.php?option=com_chpanel&view=' . $context); ?> " method="post" name="adminForm" id="adminForm"> <!-- main --> <div id="j-main-container" class="span12"> <!-- search tools --> <?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
<?php /** * @package CHPanel * @copyright Copyright (C) CloudHotelier. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/gpl.html> * @author Xavier Pallicer <*****@*****.**> */ defined('_JEXEC') or die; JHtml::_('formbehavior.chosen', 'select'); // options $lang = substr(JFactory::getLanguage()->getTag(), 0, 2); $checkfields = JText::_('COM_CHPANEL_ANY_ERROR_CHECKFIELDS'); $weekstart = JText::_('COM_CHPANEL_LOCALE_WEEKSTART'); $dateformat = str_replace('Y', 'yyyy', str_replace('m', 'mm', str_replace('d', 'dd', CHPanelHelper::getDateFormat(JText::_('COM_CHPANEL_LOCALE'))))); $options = array(); $options[] = "checkfields: '{$checkfields}'"; $options[] = "datepicker_format: '{$dateformat}'"; $options[] = "datepicker_lang: '{$lang}'"; $options[] = "datepicker_weekstart: '{$weekstart}'"; JFactory::getDocument()->addScriptDeclaration("window.chpanel_options = {" . implode(",\n", $options) . "};"); // load datepicker JHtml::stylesheet(JUri::base() . 'components/com_chpanel/assets/datepicker/css/datepicker.css'); JHtml::script(JUri::base() . 'components/com_chpanel/assets/datepicker/js/bootstrap-datepicker.js'); if ($lang != 'en') { JHtml::script(JUri::base() . "components/com_chpanel/assets/datepicker/js/locales/bootstrap-datepicker.{$lang}.js"); } // tooltip JHtml::_('bootstrap.tooltip'); ?>