PluginProbe
VikBooking Hotel Booking Engine & PMS / trunk
VikBooking Hotel Booking Engine & PMS vtrunk
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 1.7.3 All 36 releases
vikbooking / admin / layouts / taskmanager / tasks / selectarea.php

selectarea.php in VikBooking Hotel Booking Engine & PMS trunk, at admin/layouts/taskmanager/tasks/selectarea.php

65 lines 2.3 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 core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2025 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 * Obtain vars from arguments received in the layout file.
16 *
17 * @var array $data The data for rendering the areas/projects for single selection.
18 */
19 extract($displayData);
20
21 // determine the JS event to dispatch upon the selection of an area/project
22 $select_event = $data['select_event'] ?? 'vbo-tm-area-id-selected';
23
24 ?>
25 <div class="vbo-tm-areapicker-list">
26 <?php
27 // iterate over all the existing task areas
28 foreach (VBOTaskModelArea::getInstance()->getItems() as $area):
29 // wrap the area record into a registry
30 $taskArea = VBOTaskArea::getInstance((array) $area);
31 ?>
32 <div class="selectable-area-container">
33 <div class="area-info">
34 <div class="area-name">
35 <?php VikBookingIcons::e($taskArea->getIcon()); ?>&nbsp;<?php echo $taskArea->getName(); ?>
36 </div>
37 <?php if ($comments = $taskArea->get('comments')): ?>
38 <div class="area-comments">
39 <?php echo $comments; ?>
40 </div>
41 <?php endif; ?>
42 </div>
43 <div class="area-actions">
44 <button type="button" class="btn btn-success" data-area-id="<?php echo $taskArea->getID(); ?>" data-area-name="<?php echo $this->escape($taskArea->getName()); ?>"><?php echo JText::translate('VBO_SELECT'); ?></button>
45 </div>
46 </div>
47 <?php endforeach; ?>
48 </div>
49
50 <script>
51 /**
52 * Register the click events over the various areas/projects.
53 */
54 document.querySelectorAll('.vbo-tm-areapicker-list button[data-area-id]')
55 .forEach((button) => {
56 button.addEventListener('click', (e) => {
57 VBOCore.emitEvent('<?php echo $select_event; ?>', {
58 area: {
59 id: button.getAttribute('data-area-id'),
60 name: button.getAttribute('data-area-name'),
61 },
62 });
63 });
64 });
65 </script>