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 / availability / tmpl / default.php

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

266 lines 10.0 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 $rooms = $this->rooms;
14 $tsstart = $this->tsstart;
15 $wmonthsel = $this->wmonthsel;
16 $busy = $this->busy;
17 $vbo_tn = $this->vbo_tn;
18
19 $currencysymb = VikBooking::getCurrencySymb();
20 $showpartlyres=VikBooking::showPartlyReserved();
21 $vbdateformat = VikBooking::getDateFormat();
22 if ($vbdateformat == "%d/%m/%Y") {
23 $df = 'd/m/Y';
24 } elseif ($vbdateformat == "%m/%d/%Y") {
25 $df = 'm/d/Y';
26 } else {
27 $df = 'Y/m/d';
28 }
29 $datesep = VikBooking::getDateSeparator();
30
31 $document = JFactory::getDocument();
32 //load jQuery
33 if (VikBooking::loadJquery()) {
34 //JHtml::fetch('jquery.framework', true, true);
35 JHtml::fetch('script', VBO_SITE_URI.'resources/jquery-1.12.4.min.js');
36 }
37
38 $pmonth = VikRequest::getInt('month', '', 'request');
39 $pshowtype = VikRequest::getInt('showtype', 2, 'request');
40 //1 = do not show the units - 2 = show the units remaning - 3 = show the number of units booked.
41 $pshowtype = $pshowtype >= 1 && $pshowtype <= 3 ? $pshowtype : 1;
42 $pitemid = VikRequest::getString('Itemid', '', 'request');
43
44 $begin_info = getdate($tsstart);
45
46 $rids_qstring = '';
47 foreach ($rooms as $room) {
48 $rids_qstring .= '&room_ids[]=' . $room['id'];
49 }
50
51 $inonout_allowed = true;
52 $timeopst = VikBooking::getTimeOpenStore();
53 if (is_array($timeopst)) {
54 if ($timeopst[0] < $timeopst[1]) {
55 // check-in not allowed on a day where there is already a check out (no arrivals/depatures on the same day)
56 $inonout_allowed = false;
57 }
58 }
59
60 ?>
61 <h3><?php echo JText::translate('VBOAVAILABILITYCALENDAR'); ?></h3>
62
63 <div class="vbo-availability-controls">
64 <form action="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&view=availability' . $rids_qstring . (!empty($pitemid) ? '&Itemid='.$pitemid : '')); ?>" method="post" name="vbmonths">
65 <?php echo $wmonthsel; ?>
66 <?php
67 foreach ($rooms as $room) {
68 ?>
69 <input type="hidden" name="room_ids[]" value="<?php echo $room['id']; ?>" />
70 <?php
71 }
72 ?>
73 <input type="hidden" name="showtype" value="<?php echo $pshowtype; ?>" />
74 </form>
75 <div class="vblegendediv">
76 <span class="vblegenda"><span class="vblegenda-status vblegfree">&nbsp;</span> <span class="vblegenda-lbl"> <?php echo JText::translate('VBLEGFREE'); ?></span></span>
77 <?php
78 if ($showpartlyres) {
79 ?>
80 <span class="vblegenda"><span class="vblegenda-status vblegwarning">&nbsp;</span> <span class="vblegenda-lbl"> <?php echo JText::translate('VBLEGWARNING'); ?></span></span>
81 <?php
82 }
83 ?>
84 <span class="vblegenda"><span class="vblegenda-status vblegbusy">&nbsp;</span> <span class="vblegenda-lbl"> <?php echo JText::translate('VBLEGBUSY'); ?></span></span>
85 </div>
86 </div>
87
88 <?php
89 $check = is_array($busy) && count($busy) > 0 ? true : false;
90 $days_labels = array(
91 JText::translate('VBSUN'),
92 JText::translate('VBMON'),
93 JText::translate('VBTUE'),
94 JText::translate('VBWED'),
95 JText::translate('VBTHU'),
96 JText::translate('VBFRI'),
97 JText::translate('VBSAT')
98 );
99 ?>
100 <div class="vbo-availability-wrapper">
101 <?php
102 foreach ($rooms as $rk => $room) {
103 $nowts = $begin_info;
104 $carats = VikBooking::getRoomCaratOriz($room['idcarat'], $vbo_tn);
105 ?>
106 <div class="vbo-availability-room-container">
107 <div class="vbo-availability-room-details">
108 <div class="vbo-availability-room-details-first">
109 <div class="vbo-availability-room-details-left">
110 <?php
111 if (!empty($room['img'])) {
112 ?>
113 <img src="<?php echo VBO_SITE_URI; ?>resources/uploads/<?php echo $room['img']; ?>" alt="<?php echo htmlspecialchars($room['name']); ?>"/>
114 <?php
115 }
116 ?>
117 </div>
118 <div class="vbo-availability-room-details-right">
119 <h4><?php echo $room['name']; ?></h4>
120 <div class="vbo-availability-room-details-descr">
121 <?php echo $room['smalldesc']; ?>
122 </div>
123 <?php
124 if (!empty($carats)) {
125 ?>
126 <div class="room_carats">
127 <?php echo $carats; ?>
128 </div>
129 <?php
130 }
131 ?>
132 </div>
133 </div>
134 <div class="vbo-availability-room-details-last vbselectr">
135 <div class="vbo-availability-room-details-last-inner">
136 <a class="btn vbo-pref-color-btn" id="vbo-av-btn-<?php echo $room['id']; ?>" href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&view=roomdetails&roomid='.$room['id'].'&checkin=-1'.(!empty($pitemid) ? '&Itemid='.$pitemid : '')); ?>"><?php echo JText::translate('VBAVAILBOOKNOW'); ?></a>
137 </div>
138 <div class="vbo-availability-room-details-last-checkin" id="vbo-av-checkin-<?php echo $room['id']; ?>"><?php VikBookingIcons::e('sign-in', 'vbo-pref-color-element'); ?> <span></span></div>
139 </div>
140 </div>
141 <div class="vbo-availability-room-monthcal table-responsive">
142 <table class="table" id="vbo-av-table-<?php echo $room['id']; ?>" data-room-table="<?php echo $room['id']; ?>">
143 <tr class="vbo-availability-room-monthdays">
144 <td class="vbo-availability-month-name vbo-pref-color-text" rowspan="2"><?php echo VikBooking::sayMonth($nowts['mon'])." ".$nowts['year']; ?></td>
145 <?php
146 $mon = $nowts['mon'];
147 while ($nowts['mon'] == $mon) {
148 ?>
149 <td class="vbo-availability-month-day">
150 <span class="vbo-availability-daynumber"><?php echo $nowts['mday']; ?></span>
151 <span class="vbo-availability-weekday"><?php echo $days_labels[$nowts['wday']]; ?></span>
152 </td>
153 <?php
154 $next = $nowts['mday'] + 1;
155 $dayts = mktime(0, 0, 0, $nowts['mon'], $next, $nowts['year']);
156 $nowts = getdate($dayts);
157 }
158 ?>
159 </tr>
160 <tr class="vbo-availability-room-avdays">
161 <?php
162 $nowts = getdate($tsstart);
163 $mon = $nowts['mon'];
164 while ($nowts['mon'] == $mon) {
165 $dclass = "vbo-free-cell";
166 $is_checkin = false;
167 $is_checkout = false;
168 $dlnk = "";
169 $totfound = 0;
170 if (array_key_exists($room['id'], $busy) && count($busy[$room['id']]) > 0) {
171 foreach ($busy[$room['id']] as $b) {
172 $info_in = getdate($b['checkin']);
173 $checkin_ts = mktime(0, 0, 0, $info_in['mon'], $info_in['mday'], $info_in['year']);
174 $info_out = getdate($b['checkout']);
175 $checkout_ts = mktime(0, 0, 0, $info_out['mon'], $info_out['mday'], $info_out['year']);
176 if ($nowts[0] >= $checkin_ts && $nowts[0] == $checkout_ts) {
177 $is_checkout = true;
178 }
179 if ($nowts[0] >= $checkin_ts && $nowts[0] < $checkout_ts) {
180 $totfound++;
181 $dclass = "vbo-occupied-cell";
182 if ($nowts[0] == $checkin_ts) {
183 $is_checkin = true;
184 }
185 }
186 }
187 }
188 $useday = ($nowts['mday'] < 10 ? "0".$nowts['mday'] : $nowts['mday']);
189 $dclass .= ($totfound < $room['units'] && $totfound > 0 ? ' vbo-partially-cell' : '');
190
191 // partially reserved days can be disabled from the configuration
192 $dclass = !$showpartlyres && $totfound < $room['units'] && $totfound > 0 ? 'vbo-free-cell' : $dclass;
193 if ($is_checkout && $room['units'] < 2 && !$inonout_allowed) {
194 // in case check-in on check-out is disabled, add the occupied class for the check-out date
195 $totfound = 1;
196 $dclass = "vbo-occupied-cell";
197 }
198
199 // check if the date is closed at property-level
200 if (!$totfound && VikBooking::validateClosingDates($nowts[0], ($nowts[0] + 86399))) {
201 // this date is closed at property-level
202 $totfound = $room['units'];
203 $dclass = "vbo-occupied-cell";
204 }
205
206 $show_day_units = $totfound;
207 if ($pshowtype == 1) {
208 $show_day_units = '';
209 } elseif ($pshowtype == 2 && $totfound >= 1) {
210 $show_day_units = ($room['units'] - $totfound);
211 $show_day_units = $show_day_units < 0 ? 0 : $show_day_units;
212 } elseif ($pshowtype == 3 && $totfound >= 1) {
213 $show_day_units = $totfound;
214 }
215 if (!$showpartlyres && $totfound < $room['units'] && $totfound > 0) {
216 $show_day_units = '';
217 }
218 if ($totfound == 1) {
219 $dclass .= $is_checkin === true ? ' vbo-checkinday-cell' : '';
220 $dclass .= $is_checkout === true ? ' vbo-checkoutday-cell' : '';
221 $dlnk = "<span class=\"vbo-availability-day-container\" data-units-booked=\"".$totfound."\" data-units-left=\"".($room['units'] - $totfound)."\">".$show_day_units."</span>";
222 } elseif ($totfound > 1) {
223 $dlnk = "<span class=\"vbo-availability-day-container\" data-units-booked=\"".$totfound."\" data-units-left=\"".($room['units'] - $totfound)."\">".$show_day_units."</span>";
224 }
225 ?>
226 <td class="<?php echo $dclass; ?>" data-cell-date="<?php echo date(str_replace("/", $datesep, $df), $nowts[0]); ?>" data-cell-ts="<?php echo $nowts[0]; ?>"><?php echo $dlnk; ?></td>
227 <?php
228 $next = $nowts['mday'] + 1;
229 $dayts = mktime(0, 0, 0, $nowts['mon'], $next, $nowts['year']);
230 $nowts = getdate($dayts);
231 }
232 ?>
233 </tr>
234 </table>
235 </div>
236 </div>
237 <?php
238 }
239 ?>
240 </div>
241 <script type="text/javascript">
242 jQuery(document).ready(function() {
243 jQuery(".vbo-free-cell, .vbo-partially-cell").click(function() {
244 var idroom = jQuery(this).closest("table").attr("data-room-table");
245 var celldate = jQuery(this).attr("data-cell-date");
246 var cellts = jQuery(this).attr("data-cell-ts");
247 if (idroom.length && celldate.length && cellts.length) {
248 jQuery("#vbo-av-checkin-"+idroom).hide().find("span").text("");
249 if (jQuery("#vbo-av-btn-"+idroom).length) {
250 var btnlink = jQuery("#vbo-av-btn-"+idroom).attr("href");
251 if (jQuery(this).hasClass("vbo-cell-selected-arrival")) {
252 jQuery("#vbo-av-table-"+idroom).find("tr").find("td").removeClass("vbo-cell-selected-arrival");
253 jQuery("#vbo-av-checkin-"+idroom).fadeOut().find("span").text(celldate);
254 btnlink = btnlink.replace(/(checkin=)[^\&]+/, '$1' + "-1");
255 } else {
256 jQuery("#vbo-av-table-"+idroom).find("tr").find("td").removeClass("vbo-cell-selected-arrival");
257 jQuery(this).addClass("vbo-cell-selected-arrival");
258 jQuery("#vbo-av-checkin-"+idroom).fadeIn().find("span").text(celldate);
259 btnlink = btnlink.replace(/(checkin=)[^\&]+/, '$1' + cellts);
260 }
261 jQuery("#vbo-av-btn-"+idroom).attr("href", btnlink);
262 }
263 }
264 });
265 });
266 </script>