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 / layouts / analytics / dashboard.php
vikappointments / admin / layouts / analytics Last commit date
config.php 3 days ago dashboard.php 3 days ago index.html 3 days ago script.php 3 days ago
dashboard.php
155 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 array $dashboard An array
18 */
19 extract($displayData);
20
21 $vik = VAPApplication::getInstance();
22
23 ?>
24
25 <!-- WIDGETS -->
26
27 <div class="row-fluid" id="statistics-wrapper" style="margin-top: 20px;">
28
29 <?php
30 foreach ($dashboard as $position => $widgets)
31 {
32 ?>
33 <div class="dashboard-widgets-container" data-position="<?php echo $position; ?>">
34
35 <?php
36 foreach ($widgets as $i => $widget)
37 {
38 $id = $widget->getID();
39
40 // widen or shorten the widget
41 switch ($widget->getSize())
42 {
43 // force EXTRA SMALL width : (100% / N) - (100% / (N * 2))
44 case 'extra-small':
45 $width = 'width: calc((100% / ' . count($widgets) . ') - (100% / ' . (count($widgets) * 2) . '));';
46 break;
47
48 // force SMALL width : (100% / N) - (100% / (N * 4))
49 case 'small':
50 $width = 'width: calc((100% / ' . count($widgets) . ') - (100% / ' . (count($widgets) * 4) . '));';
51 break;
52
53 // force NORMAL width : (100% / N)
54 case 'normal':
55 $width = 'width: calc(100% / ' . count($widgets) . ');';
56 break;
57
58 // force LARGE width : (100% / N) + (100% / (N * 4))
59 case 'large':
60 $width = 'width: calc((100% / ' . count($widgets) . ') + (100% / ' . (count($widgets) * 4) . '));';
61 break;
62
63 // force EXTRA LARGE width : (100% / N) + (100% / (N * 2))
64 case 'extra-large':
65 $width = 'width: calc((100% / ' . count($widgets) . ') + (100% / ' . (count($widgets) * 2) . '));';
66 break;
67
68 // fallback to flex basis to take the remaining space
69 default:
70 $width = 'flex: 1;';
71 }
72 ?>
73 <div
74 class="dashboard-widget"
75 id="widget-<?php echo $id; ?>"
76 data-widget="<?php echo $widget->getName(); ?>"
77 style="<?php echo $width; ?>"
78 >
79
80 <div class="widget-wrapper">
81 <div class="widget-head">
82 <h3><?php echo $widget->getTitle(); ?></h3>
83
84 <div class="widget-actions">
85 <?php
86 // check whether the widget supports export functions
87 $exportable = $widget->isExportable();
88
89 if ($exportable)
90 {
91 foreach ((array) $exportable as $func)
92 {
93 // build export URL
94 $url = 'index.php?option=com_vikappointments&task=analytics.export&id=' . $id . '&widget=' . $widget->getName();
95
96 if (!is_bool($func))
97 {
98 // append export rule to URL
99 $url .= '&rule=' . $func;
100 }
101
102 // switch export function to find the best icon
103 switch ($func)
104 {
105 case 'html':
106 $icon = 'fas fa-file-code';
107 break;
108
109 case 'print':
110 $icon = 'fas fa-print';
111 break;
112
113 case 'raw':
114 $icon = 'fas fa-file-alt';
115 break;
116
117 default:
118 $icon = 'fas fa-download';
119 }
120 ?>
121 <a href="<?php echo $vik->addUrlCSRF($url, $xhtml = true); ?>" target="_blank" class="widget-export-btn no-underline">
122 <i class="<?php echo $this->escape($icon); ?>"></i>
123 </a>
124 <?php
125 }
126 }
127 ?>
128
129 <a href="javascript:void(0)" data-id="<?php echo $id; ?>" class="widget-config-btn no-underline">
130 <i class="fas fa-ellipsis-h"></i>
131 </a>
132 </div>
133 </div>
134
135 <div class="widget-body">
136 <?php echo $widget->display(); ?>
137 </div>
138
139 <div class="widget-error-box" style="display: none;">
140 <?php echo $vik->alert(JText::translate('VAP_AJAX_GENERIC_ERROR'), 'error'); ?>
141 </div>
142 </div>
143
144 </div>
145 <?php
146 }
147 ?>
148
149 </div>
150 <?php
151 }
152 ?>
153
154 </div>
155