PluginProbe
VikBooking Hotel Booking Engine & PMS / trunk
VikBooking Hotel Booking Engine & PMS vtrunk
1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 All 36 releases
vikbooking / admin / views / acl / view.html.php

view.html.php in VikBooking Hotel Booking Engine & PMS trunk, at admin/views/acl/view.html.php

94 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // No direct access
4 defined('ABSPATH') or die('No script kiddies please!');
5
6 jimport('joomla.application.component.view');
7 jimport('adapter.acl.access');
8
9 /**
10 * VikBooking ACL view.
11 * @wponly
12 *
13 * @since 1.0
14 */
15 class VikBookingViewAcl extends JView
16 {
17 /**
18 * @override
19 * View display method.
20 *
21 * @return void
22 */
23 public function display($tpl = null)
24 {
25 $app = JFactory::getApplication();
26 $input = $app->input;
27 $user = JFactory::getUser();
28
29 if (!$user->authorise('core.admin', 'com_vikbooking'))
30 {
31 wp_die(
32 '<h1>' . JText::translate('FATAL_ERROR') . '</h1>' .
33 '<p>' . JText::translate('RESOURCE_AUTH_ERROR') . '</p>',
34 403
35 );
36 }
37
38 $return = $input->getBase64('return', '');
39 $active = $input->getString('activerole', '');
40
41 // get roles
42 $roles = array();
43
44 foreach (wp_roles()->roles as $slug => $role)
45 {
46 $roles[$slug] = $role['name'];
47 }
48
49 // reverse the roles (from the lowest to the highest)
50 $roles = array_reverse($roles);
51
52 // get actions
53 $actions = JAccess::getActions('vikbooking');
54
55 if (empty($active))
56 {
57 if (count($user->roles))
58 {
59 $active = $user->roles[0];
60 }
61 else
62 {
63 $keys = array_keys($roles);
64 $active = array_shift($keys);
65 }
66 }
67
68 $this->roles = $roles;
69 $this->actions = $actions;
70 $this->user = $user;
71 $this->returnLink = $return;
72 $this->activeRole = $active;
73
74 $this->addToolbar();
75
76 // display parent
77 parent::display($tpl);
78 }
79
80 /**
81 * Helper method to setup the toolbar.
82 *
83 * @return void
84 */
85 public function addToolbar()
86 {
87 JToolbarHelper::title(JText::translate('VBOACLMENUTITLE'));
88
89 JToolbarHelper::apply('acl.save');
90 JToolbarHelper::save('acl.saveclose');
91 JToolbarHelper::cancel('acl.cancel');
92 }
93 }
94