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 / managetag / view.html.php
vikappointments / admin / views / managetag Last commit date
tmpl 2 days ago index.html 2 days ago view.html.php 2 days ago
view.html.php
90 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 tag management view.
16 *
17 * @since 1.7
18 */
19 class VikAppointmentsViewmanagetag 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('tag');
40
41 // load tag details
42 $tag = $model->getItem($ids ? $ids[0] : 0, $blank = true);
43
44 // use tag data stored in user state
45 $this->injectUserStateData($tag, 'vap.tag.data');
46
47 $this->tag = $tag;
48
49 // display the template
50 parent::display($tpl);
51 }
52
53 /**
54 * Setting the toolbar.
55 *
56 * @param string $type The view type ('edit' or 'new').
57 *
58 * @return void
59 */
60 private function addToolBar($type)
61 {
62 // add menu title and some buttons to the page
63 if ($type == 'edit')
64 {
65 JToolBarHelper::title(JText::translate('VAPMAINTITLEEDITTAG'), 'vikappointments');
66 }
67 else
68 {
69 JToolBarHelper::title(JText::translate('VAPMAINTITLENEWTAG'), 'vikappointments');
70 }
71
72 $user = JFactory::getUser();
73
74 if ($user->authorise('core.edit', 'com_vikappointments')
75 || $user->authorise('core.create', 'com_vikappointments'))
76 {
77 JToolbarHelper::apply('tag.save', JText::translate('VAPSAVE'));
78 JToolbarHelper::save('tag.saveclose', JText::translate('VAPSAVEANDCLOSE'));
79 }
80
81 if ($user->authorise('core.edit', 'com_vikappointments')
82 && $user->authorise('core.create', 'com_vikappointments'))
83 {
84 JToolbarHelper::save2new('tag.savenew', JText::translate('VAPSAVEANDNEW'));
85 }
86
87 JToolBarHelper::cancel('tag.cancel', $type == 'edit' ? 'JTOOLBAR_CLOSE' : 'JTOOLBAR_CANCEL');
88 }
89 }
90