| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking |
| 4 |
* @subpackage com_vikbooking |
| 5 |
* @author Alessio Gaggii - e4j - Extensionsforjoomla.com |
| 6 |
* @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved. |
| 7 |
* @license GNU General Public License version 2 or later; see LICENSE |
| 8 |
* @link https://vikwp.com |
| 9 |
*/ |
| 10 |
|
| 11 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 12 |
|
| 13 |
$rooms = $this->rooms; |
| 14 |
$category = $this->category; |
| 15 |
$vbo_tn = $this->vbo_tn; |
| 16 |
$navig = $this->navig; |
| 17 |
|
| 18 |
$currencysymb = VikBooking::getCurrencySymb(); |
| 19 |
$pitemid = VikRequest::getString('Itemid', '', 'request'); |
| 20 |
$document = JFactory::getDocument(); |
| 21 |
// load jQuery |
| 22 |
if (VikBooking::loadJquery()) { |
| 23 |
JHtml::fetch('jquery.framework', true, true); |
| 24 |
} |
| 25 |
|
| 26 |
$playoutstyle = VikRequest::getString('layoutstyle', 'list', 'request'); |
| 27 |
|
| 28 |
if (is_array($category)) { |
| 29 |
?> |
| 30 |
<h3 class="vbclistheadt"><?php echo $category['name']; ?></h3> |
| 31 |
<?php |
| 32 |
if (strlen($category['descr']) > 0) { |
| 33 |
?> |
| 34 |
<div class="vbcatdescr"> |
| 35 |
<?php |
| 36 |
/** |
| 37 |
* @wponly we allow the use of Shortcodes also inside the HTML description of the category. |
| 38 |
*/ |
| 39 |
echo do_shortcode(wpautop($category['descr'])); |
| 40 |
?> |
| 41 |
</div> |
| 42 |
<?php |
| 43 |
} |
| 44 |
} |
| 45 |
?> |
| 46 |
<div class="vblistcontainer vblistcontainer-<?php echo JHtml::fetch('esc_attr', $playoutstyle); ?>"> |
| 47 |
<ul class="vblist"> |
| 48 |
<?php |
| 49 |
foreach ($rooms as $r) { |
| 50 |
if (!empty($r['moreimgs'])) { |
| 51 |
$document->addStyleSheet(VBO_SITE_URI.'resources/vikfxgallery.css'); |
| 52 |
JHtml::fetch('script', VBO_SITE_URI.'resources/vikfxgallery.js'); |
| 53 |
break; |
| 54 |
} |
| 55 |
} |
| 56 |
$gallery_data = array(); |
| 57 |
foreach ($rooms as $r) { |
| 58 |
if (empty($r['moreimgs'])) { |
| 59 |
continue; |
| 60 |
} |
| 61 |
$num = $r['id']; |
| 62 |
$gallery_data[$num] = array(); |
| 63 |
$moreimages = explode(';;', $r['moreimgs']); |
| 64 |
$imgcaptions = json_decode($r['imgcaptions'], true); |
| 65 |
$usecaptions = is_array($imgcaptions); |
| 66 |
foreach ($moreimages as $iind => $mimg) { |
| 67 |
if (empty($mimg)) { |
| 68 |
continue; |
| 69 |
} |
| 70 |
$img_alt = $usecaptions && !empty($imgcaptions[$iind]) ? $imgcaptions[$iind] : substr($mimg, 0, strpos($mimg, '.')); |
| 71 |
array_push($gallery_data[$num], array( |
| 72 |
'big' => VBO_SITE_URI . 'resources/uploads/big_' . $mimg, |
| 73 |
'thumb' => VBO_SITE_URI . 'resources/uploads/thumb_' . $mimg, |
| 74 |
'alt' => $img_alt, |
| 75 |
'caption' => $usecaptions && !empty($imgcaptions[$iind]) ? $imgcaptions[$iind] : "", |
| 76 |
)); |
| 77 |
} |
| 78 |
} |
| 79 |
$vikfx = ' |
| 80 |
jQuery(function() { |
| 81 |
'; |
| 82 |
foreach ($gallery_data as $num => $gallery) { |
| 83 |
$vikfx .= ' |
| 84 |
window["vikfxgallery'.$num.'"] = jQuery("#vikfx-gallery'.$num.' a").vikFxGallery(); |
| 85 |
'; |
| 86 |
} |
| 87 |
$vikfx .= ' |
| 88 |
jQuery(".vbo-roomslist-opengallery").click(function() { |
| 89 |
var num = jQuery(this).attr("data-roomid"); |
| 90 |
if (typeof window["vikfxgallery" + num] !== "undefined") { |
| 91 |
window["vikfxgallery" + num].open(); |
| 92 |
} |
| 93 |
}); |
| 94 |
});'; |
| 95 |
if (count($gallery_data)) { |
| 96 |
$document->addScriptDeclaration($vikfx); |
| 97 |
} |
| 98 |
|
| 99 |
foreach ($rooms as $r) { |
| 100 |
$details_link = JRoute::rewrite('index.php?option=com_vikbooking&view=roomdetails&roomid='.$r['id'].(!empty($pitemid) ? '&Itemid='.$pitemid : '')); |
| 101 |
$carats = VikBooking::getRoomCaratOriz($r['idcarat'], $vbo_tn); |
| 102 |
/** |
| 103 |
* @wponly we try to parse any shortcode inside the short description of the room |
| 104 |
*/ |
| 105 |
$r['smalldesc'] = do_shortcode($r['smalldesc']); |
| 106 |
// |
| 107 |
?> |
| 108 |
<li class="room_result"> |
| 109 |
<div class="room_result-inner"> |
| 110 |
<div class="vblistroomblock"> |
| 111 |
<?php |
| 112 |
if (!empty($r['img'])) { |
| 113 |
?> |
| 114 |
<div class="vbimglistdiv"> |
| 115 |
<a class="vbo-roomslist-imglink" href="<?php echo $details_link; ?>"> |
| 116 |
<img src="<?php echo VBO_SITE_URI; ?>resources/uploads/<?php echo $r['img']; ?>" alt="<?php echo htmlspecialchars($r['name']); ?>" class="vblistimg"/> |
| 117 |
</a> |
| 118 |
<?php |
| 119 |
if (isset($gallery_data[$r['id']]) && count($gallery_data[$r['id']])) { |
| 120 |
?> |
| 121 |
<div class="vbmodalrdetails vbo-roomslist-opengallery-cont"> |
| 122 |
<a href="javascript: void(0);" class="vbo-roomslist-opengallery" data-roomid="<?php echo $r['id']; ?>"><?php VikBookingIcons::e('camera'); ?></a> |
| 123 |
</div> |
| 124 |
<div class="vikfx-gallery" id="vikfx-gallery<?php echo $r['id']; ?>" style="display: none;"> |
| 125 |
<?php |
| 126 |
foreach ($gallery_data[$r['id']] as $mimg) { |
| 127 |
?> |
| 128 |
<a href="<?php echo $mimg['big']; ?>" style="display: none;"> |
| 129 |
<img src="<?php echo $mimg['thumb']; ?>" alt="<?php echo htmlspecialchars($mimg['alt']); ?>" title="<?php echo htmlspecialchars($mimg['caption']); ?>" style="display: none;"/> |
| 130 |
</a> |
| 131 |
<?php |
| 132 |
} |
| 133 |
?> |
| 134 |
</div> |
| 135 |
<?php |
| 136 |
} |
| 137 |
?> |
| 138 |
</div> |
| 139 |
<?php |
| 140 |
} |
| 141 |
?> |
| 142 |
<div class="vbo-info-room"> |
| 143 |
<div class="vbdescrlistdiv"> |
| 144 |
<h4 class="vbrowcname"> |
| 145 |
<a href="<?php echo $details_link; ?>"><?php echo $r['name']; ?></a> |
| 146 |
</h4> |
| 147 |
<span class="vblistroomcat"><?php echo VikBooking::sayCategory($r['idcat'], $vbo_tn); ?></span> |
| 148 |
<div class="vbrowcdescr"><?php echo $r['smalldesc']; ?></div> |
| 149 |
</div> |
| 150 |
<?php |
| 151 |
if (!empty($carats)) { |
| 152 |
?> |
| 153 |
<div class="roomlist_carats"> |
| 154 |
<?php echo $carats; ?> |
| 155 |
</div> |
| 156 |
<?php |
| 157 |
} |
| 158 |
?> |
| 159 |
</div> |
| 160 |
</div> |
| 161 |
|
| 162 |
<div class="vbcontdivtot"> |
| 163 |
<div class="vbdivtot"> |
| 164 |
<div class="vbdivtotinline"> |
| 165 |
<div class="vbsrowprice"> |
| 166 |
<div class="vbrowroomcapacity"> |
| 167 |
<?php |
| 168 |
for ($i = 1; $i <= $r['toadult']; $i++) { |
| 169 |
VikBookingIcons::e('male', 'vbo-pref-color-text'); |
| 170 |
} |
| 171 |
?> |
| 172 |
</div> |
| 173 |
<?php |
| 174 |
$custprice = VikBooking::getRoomParam('custprice', $r['params']); |
| 175 |
$custpricetxt = VikBooking::getRoomParam('custpricetxt', $r['params']); |
| 176 |
$custpricetxt = empty($custpricetxt) ? JText::translate('VBLISTPERNIGHT') : JText::translate($custpricetxt); |
| 177 |
$custpricesubtxt = VikBooking::getRoomParam('custpricesubtxt', $r['params']); |
| 178 |
if ($r['cost'] > 0 || !empty($custprice)) { |
| 179 |
?> |
| 180 |
<div class="vbsrowpricediv"> |
| 181 |
<span class="room_cost"><?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat(($custprice ?: $r['cost'])), $currencysymb, ['<span class="vbo_currency">%s</span>', '<span class="vbo_price">%s</span>']); ?></span> |
| 182 |
<span class="vbliststartfrom"><?php echo $custpricetxt; ?></span> |
| 183 |
<?php |
| 184 |
if (!empty($custpricesubtxt)) { |
| 185 |
?> |
| 186 |
<div class="vbliststartfrom-subtxt"><?php echo $custpricesubtxt; ?></div> |
| 187 |
<?php |
| 188 |
} |
| 189 |
?> |
| 190 |
</div> |
| 191 |
<?php |
| 192 |
} |
| 193 |
?> |
| 194 |
|
| 195 |
</div> |
| 196 |
<div class="vbselectordiv"> |
| 197 |
<div class="vbselectr"> |
| 198 |
<a class="btn vbo-pref-color-btn" href="<?php echo $details_link; ?>"><?php echo JText::translate('VBSEARCHRESDETAILS'); ?></a> |
| 199 |
</div> |
| 200 |
</div> |
| 201 |
</div> |
| 202 |
</div> |
| 203 |
</div> |
| 204 |
</div> |
| 205 |
</li> |
| 206 |
<?php |
| 207 |
} |
| 208 |
?> |
| 209 |
</ul> |
| 210 |
</div> |
| 211 |
|
| 212 |
<?php |
| 213 |
// pagination |
| 214 |
if (strlen($navig) > 0) { |
| 215 |
?> |
| 216 |
<div class="pagination"><?php echo $navig; ?></div> |
| 217 |
<?php |
| 218 |
} |
| 219 |
|