PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / analytics / view.html.php
vikappointments / admin / views / analytics Last commit date
tmpl 2 years ago index.html 4 years ago view.html.php 2 years ago
view.html.php
78 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 view.
16 *
17 * @since 1.7
18 */
19 class VikAppointmentsViewanalytics 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 // get location
33 $this->location = $input->get('location', null, 'string');
34
35 switch ($this->location)
36 {
37 case 'finance':
38 case 'appointments':
39 case 'services':
40 case 'employees':
41 case 'options':
42 case 'customers':
43 case 'packages':
44 case 'subscriptions':
45 // supported locations
46 break;
47
48 default:
49 throw new DomainException(sprintf('Analytic location [%s] is not supported', $this->location), 404);
50 }
51
52 // set the toolbar
53 $this->addToolBar();
54
55 VAPLoader::import('libraries.statistics.factory');
56
57 // load active widgets
58 $this->dashboard = VAPStatisticsFactory::getDashboard($this->location);
59
60 // display the template (default.php)
61 parent::display($tpl);
62 }
63
64 /**
65 * Setting the toolbar.
66 *
67 * @return void
68 */
69 private function addToolBar()
70 {
71 // add menu title and some buttons to the page
72 JToolbarHelper::title(JText::translate('VAPMAINTITLEVIEWANALYTICS' . strtoupper($this->location)), 'vikappointments');
73
74 // add button to manage the widgets
75 JToolbarHelper::addNew('analytics.add', JText::translate('VAP_TOOLBAR_NEW_WIDGET'));
76 }
77 }
78