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 / admin / views / media / tmpl / default.php
vikappointments / admin / views / media / tmpl Last commit date
default.php 2 days ago index.html 2 days ago modal.php 2 days ago
default.php
330 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 JHtml::fetch('vaphtml.assets.fancybox');
15 JHtml::fetch('vaphtml.assets.fontawesome');
16
17 $rows = $this->rows;
18
19 $filters = $this->filters;
20
21 $vik = VAPApplication::getInstance();
22
23 $multi_lang = VikAppointments::isMultilanguage();
24
25 $canEdit = JFactory::getUser()->authorise('core.edit', 'com_vikappointments');
26
27 $gallery = array();
28
29 foreach ($rows as $media)
30 {
31 /**
32 * Append timestamp of creation date in order to
33 * automatically remove the cached image in case
34 * of changes to the media file.
35 *
36 * @since 1.7
37 */
38 $gallery[] = VAPMEDIA_URI . $media['name'] . '?' . $media['timestamp'];
39 }
40
41 $is_searching = $this->hasFilters();
42
43 /**
44 * Trigger event to display custom HTML.
45 * In case it is needed to include any additional fields,
46 * it is possible to create a plugin and attach it to an event
47 * called "onDisplayViewMediaList". The event method receives the
48 * view instance as argument.
49 *
50 * @since 1.7
51 */
52 $forms = $this->onDisplayListView($is_searching);
53
54 ?>
55
56 <form action="index.php?option=com_vikappointments" method="post" name="adminForm" id="adminForm">
57
58 <div class="btn-toolbar" style="height:32px;">
59 <div class="btn-group pull-left input-append">
60 <input type="text" name="keysearch" id="vapkeysearch" size="32"
61 value="<?php echo $this->escape($filters['keysearch']); ?>" placeholder="<?php echo $this->escape(JText::translate('JSEARCH_FILTER_SUBMIT')); ?>" />
62
63 <button type="submit" class="btn">
64 <i class="fas fa-search"></i>
65 </button>
66 </div>
67
68 <!-- Define role to detect the supported hook -->
69 <!-- {"rule":"customizer","event":"onDisplayViewMediaList","type":"search","key":"search"} -->
70
71 <?php
72 // plugins can use the "search" key to introduce custom
73 // filters within the search bar
74 if (isset($forms['search']))
75 {
76 echo $forms['search'];
77 }
78
79 // in case a plugin needs to use the filter bar, display the button
80 if (isset($forms['filters']))
81 {
82 ?>
83 <div class="btn-group pull-left">
84 <button type="button" class="btn <?php echo ($is_searching ? 'btn-primary' : ''); ?>" onclick="vapToggleSearchToolsButton(this);">
85 <?php echo JText::translate('JSEARCH_TOOLS'); ?>&nbsp;<i class="fas fa-caret-<?php echo ($is_searching ? 'up' : 'down'); ?>" id="vap-tools-caret"></i>
86 </button>
87 </div>
88 <?php
89 }
90 ?>
91
92 <div class="btn-group pull-left">
93 <button type="button" class="btn" onclick="clearFilters();">
94 <?php echo JText::translate('JSEARCH_FILTER_CLEAR'); ?>
95 </button>
96 </div>
97 </div>
98
99 <div class="btn-toolbar" id="vap-search-tools" style="height: 32px;<?php echo ($is_searching ? '' : 'display: none;'); ?>">
100
101 <!-- Define role to detect the supported hook -->
102 <!-- {"rule":"customizer","event":"onDisplayViewMediaList","type":"search","key":"filters"} -->
103
104 <?php
105 // plugins can use the "filters" key to introduce custom
106 // filters within the search bar
107 if (isset($forms['filters']))
108 {
109 echo $forms['filters'];
110 }
111 ?>
112
113 </div>
114
115 <?php
116 if (count($rows) == 0)
117 {
118 echo $vik->alert(JText::translate('JGLOBAL_NO_MATCHING_RESULTS'));
119 }
120 else
121 {
122 /**
123 * Trigger event to display custom columns.
124 *
125 * @since 1.7
126 */
127 $columns = $this->onDisplayTableColumns();
128 ?>
129
130 <!-- Define role to detect the supported hook -->
131 <!-- {"rule":"customizer","event":"onDisplayMediaTableTH","type":"th"} -->
132
133 <!-- Define role to detect the supported hook -->
134 <!-- {"rule":"customizer","event":"onDisplayMediaTableTD","type":"td"} -->
135
136 <table cellpadding="4" cellspacing="0" border="0" width="100%" class="<?php echo $vik->getAdminTableClass(); ?>">
137 <?php echo $vik->openTableHead(); ?>
138 <tr>
139
140 <th width="1%">
141 <?php echo $vik->getAdminToggle(count($rows)); ?>
142 </th>
143
144 <!-- NAME -->
145
146 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="32%" style="text-align: left;">
147 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEMEDIA2', 'name', $this->orderDir, $this->ordering); ?>
148 </th>
149
150 <!-- IMAGE SIZE -->
151
152 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="10%" style="text-align: center;">
153 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEMEDIA12', 'size', $this->orderDir, $this->ordering); ?>
154 </th>
155
156 <!-- FILE SIZE -->
157
158 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="10%" style="text-align: center;">
159 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEMEDIA13', 'filesize', $this->orderDir, $this->ordering); ?>
160 </th>
161
162 <!-- CUSTOM -->
163
164 <?php
165 foreach ($columns as $k => $col)
166 {
167 ?>
168 <th data-id="<?php echo $this->escape($k); ?>" class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>">
169 <?php echo $col->th; ?>
170 </th>
171 <?php
172 }
173 ?>
174
175 <!-- CREATION DATE -->
176
177 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="15%" style="text-align: center;">
178 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEMEDIA14', 'date', $this->orderDir, $this->ordering); ?>
179 </th>
180
181 <!-- LANGUAGES -->
182
183 <?php
184 if ($multi_lang && $canEdit)
185 {
186 ?>
187 <th class="<?php echo $vik->getAdminThClass(); ?>" width="8%" style="text-align: center;">
188 <?php echo JText::translate('VAPLANGUAGES');?>
189 </th>
190 <?php
191 }
192 ?>
193
194 <!-- IMAGE PREVIEW -->
195
196 <th class="<?php echo $vik->getAdminThClass(); ?>" width="15%" style="text-align: center;">
197 <?php echo JText::translate('VAPMANAGEMEDIA3'); ?>
198 </th>
199
200 </tr>
201 <?php echo $vik->closeTableHead(); ?>
202
203 <?php
204 for ($i = 0; $i < count($rows); $i++)
205 {
206 $row = $rows[$i];
207 ?>
208 <tr class="row<?php echo $i % 2; ?>">
209
210 <td>
211 <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row['name']; ?>" onClick="<?php echo $vik->checkboxOnClick(); ?>">
212 </td>
213
214 <!-- NAME -->
215
216 <td>
217 <div class="name break-word">
218 <?php
219 if ($canEdit)
220 {
221 ?>
222 <a href="index.php?option=com_vikappointments&amp;task=media.edit&amp;cid[]=<?php echo $row['name']; ?>"><?php echo $row['name']; ?></a>
223 <?php
224 }
225 else
226 {
227 echo $row['name'];
228 }
229 ?>
230 </div>
231 </td>
232
233 <!-- IMAGE SIZE -->
234
235 <td style="text-align: center;" class="hidden-phone">
236 <?php echo $row['width'] . ' x ' . $row['height']; ?>
237 </td>
238
239 <!-- FILE SIZE -->
240
241 <td style="text-align: center;" class="hidden-phone">
242 <?php echo $row['size']; ?>
243 </td>
244
245 <!-- CUSTOM -->
246
247 <?php
248 foreach ($columns as $k => $col)
249 {
250 ?>
251 <td data-id="<?php echo $this->escape($k); ?>" class="hidden-phone">
252 <?php echo isset($col->td[$i]) ? $col->td[$i] : ''; ?>
253 </td>
254 <?php
255 }
256 ?>
257
258 <!-- CREATION DATE -->
259
260 <td style="text-align: center;" class="hidden-phone">
261 <?php echo $row['creation']; ?>
262 </td>
263
264 <!-- LANGUAGES -->
265
266 <?php
267 if ($multi_lang && $canEdit)
268 {
269 ?>
270 <td style="text-align: center;">
271 <a href="index.php?option=com_vikappointments&amp;view=langmedia&amp;image=<?php echo $row['name']; ?>">
272 <?php
273 foreach ($row['languages'] as $lang)
274 {
275 echo ' ' . JHtml::fetch('vaphtml.site.flag', $lang) . ' ';
276 }
277 ?>
278 </a>
279 </td>
280 <?php
281 }
282 ?>
283
284 <!-- IMAGE PREVIEW -->
285
286 <td style="text-align: center;">
287 <a href="javascript: void(0);" class="vapmodal" onClick="vapOpenGallery(<?php echo $i; ?>);">
288 <img src="<?php echo VAPMEDIA_SMALL_URI . $row['name'] . '?' . $row['timestamp']; ?>" style="max-width: 64px;height: auto;" />
289 </a>
290 </td>
291
292 </tr>
293 <?php
294 }
295 ?>
296 </table>
297 <?php
298 }
299 ?>
300
301 <input type="hidden" name="boxchecked" value="0" />
302 <input type="hidden" name="task" value="" />
303 <input type="hidden" name="view" value="media" />
304
305 <input type="hidden" name="filter_order" value="<?php echo $this->ordering; ?>" />
306 <input type="hidden" name="filter_order_Dir" value="<?php echo $this->orderDir; ?>" />
307
308 <?php echo JHtml::fetch('form.token'); ?>
309 <?php echo $this->navbut; ?>
310 </form>
311
312 <script type="text/javascript">
313
314 function vapOpenGallery(index) {
315 var instance = vapOpenModalImage(<?php echo json_encode($gallery); ?>);
316
317 if (index > 0) {
318 // jump to selected image ('0' turns off the animation)
319 instance.jumpTo(index, 0);
320 }
321 }
322
323 function clearFilters() {
324 jQuery('#vapkeysearch').val('');
325
326 document.adminForm.submit();
327 }
328
329 </script>
330