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