PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / site / layouts / timeline / ratesgrid.php
vikappointments / site / layouts / timeline Last commit date
default.php 5 days ago dropdown.php 5 days ago index.html 5 days ago ratesgrid.php 5 days ago seats.php 5 days ago table.php 5 days ago
ratesgrid.php
105 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 /**
15 * Layout variables
16 * -----------------
17 * @var VAPAvailabilityTimeline $timeline The timeline to render.
18 */
19 extract($displayData);
20
21 $config = VAPFactory::getConfig();
22 $currency = VAPFactory::getCurrency();
23
24 $time_format = $config->get('timeformat');
25 $show_checkout = $config->getBool('showcheckout');
26
27 $tz = VikAppointments::getUserTimezone();
28
29 $titles_lookup = array(
30 JText::translate('VAPFINDRESTIMENOAV'),
31 JText::translate('VAPFINDRESBOOKNOW'),
32 JText::translate('VAPFINDRESNOENOUGHTIME'),
33 );
34
35 foreach ($timeline as $times)
36 {
37 ?>
38 <div class="vaptimelinewt">
39 <?php
40 foreach ($times as $time)
41 {
42 $clickEvent = '';
43
44 // get hour and minutes
45 $hour = (int) $time->checkin('G');
46 $min = (int) $time->checkin('i');
47
48 if ($time->isAvailable())
49 {
50 // allow time block to be clicked
51 $clickEvent = "vapTimeClicked($hour, $min, this);";
52 }
53
54 $title = $titles_lookup[$time->status];
55
56 /**
57 * Extract class suffix from fetched rates.
58 *
59 * @since 1.6.2
60 */
61 $rate_class = VAPSpecialRates::extractClass($time->ratesTrace);
62
63 if (!$rate_class)
64 {
65 // use default class
66 $rate_class = ' generic-rate';
67 }
68
69 ?>
70 <a href="javascript:void(0)" title="<?php echo $this->escape($title); ?>" onClick="<?php echo $clickEvent; ?>">
71 <div
72 class="ratesgrid vap-timeline-block vaptlblock<?php echo $time->status . $rate_class; ?>"
73 data-rate="<?php echo $time->price; ?>"
74 data-hour="<?php echo $hour; ?>"
75 data-min="<?php echo $min; ?>"
76 >
77 <span class="vap-timeline-itemdate">
78 <i class="fas fa-clock"></i>
79 <?php
80 echo $time->checkin($time_format, $tz);
81
82 /**
83 * Display checkout time if enabled.
84 *
85 * @since 1.6.2
86 */
87 if ($show_checkout)
88 {
89 echo ' - ' . $time->checkout($time_format, $tz);
90 }
91 ?>
92 </span>
93
94 <span class="vap-timeline-itemprice">
95 <?php echo $currency->format($time->price); ?>
96 </span>
97 </div>
98 </a>
99 <?php
100 }
101 ?>
102 </div>
103 <?php
104 }
105