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 / manageapiuser / view.html.php
vikappointments / admin / views / manageapiuser Last commit date
tmpl 2 days ago index.html 2 days ago view.html.php 2 days ago
view.html.php
96 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 API user management view.
16 *
17 * @since 1.7
18 */
19 class VikAppointmentsViewmanageapiuser extends JViewVAP
20 {
21 /**
22 * VikAppointments view display method.
23 *
24 * @return void
25 */
26 function display($tpl = null)
27 {
28 $dbo = JFactory::getDbo();
29 $app = JFactory::getApplication();
30 $input = $app->input;
31
32 $ids = $input->getUint('cid', array());
33 $type = $ids ? 'edit' : 'new';
34
35 // set the toolbar
36 $this->addToolBar($type);
37
38 // get model
39 $model = JModelVAP::getInstance('apiuser');
40
41 // load API user details
42 $user = $model->getItem($ids ? $ids[0] : 0, $blank = true);
43
44 // use API user data stored in user state
45 $this->injectUserStateData($user, $model->getTable()->getUserStateData());
46
47 $this->user = $user;
48
49 // load all supported plugins
50 $this->plugins = VAPFactory::getApi()->getPluginsList();
51
52 // display the template
53 parent::display($tpl);
54 }
55
56 /**
57 * Setting the toolbar.
58 *
59 * @return void
60 */
61 protected function addToolBar($type)
62 {
63 // add menu title and some buttons to the page
64 if ($type == 'edit')
65 {
66 JToolBarHelper::title(JText::translate('VAPMAINTITLEEDITAPIUSER'), 'vikappointments');
67 }
68 else
69 {
70 JToolBarHelper::title(JText::translate('VAPMAINTITLENEWAPIUSER'), 'vikappointments');
71 }
72
73 $user = JFactory::getUser();
74
75 if ($user->authorise('core.edit', 'com_vikappointments')
76 || $user->authorise('core.create', 'com_vikappointments'))
77 {
78 JToolbarHelper::apply('apiuser.save', JText::translate('VAPSAVE'));
79 JToolbarHelper::save('apiuser.saveclose', JText::translate('VAPSAVEANDCLOSE'));
80 }
81
82 if ($user->authorise('core.edit', 'com_vikappointments')
83 && $user->authorise('core.create', 'com_vikappointments'))
84 {
85 JToolbarHelper::save2new('apiuser.savenew', JText::translate('VAPSAVEANDNEW'));
86 }
87
88 if ($type == 'edit' && $user->authorise('core.create', 'com_vikappointments'))
89 {
90 JToolbarHelper::save2copy('apiuser.savecopy', JText::translate('VAPSAVEASCOPY'));
91 }
92
93 JToolBarHelper::cancel('apiuser.cancel', $type == 'edit' ? 'JTOOLBAR_CLOSE' : 'JTOOLBAR_CANCEL');
94 }
95 }
96