Exemple #1
0
 /**
  * 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);
 }
Exemple #2
0
 /**
  * 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);
 }
Exemple #3
0
 /**
  * Update #__hotel_data tables with Lite data
  */
 public static function buildDataObject()
 {
     $db = JFactory::getDbo();
     $chpanel_params = JComponentHelper::getParams('com_chpanel');
     // get db info
     $hotels = $db->setQuery('SELECT * FROM #__chpanel_hotels AS a WHERE a.state = 1')->loadObjectList();
     $images = $db->setQuery('SELECT * FROM #__chpanel_images AS a WHERE a.state = 1 order by a.ordering')->loadObjectList();
     $rooms = $db->setQuery('SELECT * FROM #__chpanel_rooms AS a WHERE a.state = 1 order by a.ordering')->loadObjectList();
     $languages = CHPanelHelperLangs::getLangs();
     $translations = $db->setQuery('SELECT * FROM #__chpanel_translations AS a')->loadObjectList();
     // check hotels and rooms
     if (!$hotels || !$rooms) {
         return false;
     }
     // delete prev data
     $db->setQuery('DELETE FROM #__hotel_data WHERE id > 0')->execute();
     // prepare to insert items
     foreach ($hotels as $hotel) {
         // begin new item object
         $item = new stdClass();
         $item->hotel_id = $hotel->id;
         $item->lang = substr($hotel->language, 0, 2);
         $item->slug = $hotel->alias;
         $item->title = $hotel->title;
         // begin new data object
         $data = new stdClass();
         $data->id = $hotel->id;
         $data->title = $hotel->title;
         $data->slug = $hotel->alias;
         $data->currency = $chpanel_params->get('currency', 'EUR');
         $data->lang = $item->lang;
         // deprecated in CH v3
         $data->firm = $hotel->title;
         $data->firm_id = 1;
         $data->zone_id = 1;
         // assign hotel fields
         foreach (array('info', 'text', 'conditions', 'lat', 'lng', 'zoom', 'email', 'video', 'phone', 'street', 'city', 'state', 'zip') as $v) {
             $data->{$v} = $hotel->{$v};
         }
         // categories
         $data->cats = array();
         $params = json_decode($hotel->params);
         foreach (array(1, 2, 3, 4, 5, 6) as $c) {
             $cat = 'cat' . $c . '00';
             if (!is_array($params->{$cat})) {
                 $data->cats[] = $params->{$cat};
             } else {
                 foreach ($params->{$cat} as $ca) {
                     $data->cats[] = $ca;
                 }
             }
         }
         // hotel photos
         $data->photos = self::getPhotos($hotel->id, $hotel, $images, 'hotel');
         // rooms_data
         $data->rooms_data = array();
         // other lite empty data
         $data->packs_data = array();
         $data->promos_data = array();
         $data->offers_data = array();
         foreach ($rooms as $room) {
             if ($room->hotel_id == $hotel->id) {
                 // begin new room data object
                 $room_data = new stdClass();
                 foreach (array('id', 'title', 'info', 'text', 'video', 'rate') as $v) {
                     $room_data->{$v} = $room->{$v};
                 }
                 // capacity
                 $room_data->capacity = new stdClass();
                 $room_data->capacity->standard = $room->capacity;
                 $room_data->capacity->max = new stdClass();
                 $room_data->capacity->max->adult = $room->max_adult;
                 $room_data->capacity->max->child = $room->max_child;
                 $room_data->capacity->max->baby = $room->max_baby;
                 // bed & smoking
                 $room_data->smoking = 0;
                 $room_data->bed = 0;
                 // photos
                 $room_data->photos = self::getPhotos($hotel->id, $room, $images, 'room');
                 // assign room
                 $data->rooms_data[] = $room_data;
             }
         }
         // encode data
         $item->data = json_encode($data);
         // insert the new item
         $db->insertObject('#__hotel_data', $item, 'id');
         // insert item translations
         foreach ($languages as $language) {
             if ($language->lang_code != $hotel->language) {
                 $lang_ok = false;
                 // search for a translation, apply and insert data object
                 foreach ($translations as $translation) {
                     if ($translation->lang == $language->lang_code && $translation->hotel_id == $hotel->id) {
                         // prepare to add a new item
                         $translated_item = $item;
                         $translated_item->id = null;
                         $translated_item->lang = substr($translation->lang, 0, 2);
                         $translated_item->slug = $translation->alias;
                         $translated_item->title = $translation->title;
                         // get translated data
                         $translated_data = self::applyTranslation($data, $translation);
                         $translated_item->data = json_encode($translated_data);
                         // insert the new item
                         $db->insertObject('#__hotel_data', $translated_item, 'id');
                         $lang_ok = true;
                     }
                 }
                 // no translation found
                 if (!$lang_ok) {
                     // insert original item as the translated item
                     $no_translated_item = $item;
                     $no_translated_item->id = null;
                     $no_translated_item->lang = substr($language->lang_code, 0, 2);
                     // insert the new item
                     $db->insertObject('#__hotel_data', $no_translated_item, 'id');
                 }
             }
         }
     }
     return true;
 }
Exemple #4
0
            echo JText::alt('JALL', 'language');
            ?>
								<?php 
        } else {
            ?>
									<?php 
            echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED');
            ?>
								<?php 
        }
        ?>
							</td>

							<!-- languages -->
							<?php 
        echo CHPanelHelperLangs::listItem($this->lists->langs, $this->lists->translations, $item);
        ?>

							<td class="nowrap center small">
								<?php 
        echo JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC4'));
        ?>
							</td>
							<td class="nowrap center small">
								<?php 
        echo JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC4') . ' H:m');
        ?>
							</td>

							<td class="nowrap center small">
								<?php 
Exemple #5
0
<?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;
$langs = CHPanelHelperLangs::getLangs();
$imageHelper = new CHPanelHelperImage(JComponentHelper::getParams('com_chpanel'));
$path_items = JURI::root() . "/images/chpanel/items/";
$path_images = JURI::root() . "/images/chpanel/images/";
?>

<?php 
if ($this->banner) {
    ?>
	<div class="alert alert-block alert-info">
		<button type="button" class="close" data-dismiss="alert" id="chbanner-close">&times;</button>
		<h4><?php 
    echo $this->banner->title;
    ?>
</h4>
		<?php 
    echo $this->banner->text;
    ?>
 <a href="<?php 
    echo $this->banner->link;
    ?>
" target="_blank"><i class="icon-out"></i> <?php