PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / manageanalytics / view.html.php
vikappointments / admin / views / manageanalytics Last commit date
tmpl 4 years ago index.html 4 years ago view.html.php 2 years ago
view.html.php
98 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 * VikAppointments analytics management view.
16 *
17 * @since 1.7
18 */
19 class VikAppointmentsViewmanageanalytics extends JViewVAP
20 {
21 /**
22 * VikAppointments view display method.
23 *
24 * @return void
25 */
26 function display($tpl = null)
27 {
28 $app = JFactory::getApplication();
29 $input = $app->input;
30 $dbo = JFactory::getDbo();
31
32 // recover user state
33 $data = $app->getUserState('vap.statistics.data', array());
34
35 if (!empty($data['location']))
36 {
37 // get location from user state
38 $this->location = $data['location'];
39 }
40 else
41 {
42 // get location from request
43 $this->location = $input->get('location', 'dashboard', 'string');
44 }
45
46 switch ($this->location)
47 {
48 case 'dashboard':
49 case 'finance':
50 case 'appointments':
51 case 'services':
52 case 'employees':
53 case 'options':
54 case 'customers':
55 case 'packages':
56 case 'subscriptions':
57 // supported locations
58 break;
59
60 default:
61 throw new DomainException(sprintf('Analytic location [%s] is not supported', $this->location), 404);
62 }
63
64 // set the toolbar
65 $this->addToolBar();
66
67 VAPLoader::import('libraries.statistics.factory');
68
69 // load active widgets
70 $this->dashboard = VAPStatisticsFactory::getDashboard($this->location);
71
72 // get supported widgets
73 $this->supported = VAPStatisticsFactory::getSupportedWidgets($this->location);
74
75 // get supported positions
76 $this->positions = VAPStatisticsFactory::getSupportedPositions($this->location);
77
78 // display the template (default.php)
79 parent::display($tpl);
80 }
81
82 /**
83 * Setting the toolbar.
84 *
85 * @return void
86 */
87 private function addToolBar()
88 {
89 // add menu title and some buttons to the page
90 JToolbarHelper::title(JText::translate('VAPMAINTITLEVIEWDASHBOARD'), 'vikappointments');
91
92 JToolbarHelper::apply('analytics.save', JText::translate('VAPSAVE'));
93 JToolbarHelper::save('analytics.saveclose', JText::translate('VAPSAVEANDCLOSE'));
94
95 JToolbarHelper::cancel('analytics.cancel');
96 }
97 }
98