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 / emparea / toolbar.php
vikappointments / site / layouts / emparea Last commit date
dayorders.php 6 days ago index.html 6 days ago toolbar.php 6 days ago
toolbar.php
211 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 $mainmenu = isset($displayData['mainmenu']) ? $displayData['mainmenu'] : array();
15 $sidemenu = isset($displayData['sidemenu']) ? $displayData['sidemenu'] : array();
16 $auth = isset($displayData['auth']) ? $displayData['auth'] : VAPEmployeeAuth::getInstance();
17 $active = isset($displayData['active']) ? $displayData['active'] : true;
18 $itemid = isset($displayData['itemid']) ? $displayData['itemid'] : null;
19
20 $input = JFactory::getApplication()->input;
21
22 if (is_null($itemid))
23 {
24 // item id not provided, get the current one (if set)
25 $itemid = $input->getInt('Itemid');
26 }
27
28 ?>
29
30 <div class="vapemplogintoolbardiv">
31
32 <?php
33 /**
34 * IMPORTANT.
35 * The following <div> tags must be stuck without spaces in order to avoid bad alignments
36 * while hovering with the mouse above the links.
37 *
38 * So, we must have this:
39 * </div><div>
40 *
41 * Instead of:
42 * </div>
43 * <div>
44 */
45 foreach ($mainmenu as $alias => $item)
46 {
47 if ($active)
48 {
49 if (!isset($item['query']))
50 {
51 $item['query'] = array();
52 }
53
54 if ($itemid)
55 {
56 // inject Itemid within the query string
57 $item['query']['Itemid'] = $itemid;
58 }
59
60 // build base URL
61 $url = 'index.php?option=com_vikappointments';
62
63 if ($item['query'])
64 {
65 // append query string to url
66 $url .= '&' . http_build_query($item['query']);
67 }
68 }
69 else
70 {
71 // always disable menu items
72 $item['active'] = false;
73 }
74 ?><div class="vapemploginactionlink<?php echo !$item['active'] ? 'disabled' : ''; ?> <?php echo !empty($item['selected']) ? 'item-active' : ''; ?>" data-id="<?php echo $this->escape($alias); ?>">
75 <a href="<?php echo $item['active'] ? JRoute::rewrite($url) : 'javascript:void(0)'; ?>">
76 <?php
77 if (!empty($item['icon']))
78 {
79 // check if the icon starts with a tag
80 if (preg_match("/^</", $item['icon']))
81 {
82 // HTML tag found, display as is
83 echo $item['icon'];
84 }
85 else
86 {
87 // FontAwesome icon assumed
88 ?>
89 <i class="<?php echo $this->escape($item['icon']); ?>"></i>
90 <?php
91 }
92 }
93
94 // display item title
95 echo @$item['title'];
96 ?>
97 </a>
98 </div><?php
99 }
100 ?>
101
102 <div class="vap-emplogin-rcont">
103
104 <div class="vap-emplogin-rbox">
105 <div class="vap-emplogin-rphoto">
106 <?php
107 if ($auth->image)
108 {
109 ?>
110 <a href="<?php echo JRoute::rewrite('index.php?option=com_vikappointments&view=emplogin' . ($itemid ? '&Itemid=' . $itemid : '')); ?>">
111 <img src="<?php echo VAPMEDIA_SMALL_URI . $auth->image; ?>" />
112 </a>
113 <?php
114 }
115 ?>
116 </div>
117
118 <div class="vap-emplogin-rtitle">
119 <?php if ($active): ?>
120 <a href="javascript:void(0)"><?php echo $auth->nickname; ?></a>
121 <?php else: ?>
122 <span><?php echo $auth->nickname; ?></span>
123 <?php endif; ?>
124 </div>
125 </div>
126
127 <?php
128 if ($sidemenu)
129 {
130 ?>
131 <div class="vap-emplogin-modal" style="display: none;">
132 <ul>
133 <?php
134 foreach ($sidemenu as $alias => $item)
135 {
136 if (!isset($item['query']))
137 {
138 $item['query'] = array();
139 }
140
141 if ($itemid)
142 {
143 // inject Itemid within the query string
144 $item['query']['Itemid'] = $itemid;
145 }
146
147 // build base URL
148 $url = 'index.php?option=com_vikappointments';
149
150 if ($item['query'])
151 {
152 // append query string to url
153 $url .= '&' . http_build_query($item['query']);
154 }
155 ?>
156 <li class="<?php echo $item['separator'] ? 'separator' : ''; ?> <?php echo !empty($item['selected']) ? 'item-active' : ''; ?>" data-id="<?php echo $this->escape($alias); ?>">
157 <a href="<?php echo JRoute::rewrite($url); ?>">
158 <?php
159 if (!empty($item['icon']))
160 {
161 // check if the icon starts with a tag
162 if (preg_match("/^</", $item['icon']))
163 {
164 // HTML tag found, display as is
165 echo $item['icon'];
166 }
167 else
168 {
169 // FontAwesome icon assumed
170 ?>
171 <i class="<?php echo $this->escape($item['icon']); ?>"></i>
172 <?php
173 }
174 }
175
176 // display item title
177 echo @$item['title'];
178 ?>
179 </a>
180 </li>
181 <?php
182 }
183 ?>
184 </ul>
185 </div>
186 <?php
187 }
188 ?>
189
190 </div>
191
192 </div>
193
194 <script>
195 (function($) {
196 'use strict';
197
198 $(function() {
199 <?php if ($active): ?>
200 $('html').click(() => {
201 $('.vap-emplogin-modal').hide();
202 });
203
204 $('.vap-emplogin-rtitle').click((event) => {
205 event.stopPropagation();
206 $('.vap-emplogin-modal').toggle();
207 });
208 <?php endif; ?>
209 });
210 })(jQuery);
211 </script>