PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.6.4
VikBooking Hotel Booking Engine & PMS v1.6.4
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
vikbooking / site / views / showprc / tmpl / default.php

default.php in VikBooking Hotel Booking Engine & PMS 1.6.4, at site/views/showprc/tmpl/default.php

921 lines 37.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 $session = JFactory::getSession();
14 $search_tpl = VikBooking::searchResultsTmpl();
15 $vat_included = VikBooking::ivaInclusa();
16 $tax_summary = !$vat_included && VikBooking::showTaxOnSummaryOnly() ? true : false;
17 $is_package = false;
18 //packages may skip some room options
19 $skip_all_opt = false;
20 $only_forced_opt = false;
21 if (is_array($this->pkg) && count($this->pkg) > 0) {
22 $skip_all_opt = $this->pkg['showoptions'] == 3 ? true : $skip_all_opt;
23 $only_forced_opt = $this->pkg['showoptions'] == 2 ? true : $only_forced_opt;
24 $is_package = true;
25 }
26 //
27 $deftar_costs = [];
28 $deftar_basecosts = [];
29 $children_agepcent = false;
30 $pitemid = VikRequest::getInt('Itemid', '', 'request');
31 // single category filter
32 $pcategories = VikRequest::getString('categories', '', 'request');
33 // multiple category filters
34 $pcategory_ids = VikRequest::getVar('category_ids', []);
35 // pre-defined children age
36 $children_age = VikRequest::getVar('children_age', []);
37
38 $infocheckin = getdate($this->checkin);
39 $infocheckout = getdate($this->checkout);
40
41 $nowdf = VikBooking::getDateFormat();
42 if ($nowdf == "%d/%m/%Y") {
43 $df = 'd/m/Y';
44 } elseif ($nowdf == "%m/%d/%Y") {
45 $df = 'm/d/Y';
46 } else {
47 $df = 'Y/m/d';
48 }
49 $datesep = VikBooking::getDateSeparator();
50
51 $checkinforlink = date($df, $this->checkin);
52 $checkoutforlink = date($df, $this->checkout);
53
54 $discl = VikBooking::getDisclaimer();
55 $currencysymb = VikBooking::getCurrencySymb();
56 $showchildren = VikBooking::showChildrenFront();
57 $totadults = 0;
58 $totchildren = 0;
59
60 $peopleforlink = '';
61 foreach ($this->arrpeople as $aduchild) {
62 $totadults += $aduchild['adults'];
63 $totchildren += $aduchild['children'];
64 $peopleforlink .= '&adults[]='.$aduchild['adults'].'&children[]='.$aduchild['children'];
65 }
66 if (!empty($pcategories)) {
67 $peopleforlink .= '&categories=' . $pcategories;
68 }
69 if (is_array($pcategory_ids) && count($pcategory_ids)) {
70 foreach ($pcategory_ids as $pcid) {
71 $peopleforlink .= '&category_ids[]=' . $pcid;
72 }
73 }
74
75 $document = JFactory::getDocument();
76 //load jQuery
77 if (VikBooking::loadJquery()) {
78 JHtml::fetch('jquery.framework', true, true);
79 }
80
81 foreach ($this->rooms as $num => $r) {
82 if (strlen($r['moreimgs']) > 0) {
83 $document->addStyleSheet(VBO_SITE_URI.'resources/vikfxgallery.css');
84 JHtml::fetch('script', VBO_SITE_URI.'resources/vikfxgallery.js');
85 break;
86 }
87 }
88
89 $gallery_data = [];
90 foreach ($this->rooms as $num => $r) {
91 if (empty($r['moreimgs'])) {
92 continue;
93 }
94 $gallery_data[$num] = [];
95 $moreimages = explode(';;', $r['moreimgs']);
96 $imgcaptions = json_decode($r['imgcaptions'], true);
97 $usecaptions = is_array($imgcaptions);
98 foreach ($moreimages as $iind => $mimg) {
99 if (empty($mimg)) {
100 continue;
101 }
102 $img_alt = $usecaptions && !empty($imgcaptions[$iind]) ? $imgcaptions[$iind] : substr($mimg, 0, strpos($mimg, '.'));
103 array_push($gallery_data[$num], array(
104 'big' => VBO_SITE_URI . 'resources/uploads/big_' . $mimg,
105 'thumb' => VBO_SITE_URI . 'resources/uploads/thumb_' . $mimg,
106 'alt' => $img_alt,
107 'caption' => $usecaptions && !empty($imgcaptions[$iind]) ? $imgcaptions[$iind] : "",
108 ));
109 }
110 }
111 $vikfx = '
112 jQuery(document).ready(function() {
113 ';
114 foreach ($gallery_data as $num => $gallery) {
115 $vikfx .= '
116 window["vikfxgallery'.$num.'"] = jQuery("#vikfx-gallery'.$num.' a").vikFxGallery();
117 jQuery("#vikfx-gallery-previous-image'.$num.', #vikfx-gallery-next-image'.$num.'").click(function() {
118 if (typeof window["vikfxgallery'.$num.'"] !== "undefined") {
119 window["vikfxgallery'.$num.'"].open();
120 }
121 });';
122 }
123 $vikfx .= '
124 });
125 ';
126 if (count($gallery_data)) {
127 $document->addScriptDeclaration($vikfx);
128 }
129
130 $mod_rooms_data = [];
131 if (count($this->mod_booking)) {
132 // booking modification
133 $mod_rooms_data = VikBooking::loadOrdersRoomsData($this->mod_booking['id']);
134 ?>
135 <div class="vbo-booking-modification-helper">
136 <div class="vbo-booking-modification-helper-inner">
137 <div class="vbo-booking-modification-msg">
138 <span><?php echo JText::translate('VBOMODBOOKHELPSHOWPRC'); ?></span>
139 </div>
140 <div class="vbo-booking-modification-canc">
141 <a href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&task=cancelmodification&sid='.$this->mod_booking['sid'].'&id='.$this->mod_booking['id'].(!empty($pitemid) ? '&Itemid='.$pitemid : '')); ?>">
142 <?php VikBookingIcons::e('times-circle'); ?>
143 <?php echo JText::translate('VBOMODBOOKCANCMOD'); ?>
144 </a>
145 </div>
146 </div>
147 </div>
148 <?php
149 }
150
151 ?>
152
153 <div class="vbstepsbarcont">
154 <ol class="vbo-stepbar" data-vbosteps="4">
155 <?php
156 if ($is_package === true) {
157 ?>
158 <li class="vbo-step vbo-step-complete"><a href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&view=packageslist'.(!empty($pitemid) ? '&Itemid='.$pitemid : '')); ?>"><?php echo JText::translate('VBOPKGLINK'); ?></a></li>
159 <li class="vbo-step vbo-step-complete"><a href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&view=packagedetails&pkgid='.$this->pkg['id'].(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false); ?>"><?php echo JText::translate('VBSTEPROOMSELECTION'); ?></a></li>
160 <?php
161 } else {
162 if ($this->roomsnum < 2 && (int)$session->get('vboSearchRoomId', 0) == (int)$this->rooms[1]['id']) {
163 // we started the search from the room details page, so the dates link should point there
164 $dateslink = JRoute::rewrite('index.php?option=com_vikbooking&view=roomdetails&roomid='.$this->rooms[1]['id'].'&checkin='.$this->checkin.'&checkout='.$this->checkout.(!empty($pitemid) ? '&Itemid='.$pitemid : ''));
165 } else {
166 // link to general search form
167 $dateslink = JRoute::rewrite('index.php?option=com_vikbooking&view=vikbooking&checkin='.$this->checkin.'&checkout='.$this->checkout.(!empty($pitemid) ? '&Itemid='.$pitemid : ''));
168 }
169 ?>
170 <li class="vbo-step vbo-step-complete"><a href="<?php echo $dateslink; ?>"><?php echo JText::translate('VBSTEPDATES'); ?></a></li>
171 <li class="vbo-step vbo-step-complete"><a href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&task=search&checkindate='.urlencode($checkinforlink).'&checkoutdate='.urlencode($checkoutforlink).'&roomsnum='.$this->roomsnum.$peopleforlink.(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false); ?>"><?php echo JText::translate('VBSTEPROOMSELECTION'); ?></a></li>
172 <?php
173 }
174 ?>
175 <li class="vbo-step vbo-step-current"><span><?php echo JText::translate('VBSTEPOPTIONS'); ?></span></li>
176 <li class="vbo-step vbo-step-next"><span><?php echo JText::translate('VBSTEPCONFIRM'); ?></span></li>
177 </ol>
178 </div>
179
180 <div class="vbo-showprc-head-wrapper">
181 <div class="vbo-results-head vbo-results-head-showprc">
182 <div class="vbo-results-nights">
183 <?php VikBookingIcons::e((!empty($this->split_stay) ? 'random' : 'calendar'), 'vbo-pref-color-text'); ?>
184 <div class="vbo-results-head-det">
185 <span class="vbo-results-head-det-lbl"><?php echo JText::translate('VBSEARCHRESNIGHTS'); ?></span>
186 <span class="vbo-results-head-det-val"><?php echo $this->days; ?></span>
187 </div>
188 </div>
189 <?php
190 if ($this->roomsnum > 1) {
191 ?>
192 <div class="vbo-results-numrooms">
193 <?php VikBookingIcons::e('bed', 'vbo-pref-color-text'); ?>
194 <div class="vbo-results-head-det">
195 <span class="vbo-results-head-det-lbl"><?php echo JText::translate('VBSEARCHRESROOMS'); ?></span>
196 <span class="vbo-results-head-det-val"><?php echo $this->roomsnum; ?></span>
197 </div>
198 </div>
199 <?php
200 }
201 ?>
202 <div class="vbo-results-numadults">
203 <?php VikBookingIcons::e('male', 'vbo-pref-color-text'); ?>
204 <div class="vbo-results-head-det">
205 <span class="vbo-results-head-det-lbl"><?php echo JText::translate('VBSEARCHRESADULTS'); ?></span>
206 <span class="vbo-results-head-det-val"><?php echo $totadults; ?></span>
207 </div>
208 </div>
209 <?php
210 if ($showchildren && $totchildren > 0) {
211 ?>
212 <div class="vbo-results-numchildren">
213 <?php VikBookingIcons::e('child', 'vbo-pref-color-text'); ?>
214 <div class="vbo-results-head-det">
215 <span class="vbo-results-head-det-lbl"><?php echo JText::translate('VBSEARCHRESCHILDREN'); ?></span>
216 <span class="vbo-results-head-det-val"><?php echo $totchildren; ?></span>
217 </div>
218 </div>
219 <?php
220 }
221 ?>
222 <div class="vbcheckinroom">
223 <?php VikBookingIcons::e('sign-in', 'vbo-pref-color-text'); ?>
224 <div class="vbo-results-head-det">
225 <span class="vbo-results-head-det-lbl"><?php echo JText::translate('VBCHECKINONTHE'); ?></span>
226 <span class="vbo-results-head-det-val"><?php echo JText::sprintf('VBCHECKINOUTOF', VikBooking::sayDayMonth($infocheckin['mday']), VikBooking::sayMonth($infocheckin['mon'])); ?></span>
227 </div>
228 </div>
229 <div class="vbcheckoutroom">
230 <?php VikBookingIcons::e('sign-out', 'vbo-pref-color-text'); ?>
231 <div class="vbo-results-head-det">
232 <span class="vbo-results-head-det-lbl"><?php echo JText::translate('VBCHECKOUTONTHE'); ?></span>
233 <span class="vbo-results-head-det-val"><?php echo JText::sprintf('VBCHECKINOUTOF', VikBooking::sayDayMonth($infocheckout['mday']), VikBooking::sayMonth($infocheckout['mon'])); ?></span>
234 </div>
235 </div>
236 </div>
237
238 <form action="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&task=oconfirm'.(!empty($pitemid) ? '&Itemid='.$pitemid : '')); ?>" method="post">
239 <div class="vbo-showprc-wrapper vbo-showprc-wrapper-<?php echo $search_tpl; ?>">
240 <?php
241 foreach ($this->rooms as $num => $r) {
242 $ind = $num - 1;
243
244 // room amenities
245 $carats = VikBooking::getRoomCaratOriz($r['idcarat'], $this->vbo_tn);
246
247 // determine values to be considered
248 $room_nights = $this->days;
249 $room_checkin = $this->checkin;
250 $room_checkout = $this->checkout;
251 $is_split_room = false;
252 if (!empty($this->split_stay) && isset($this->split_stay[$ind]) && $this->split_stay[$ind]['idroom'] == $r['id']) {
253 $room_nights = $this->split_stay[$ind]['nights'];
254 $room_checkin = $this->split_stay[$ind]['checkin_ts'];
255 $room_checkout = $this->split_stay[$ind]['checkout_ts'];
256 $is_split_room = true;
257 }
258
259 // room options
260 $optionals = [];
261 if (!empty($r['idopt'])) {
262 $optionals = VikBooking::getRoomOptionals($r['idopt'], $this->vbo_tn);
263 VikBooking::filterOptionalsByDate($optionals, $room_checkin, $room_checkout);
264 VikBooking::filterOptionalsByParty($optionals, $this->arrpeople[$num]['adults'], $this->arrpeople[$num]['children']);
265 }
266 ?>
267 <div class="room_container">
268 <div class="vbo-showprc-room-head">
269 <?php
270 if ($this->roomsnum > 1) {
271 ?>
272 <div class="vbshowprcroomnum">
273 <?php
274 if ($is_split_room) {
275 ?>
276 <span class="vbo-showprc-roomnum-icn"><?php VikBookingIcons::e('random'); ?></span>
277 <?php
278 }
279 ?>
280 <span class="vbo-showprc-roomnum-num"><?php echo JText::translate('VBSEARCHROOMNUM') . ' ' . $num; ?></span>
281 </div>
282 <?php
283 }
284 ?>
285 <div class="vbo-showprc-staydetails">
286 <div class="vbo-showprc-staydetails-party">
287 <?php VikBookingIcons::e('users', 'vbo-pref-color-text'); ?>
288 <?php echo $this->arrpeople[$num]['adults']; ?> <?php echo ($this->arrpeople[$num]['adults'] == 1 ? JText::translate('VBSEARCHRESADULT') : JText::translate('VBSEARCHRESADULTS')); ?><?php echo ($showchildren && $this->arrpeople[$num]['children'] > 0 ? ", ".$this->arrpeople[$num]['children']." ".($this->arrpeople[$num]['children'] == 1 ? JText::translate('VBSEARCHRESCHILD') : JText::translate('VBSEARCHRESCHILDREN')) : ""); ?>
289 </div>
290 <?php
291 if ($is_split_room) {
292 ?>
293 <div class="vbo-showprc-staydetails-splitstay vbo-showprc-staydetails-nights">
294 <?php VikBookingIcons::e('moon', 'vbo-pref-color-text'); ?>
295 <?php echo $room_nights . ' ' . ($room_nights > 1 ? JText::translate('VBDAYS') : JText::translate('VBDAY')); ?>
296 </div>
297 <div class="vbo-showprc-staydetails-splitstay vbo-showprc-staydetails-checkin">
298 <?php VikBookingIcons::e('plane-arrival', 'vbo-pref-color-text'); ?>
299 <?php echo date(str_replace("/", $datesep, $df), $room_checkin); ?>
300 </div>
301 <div class="vbo-showprc-staydetails-splitstay vbo-showprc-staydetails-checkout">
302 <?php VikBookingIcons::e('plane-departure', 'vbo-pref-color-text'); ?>
303 <?php echo date(str_replace("/", $datesep, $df), $room_checkout); ?>
304 </div>
305 <?php
306 }
307 ?>
308 </div>
309 </div>
310 <div class="vbo-showprc-room-block<?php echo $this->roomsnum > 1 ? ' vbo-showprc-room-block-multi' : ''; ?>">
311 <div class="vbo-showprc-roomname">
312 <?php
313 $room_name = $r['name'];
314 // check if a sub-unit was requested
315 if (count($this->roomindex) && !empty($this->roomindex[($num - 1)])) {
316 $room_feature = VikBooking::getRoomUnitDistinctiveFeature($r['params'], $this->roomindex[($num - 1)]);
317 if ($room_feature !== false) {
318 $room_name .= ' - ' . $room_feature[0] . ' ' . $room_feature[1];
319 }
320 }
321 ?>
322 <h3><?php echo $room_name; ?></h3>
323 </div>
324 <div class="vbroomimgdesc">
325 <div class="vikfx-gallery-container vikfx-showprc-gallery-container">
326 <div class="vikfx-gallery-fade-container">
327 <?php
328 if (!empty($r['img']) && is_file(VBO_SITE_PATH . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . $r['img'])) {
329 ?>
330 <img alt="<?php echo htmlspecialchars($r['name']); ?>" src="<?php echo VBO_SITE_URI; ?>resources/uploads/<?php echo $r['img']; ?>" class="vikfx-gallery-image vblistimg"/>
331 <?php
332 }
333 if (isset($gallery_data[$num]) && count($gallery_data[$num])) {
334 ?>
335 <div class="vikfx-gallery-navigation-controls">
336 <div class="vikfx-gallery-navigation-controls-prevnext">
337 <a href="javascript: void(0);" class="vikfx-gallery-previous-image" id="vikfx-gallery-previous-image<?php echo $num; ?>"><?php VikBookingIcons::e('chevron-left'); ?></a>
338 <a href="javascript: void(0);" class="vikfx-gallery-next-image" id="vikfx-gallery-next-image<?php echo $num; ?>"><?php VikBookingIcons::e('chevron-right'); ?></a>
339 </div>
340 </div>
341 <?php
342 }
343 ?>
344 </div>
345 <?php
346 if (isset($gallery_data[$num]) && count($gallery_data[$num])) {
347 ?>
348 <div class="vikfx-gallery" id="vikfx-gallery<?php echo $num; ?>">
349 <?php
350 foreach ($gallery_data[$num] as $mimg) {
351 ?>
352 <a href="<?php echo $mimg['big']; ?>">
353 <img src="<?php echo $mimg['thumb']; ?>" alt="<?php echo htmlspecialchars($mimg['alt']); ?>" title="<?php echo htmlspecialchars($mimg['caption']); ?>"/>
354 </a>
355 <?php
356 }
357 ?>
358 </div>
359 <?php
360 }
361 ?>
362 </div>
363 <div class="room_description_box">
364 <?php
365 /**
366 * @wponly we try to parse any shortcode inside the HTML description of the room.
367 * @joomlaonly trigger onContentPrepare event for plugins.
368 */
369 if (VBOPlatformDetection::isWordPress()) {
370 echo do_shortcode(wpautop($r['info']));
371 } else {
372 JPluginHelper::importPlugin('content');
373 $myItem = JTable::getInstance('content');
374 $myItem->text = $r['info'];
375 $objparams = [];
376 if (class_exists('JEventDispatcher')) {
377 $dispatcher = JEventDispatcher::getInstance();
378 $dispatcher->trigger('onContentPrepare', array('com_vikbooking.roomdetails', &$myItem, &$objparams, 0));
379 } else {
380 /**
381 * @joomla4only
382 */
383 $dispatcher = JFactory::getApplication();
384 if (method_exists($dispatcher, 'triggerEvent')) {
385 $dispatcher->triggerEvent('onContentPrepare', array('com_vikbooking.roomdetails', &$myItem, &$objparams, 0));
386 }
387 }
388 $r['info'] = $myItem->text;
389 echo $r['info'];
390 }
391 ?>
392 </div>
393 </div>
394 <?php
395 if (!empty($carats)) {
396 ?>
397 <div class="room_carats">
398 <h4><?php echo JText::translate('VBCHARACTERISTICS'); ?></h4>
399 <?php echo $carats; ?>
400 </div>
401 <?php
402 }
403 ?>
404 <div class="room_prices">
405 <h4><?php echo JText::translate('VBPRICE'); ?></h4>
406 <div class="vbo-showprc-rateplans-wrapper">
407 <div class="vbo-showprc-pricetable">
408 <?php
409 $rate_plan_id = VikRequest::getInt('rate_plan_id', 0, 'request');
410 foreach ($this->tars[$num] as $k => $t) {
411 if ($is_package === true) {
412 // do not print the regular prices if a package was requested.
413 break;
414 }
415 $priceinfo = VikBooking::getPriceInfo($t['idprice'], $this->vbo_tn);
416 $priceinfostr = '';
417 $cancpolicy = '';
418 //
419 $priceinfostr = '<div class="vbpricedetails">';
420 if ($priceinfo['breakfast_included'] == 1) {
421 $priceinfostr .= '<span class="vbprice_breakfast">'.JText::translate('VBBREAKFASTINCLUDED').'</span>';
422 }
423 if ($priceinfo['free_cancellation'] == 1) {
424 if ((int)$priceinfo['canc_deadline'] > 0) {
425 $priceinfostr .= '<span class="vbprice_freecanc">'.JText::sprintf('VBFREECANCELLATIONWITHIN', $priceinfo['canc_deadline']).'</span>';
426 } else {
427 $priceinfostr .= '<span class="vbprice_freecanc">'.JText::translate('VBFREECANCELLATION').'</span>';
428 }
429 if (!empty($priceinfo['canc_policy'])) {
430 $priceinfostr .= '<span class="vbo-cancpolicy-trig" onclick="var cancelem=document.getElementById(\'vbo-cancpolicy-cont'.$priceinfo['id'].'\').style.display;if(cancelem == \'block\'){document.getElementById(\'vbo-cancpolicy-cont'.$priceinfo['id'].'\').style.display = \'none\';}else{document.getElementById(\'vbo-cancpolicy-cont'.$priceinfo['id'].'\').style.display = \'block\';}"><i class="'.VikBookingIcons::i('question-circle').'"></i></span>';
431 $cancpolicy = '<div class="vbo-cancpolicy-cont" id="vbo-cancpolicy-cont'.$priceinfo['id'].'" style="display: none;">'.(strpos($priceinfo['canc_policy'], '<') !== false ? $priceinfo['canc_policy'] : nl2br($priceinfo['canc_policy'])).'</div>';
432 }
433 } else {
434 $priceinfostr .= '<span class="vbprice_freecanc vbprice_freecanc_no">'.JText::translate('VBONONREFUNDRATE').'</span>';
435 }
436 $priceinfostr .= '</div>';
437 $priceinfostr .= $cancpolicy;
438 //
439 $rplan_cost = ($tax_summary ? $t['cost'] : VikBooking::sayCostPlusIva($t['cost'], $t['idprice']));
440 $room_basecost = isset($t['room_base_cost']) ? $t['room_base_cost'] : $t['cost'];
441 $rplan_basecost = ($tax_summary ? $room_basecost : VikBooking::sayCostPlusIva($room_basecost, $t['idprice']));
442 if (!array_key_exists($num, $deftar_costs)) {
443 $deftar_costs[$num] = $rplan_cost;
444 }
445 if (!array_key_exists($num, $deftar_basecosts)) {
446 $deftar_basecosts[$num] = $rplan_basecost;
447 }
448 ?>
449 <div class="vbo-showprc-price-entry">
450 <div class="vbo-showprc-price-entry-radio">
451 <input type="radio" class="vbo-radio" data-roomnum="<?php echo $num; ?>" data-ratecost="<?php echo $rplan_cost; ?>" data-ratecostbase="<?php echo $rplan_basecost; ?>" name="priceid<?php echo $num; ?>" id="pid<?php echo $num.$t['idprice']; ?>" value="<?php echo $t['idprice']; ?>"<?php echo (($k == 0 && empty($rate_plan_id)) || $rate_plan_id == $t['idprice'] ? " checked=\"checked\"" : ""); ?>/>
452 </div>
453 <div class="vbo-showprc-price-entry-rateplan">
454 <label for="pid<?php echo $num.$t['idprice']; ?>"><?php echo $priceinfo['name']; ?></label>
455 <?php
456 if (strlen($t['attrdata'])) {
457 ?>
458 <div class="vbo-showprc-price-entry-rateattribute">
459 <span><?php echo VikBooking::getPriceAttr($t['idprice'], $this->vbo_tn); ?></span>
460 <?php echo $t['attrdata']; ?>
461 </div>
462 <?php
463 }
464 ?>
465 <?php echo $priceinfostr; ?>
466 </div>
467 <div class="vbo-showprc-price-entry-cost vbo-pref-color-text">
468 <span class="room_cost">
469 <span class="vbo_currency"><?php echo $currencysymb; ?></span>
470 <span class="vbo_price"><?php echo VikBooking::numberFormat($rplan_cost); ?></span>
471 </span>
472 <?php
473 if (isset($t['promotion']) && isset($t['promotion']['discount'])) {
474 if ($t['promotion']['discount']['pcent']) {
475 /**
476 * Do not make an upper-cent operation, but rather calculate the original price proportionally:
477 * final price : (100 - discount amount) = x : 100
478 */
479 $prev_amount = $rplan_cost * 100 / (100 - $t['promotion']['discount']['amount']);
480 } else {
481 $prev_amount = $rplan_cost + $t['promotion']['discount']['amount'];
482 }
483 if ($prev_amount > 0) {
484 ?>
485 <div class="vbo-room-result-price-before-discount">
486 <span class="room_cost">
487 <span class="vbo_currency"><?php echo $currencysymb; ?></span>
488 <span class="vbo_price"><?php echo VikBooking::numberFormat($prev_amount); ?></span>
489 </span>
490 </div>
491 <?php
492 if ($t['promotion']['discount']['pcent']) {
493 // hide by default the DIV containing the percent of discount
494 ?>
495 <div class="vbo-room-result-price-before-discount-percent" style="display: none;">
496 <span class="room_cost">
497 <span><?php echo '-' . (float)$t['promotion']['discount']['amount'] . ' %'; ?></span>
498 </span>
499 </div>
500 <?php
501 }
502 }
503 }
504 ?>
505 </div>
506 </div>
507 <?php
508 }
509 if ($is_package === true) {
510 $pkg_cost = $this->pkg['pernight_total'] == 1 ? ($this->pkg['cost'] * $this->days) : $this->pkg['cost'];
511 $base_pkg_cost = ($tax_summary ? $pkg_cost : VikBooking::sayPackagePlusIva($pkg_cost, $this->pkg['idiva']));
512 if (!array_key_exists($num, $deftar_costs)) {
513 $deftar_costs[$num] = $base_pkg_cost;
514 }
515 if (!array_key_exists($num, $deftar_basecosts)) {
516 $deftar_basecosts[$num] = $base_pkg_cost;
517 }
518 $pkg_cost = $this->pkg['perperson'] == 1 ? ($pkg_cost * ($this->arrpeople[$num]['adults'] > 0 ? $this->arrpeople[$num]['adults'] : 1)) : $pkg_cost;
519 ?>
520 <div class="vbo-showprc-price-entry vbo-showprc-price-pkg">
521 <div class="vbo-showprc-price-entry-radio">
522 <input type="radio" class="vbo-radio" data-roomnum="<?php echo $num; ?>" data-ratecost="<?php echo $base_pkg_cost; ?>" data-ratecostbase="<?php echo $base_pkg_cost; ?>" name="priceid<?php echo $num; ?>" id="pid<?php echo $num.$this->pkg['id']; ?>" value="<?php echo $this->pkg['id']; ?>" checked="checked"/>
523 </div>
524 <div class="vbo-showprc-price-entry-rateplan">
525 <label for="pid<?php echo $num.$this->pkg['id']; ?>"><?php echo $this->pkg['name']; ?></label>
526 </div>
527 <div class="vbo-showprc-price-entry-cost vbo-pref-color-text">
528 <span class="vbo_currency"><?php echo $currencysymb; ?></span>
529 <span class="vbo_price"><?php echo ($tax_summary ? VikBooking::numberFormat($pkg_cost) : VikBooking::numberFormat(VikBooking::sayPackagePlusIva($pkg_cost, $this->pkg['idiva']))); ?></span>
530 </div>
531 </div>
532 <?php
533 }
534 ?>
535 </div>
536 <?php
537 // BEGIN: Children Age Intervals
538 if (!empty($r['idopt']) && !empty($optionals)) {
539 list($optionals, $ageintervals) = VikBooking::loadOptionAgeIntervals($optionals, $this->arrpeople[$num]['adults'], $this->arrpeople[$num]['children']);
540 if (is_array($ageintervals) && count($ageintervals) > 0 && $this->arrpeople[$num]['children'] > 0 && $skip_all_opt !== true) {
541 ?>
542 <div class="vbageintervals">
543 <?php
544 /**
545 * @wponly we need to let WordPress parse the paragraphs in the message.
546 */
547 if (VBOPlatformDetection::isWordPress()) {
548 echo wpautop($ageintervals['descr']);
549 } else {
550 echo $ageintervals['descr'];
551 }
552 ?>
553 <div class="vbo-showprc-child-fees-wrapper">
554 <?php
555 for ($ch = 1; $ch <= $this->arrpeople[$num]['children']; $ch++) {
556 /**
557 * Age intervals may be overridden per child number.
558 *
559 * @since 1.13.5
560 */
561 $intervals = explode(';;', (isset($ageintervals['ageintervals_child' . $ch]) ? $ageintervals['ageintervals_child' . $ch] : $ageintervals['ageintervals']));
562 //
563 ?>
564 <div class="vbo-showprc-child-fee">
565 <span><?php echo JText::translate('VBSEARCHRESCHILD') . ' #' . $ch; ?></span>
566 <select name="optid<?php echo $num . $ageintervals['id']; ?>[]">
567 <?php
568 foreach ($intervals as $kintv => $intv) {
569 if (empty($intv)) {
570 continue;
571 }
572 $intvparts = explode('_', $intv);
573 $intvparts[2] = intval($ageintervals['perday']) == 1 ? ($intvparts[2] * $this->tars[$num][0]['days']) : $intvparts[2];
574 if (!empty($ageintervals['maxprice']) && $ageintervals['maxprice'] > 0 && $intvparts[2] > $ageintervals['maxprice']) {
575 $intvparts[2] = $ageintervals['maxprice'];
576 }
577 $intvparts[2] = $tax_summary ? $intvparts[2] : VikBooking::sayOptionalsPlusIva($intvparts[2], $ageintervals['idiva']);
578 $pricestr = floatval($intvparts[2]) >= 0 ? '+ '.VikBooking::numberFormat($intvparts[2]) : '- '.VikBooking::numberFormat($intvparts[2]);
579 $pcent_interval = false;
580 $opt_suffix = '';
581 if (array_key_exists(3, $intvparts) && strpos($intvparts[3], '%') !== false && array_key_exists($num, $deftar_costs) && floatval($intvparts[2]) >= 0) {
582 $children_agepcent = true;
583 $pcent_interval = true;
584 if (strpos($intvparts[3], '%b') !== false) {
585 // VBO 1.10 - percentage value of room base cost
586 $opt_suffix = 'base';
587 $pcent_cost = $deftar_basecosts[$num] * (float)$intvparts[2] / 100;
588 $pricestr = '+ '.VikBooking::numberFormat($pcent_cost);
589 } else {
590 // percentage value of adults tariff
591 $pcent_cost = $deftar_costs[$num] * (float)$intvparts[2] / 100;
592 $pricestr = '+ '.VikBooking::numberFormat($pcent_cost);
593 }
594 }
595 /**
596 * Check if this age interval should be pre-selected for the given children age (if any).
597 *
598 * @since 1.15.0 (J) - 1.5.0 (WP)
599 */
600 $age_intval_selected = false;
601 if (is_array($children_age) && isset($children_age[($ch - 1)]) && is_numeric($children_age[($ch - 1)])) {
602 $age_intval_selected = ($intvparts[0] <= $children_age[($ch - 1)] && $intvparts[1] >= $children_age[($ch - 1)]);
603 }
604 ?>
605 <option value="<?php echo ($kintv + 1); ?>"<?php echo ($age_intval_selected ? ' selected="selected"' : '').($pcent_interval === true ? ' data-pcentintvroom="'.$num.'" data-ratetype="'.$opt_suffix.'" data-pcentintv="'.floatval($intvparts[2]).'" data-ageintv="'.$intvparts[0].' - '.$intvparts[1].'"' : ''); ?>><?php echo "{$intvparts[0]} - {$intvparts[1]} ({$pricestr} {$currencysymb})"; ?></option>
606 <?php
607 }
608 ?>
609 </select>
610 </div>
611 <?php
612 }
613 ?>
614 </div>
615 </div>
616 <?php
617 }
618 }
619 // END: Children Age Intervals
620 ?>
621 </div>
622 </div>
623
624 <?php
625 if (!empty($r['idopt']) && !empty($optionals) && $skip_all_opt !== true) {
626 $optechoed = 0;
627 $titlewritten = false;
628 $arrforcesummary = [];
629 foreach ($optionals as $k => $o) {
630 $showoptional = true;
631 if (intval($o['ifchildren']) == 1 && $this->arrpeople[$num]['children'] < 1) {
632 $showoptional = false;
633 }
634 if ($only_forced_opt === true && intval($o['forcesel']) != 1) {
635 $showoptional = false;
636 }
637 if ($showoptional !== true) {
638 continue;
639 }
640 // VBO 1.11 - options percentage cost of the room total fee
641 $o['cost'] = (int)$o['pcentroom'] ? ($deftar_costs[$num] * $o['cost'] / 100) : $o['cost'];
642 //
643 $optcost = intval($o['perday']) == 1 ? ($o['cost'] * $this->tars[$num][0]['days']) : $o['cost'];
644 if (!empty($o['maxprice']) && $o['maxprice'] > 0 && $optcost > $o['maxprice']) {
645 $optcost = $o['maxprice'];
646 }
647 if ($o['perperson'] == 1) {
648 $optcost = $optcost * $this->arrpeople[$num]['adults'];
649 }
650 $optcost = $optcost * 1;
651
652 $forcesummary = false;
653 if (intval($o['forcesel']) == 1) {
654 $forcedquan = 1;
655 $forceperday = false;
656 $forceperchild = false;
657 if (strlen($o['forceval']) > 0) {
658 $forceparts = explode("-", $o['forceval']);
659 $forcedquan = intval($forceparts[0]);
660 $forceperday = intval($forceparts[1]) == 1 ? true : false;
661 $forceperchild = intval($forceparts[2]) == 1 ? true : false;
662 $forcesummary = intval($forceparts[3]) == 1 ? true : false;
663 }
664 $setoptquan = $forceperday == true ? ($forcedquan * $this->tars[$num][0]['days']) : $forcedquan;
665 $setoptquan = $forceperchild == true ? ($setoptquan * $this->arrpeople[$num]['children']) : $setoptquan;
666 if ($forcesummary === true) {
667 $optquaninp = "<input type=\"hidden\" name=\"optid".$num.$o['id']."\" value=\"".$setoptquan."\"/>";
668 $arrforcesummary[] = $optquaninp;
669 } else {
670 if (intval($o['hmany']) == 1) {
671 $optquaninp = "<input type=\"hidden\" name=\"optid".$num.$o['id']."\" value=\"".$setoptquan."\"/><span class=\"vboptionforcequant\"><small>x</small> ".$setoptquan."</span>";
672 } else {
673 $optquaninp = "<input type=\"hidden\" name=\"optid".$num.$o['id']."\" value=\"".$setoptquan."\"/><span class=\"vboptionforcequant\"><small>x</small> ".$setoptquan."</span>";
674 }
675 }
676 } else {
677 /**
678 * During a booking modification, we pre-select the previous options for this party, if any.
679 *
680 * @since 1.15.0 (J) - 1.5.0 (WP)
681 */
682 $opt_selected = false;
683 if (count($mod_rooms_data) && isset($mod_rooms_data[($num - 1)]) && !empty($mod_rooms_data[($num - 1)]['optionals'])) {
684 $prev_party_opts = explode(';', $mod_rooms_data[($num - 1)]['optionals']);
685 foreach ($prev_party_opts as $prev_party_opt) {
686 if (empty($prev_party_opt)) {
687 continue;
688 }
689 $prev_party_opt_parts = explode(':', $prev_party_opt);
690 if (count($prev_party_opt_parts) < 2 || empty($prev_party_opt_parts[0]) || $prev_party_opt_parts[0] != $o['id']) {
691 continue;
692 }
693 $opt_sep = strpos($prev_party_opt_parts[1], '-');
694 $opt_prev_quant = $opt_sep !== false ? substr($prev_party_opt_parts[1], 0, $opt_sep) : $prev_party_opt_parts[1];
695 $opt_selected = $opt_prev_quant > 0 ? $opt_prev_quant : $opt_selected;
696 }
697 }
698
699 if (intval($o['hmany']) == 1) {
700 if (intval($o['maxquant']) > 0) {
701 $optquaninp = "<select name=\"optid".$num.$o['id']."\">\n";
702 for ($ojj = 0; $ojj <= intval($o['maxquant']); $ojj++) {
703 $optquaninp .= "<option value=\"".$ojj."\"" . ($opt_selected !== false && $opt_selected == $ojj ? ' selected="selected"' : '') . ">".$ojj."</option>\n";
704 }
705 $optquaninp .= "</select>\n";
706 } else {
707 $optquaninp = "<input type=\"number\" min=\"0\" step=\"any\" name=\"optid".$num.$o['id']."\" value=\"" . ($opt_selected !== false ? $opt_selected : '0') . "\"/>";
708 }
709 } else {
710 $optquaninp = "<input type=\"checkbox\" name=\"optid".$num.$o['id']."\" value=\"1\"" . ($opt_selected !== false ? ' checked="checked"' : '') . "/>";
711 }
712 }
713
714 if ($forcesummary === false) {
715 if (!$titlewritten) {
716 $titlewritten = true;
717 ?>
718 <div class="room_options">
719 <h4><?php echo JText::translate('VBACCOPZ'); ?></h4>
720 <div class="vbo-showprc-optionstable">
721 <?php
722 }
723 $optechoed++;
724 ?>
725 <div class="vbo-showprc-option-entry">
726 <div class="vbo-showprc-option-entry-img">
727 <?php echo (!empty($o['img']) ? '<img class="maxthirty" src="'.VBO_SITE_URI.'resources/uploads/'.$o['img'].'"/>' : '&nbsp;'); ?>
728 </div>
729 <div class="vbo-showprc-option-entry-name">
730 <?php echo $o['name']; ?>
731 <?php
732 if (strlen(strip_tags( trim($o['descr'] )))) {
733 ?>
734 <div class="vbo-showprc-option-entry-descr">
735 <?php
736 /**
737 * @wponly we need to let WordPress parse the paragraphs in the message.
738 */
739 if (VBOPlatformDetection::isWordPress()) {
740 echo wpautop($o['descr']);
741 } else {
742 echo $o['descr'];
743 }
744 ?>
745 </div>
746 <?php
747 }
748 ?>
749 </div>
750 <div class="vbo-showprc-option-entry-cost">
751 <span class="vbo_currency"><?php echo $currencysymb; ?></span>
752 <span class="vbo_price"><?php echo $tax_summary ? VikBooking::numberFormat($optcost) : VikBooking::numberFormat(VikBooking::sayOptionalsPlusIva($optcost, $o['idiva'])); ?></span>
753 </div>
754 <div class="vbo-showprc-option-entry-input">
755 <?php echo $optquaninp; ?>
756 </div>
757 </div>
758 <?php
759 }
760 }
761 if ($optechoed > 0) {
762 ?>
763 </div>
764 <?php
765 }
766 if (count($arrforcesummary) > 0) {
767 echo implode("\n", $arrforcesummary);
768 }
769 if ($optechoed > 0) {
770 ?>
771 </div>
772 <?php
773 }
774 }
775 ?>
776 </div>
777
778 </div>
779 <input type="hidden" name="roomid[]" value="<?php echo $r['id']; ?>"/>
780 <?php
781 }
782 ?>
783 </div>
784 <?php
785
786 foreach ($this->arrpeople as $indroom => $aduch) {
787 ?>
788 <input type="hidden" name="adults[]" value="<?php echo $aduch['adults']; ?>"/>
789 <?php
790 if ($showchildren) {
791 ?>
792 <input type="hidden" name="children[]" value="<?php echo $aduch['children']; ?>"/>
793 <?php
794 }
795 }
796 ?>
797 <input type="hidden" id="roomsnum" name="roomsnum" value="<?php echo $this->roomsnum; ?>"/>
798 <input type="hidden" name="days" value="<?php echo $this->days; ?>"/>
799 <input type="hidden" name="checkin" value="<?php echo $this->checkin; ?>"/>
800 <input type="hidden" name="checkout" value="<?php echo $this->checkout; ?>"/>
801 <input type="hidden" name="categories" value="<?php echo $pcategories; ?>"/>
802 <input type="hidden" name="task" value="oconfirm"/>
803 <?php
804 if (is_array($pcategory_ids) && count($pcategory_ids)) {
805 foreach ($pcategory_ids as $pcid) {
806 ?>
807 <input type="hidden" name="category_ids[]" value="<?php echo $pcid; ?>"/>
808 <?php
809 }
810 }
811 if (!empty($pitemid)) {
812 ?>
813 <input type="hidden" name="Itemid" value="<?php echo $pitemid; ?>"/>
814 <?php
815 }
816 if ($is_package === true) {
817 ?>
818 <input type="hidden" name="pkg_id" value="<?php echo $this->pkg['id']; ?>"/>
819 <?php
820 }
821 if ($is_package === true && !empty($this->pkg['benefits'])) {
822 ?>
823 <div class="vbo-pkg-showprc-benefits"><?php echo $this->pkg['benefits']; ?></div>
824 <?php
825 }
826 if (strlen($discl)) {
827 ?>
828 <div class="room_disclaimer"><?php echo $discl; ?></div>
829 <?php
830 }
831 if ($is_package === true && !empty($this->pkg['conditions'])) {
832 ?>
833 <div class="room_disclaimer vbo-pkg-showprc-conditions"><?php echo $this->pkg['conditions']; ?></div>
834 <?php
835 }
836 ?>
837 <div class="room_buttons_box">
838 <div class="goback">
839 <?php
840 if ($is_package === true) {
841 ?>
842 <a class="vbo-goback-link vbo-pref-color-btn-secondary" href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&view=packagedetails&pkgid='.$this->pkg['id'].(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false); ?>"><?php echo JText::translate('VBBACK'); ?></a>
843 <?php
844 } else {
845 ?>
846 <a class="vbo-goback-link vbo-pref-color-btn-secondary" href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&task=search&checkindate='.urlencode($checkinforlink).'&checkoutdate='.urlencode($checkoutforlink).'&roomsnum='.$this->roomsnum.$peopleforlink.(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false); ?>"><?php echo JText::translate('VBBACK'); ?></a>
847 <?php
848 }
849 ?>
850 </div>
851 <input type="submit" name="goon" value="<?php echo JText::translate('VBBOOKNOW'); ?>" class="btn booknow vbo-pref-color-btn"/>
852 </div>
853 <?php
854 /**
855 * Keep any previously selected room index through the interactive geomap, if any.
856 */
857 foreach ($this->roomindex as $rindex) {
858 ?>
859 <input type="hidden" name="roomindex[]" value="<?php echo $rindex; ?>"/>
860 <?php
861 }
862
863 if (!empty($this->split_stay)) {
864 // add hidden fields for the split stay booking
865 foreach ($this->split_stay as $spsk => $sps_room) {
866 foreach ($sps_room as $sps_room_k => $sps_room_v) {
867 if ($sps_room_k == 'checkin_ts' || $sps_room_k == 'checkout_ts') {
868 // these values are better to be re-calculated
869 continue;
870 }
871 ?>
872 <input type="hidden" name="split_stay[<?php echo $spsk; ?>][<?php echo $sps_room_k; ?>]" value="<?php echo JHtml::fetch('esc_attr', $sps_room_v); ?>" />
873 <?php
874 }
875 }
876 }
877 ?>
878 </form>
879 </div>
880 <?php
881 if ($children_agepcent === true) {
882 $formatvals = VikBooking::getNumberFormatData();
883 $formatparts = explode(':', $formatvals);
884 ?>
885 <script type="text/javascript">
886 Number.prototype.numFormat = function(c, d, t) {
887 var n = this,
888 c = isNaN(c = Math.abs(c)) ? 2 : c,
889 d = d == undefined ? "." : d,
890 t = t == undefined ? "," : t,
891 i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
892 j = (j = i.length) > 3 ? j % 3 : 0;
893 return (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
894 };
895
896 jQuery(function() {
897 jQuery(".vbo-radio").change(function() {
898 var rnum = jQuery(this).attr("data-roomnum");
899 var rcost = parseFloat(jQuery(this).attr("data-ratecost"));
900 var rcostbase = parseFloat(jQuery(this).attr("data-ratecostbase"));
901 if (!isNaN(rcost) && jQuery("option[data-pcentintvroom='"+rnum+"']").length > 0) {
902 jQuery("option[data-pcentintvroom='"+rnum+"']").each(function() {
903 var usecost = rcost;
904 var ratetype = jQuery(this).attr('data-ratetype');
905 if (ratetype == 'base') {
906 usecost = rcostbase;
907 }
908 var pcentval = parseFloat(jQuery(this).attr("data-pcentintv"));
909 var agesval = jQuery(this).attr("data-ageintv");
910 if (!isNaN(pcentval) && agesval.length) {
911 var intvcost = usecost * pcentval / 100;
912 jQuery(this).html(agesval+" (+ "+(intvcost).numFormat(<?php echo $formatparts[0]; ?>, '<?php echo $formatparts[1]; ?>', '<?php echo $formatparts[2]; ?>')+" <?php echo $currencysymb; ?>)");
913 }
914 });
915 }
916 });
917 });
918 </script>
919 <?php
920 }
921