Your IP : 216.73.216.41


Current Path : /home/purehotels/public_html/modules/mod_pure_booking2/tmpl/
Upload File :
Current File : /home/purehotels/public_html/modules/mod_pure_booking2/tmpl/default.php

<?php
/**
 *
 *
 */

// no direct access
defined('_JEXEC') or die;

$document = JFactory::getDocument();
$document->addStyleSheet('modules/mod_pure_booking/css/module.css');
$lang = JFactory::getLanguage();


switch ($lang->getTag()) {
    case 'no': $catid = 5;
    default: $catid=0;
}

// FRONTPAGE BOXES
//---------
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('id','title', 'alias', 'introtext')));
$query->from($db->quoteName('#__k2_items'));
$query->where(  $db->quoteName('catid') . ' = '. $db->quote($catid) .' AND '.
                $db->quoteName('published') . ' = '. $db->quote(1) .' AND '.
                $db->quoteName('trash') . ' = '. $db->quote(0));
$query->order('ordering ASC');
$db->setQuery($query);
$hotels = $db->loadObjectList();


?>

<div id="booking" class="mainGrid">
    <div class="container-fluid">
        <div class="row no-gutter">

            <?php foreach ($hotels as $hotel): ?>
                <?php
                    $gallery ='';
                    $json = 'media/k2/gallerychamp/item'.$hotel->id.'/ordering.json';
                    if(file_exists($json)){
                        $ordering = json_decode(file_get_contents($json));
                        $ordering = $ordering->ordering;
                        $gallery = $ordering;
                    }

                    if (strlen($gallery[0])){

                        $image = new JImage('media/k2/gallerychamp/item'.$hotel->id.'/main/'.$gallery[0]);
                        $image = $image->createThumbs('500x375', JImage::CROP_RESIZE)[0]->getPath();
                    }
                    $imageEmpty = new JImage('modules/mod_pure_frontpage/images/box_empty.jpg');
                    $imageEmpty = $imageEmpty->createThumbs('500x375', JImage::CROP_RESIZE)[0]->getPath();
                ?>

                <div class="col-xs-12 col-sm-6 col-md-4">
                    <a href="/no/vare-hoteller/eidsbugarden-hotell">
                        <div class="relative">
                            <?php if ( strlen($image) ): ?>
                                <img src="<?php echo $image; ?>" alt="" width="100%" class="image">
                            <?php else: ?>
                                <img src="<?php echo $imageEmpty; ?>" alt="" width="100%" class="image">
                            <?php endif; ?>
                            <div class="imageText"><?php echo $hotel->introtext; ?></div>
                        </div>
                    </a>
                </div>

            <?php endforeach; ?>
        </div> 
    </div>   
</div>