|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @package midcom.helper |
|
4
|
|
|
* @author The Midgard Project, http://www.midgard-project.org |
|
5
|
|
|
* @copyright The Midgard Project, http://www.midgard-project.org |
|
6
|
|
|
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* This class is a host toolbar class. |
|
11
|
|
|
* |
|
12
|
|
|
* @package midcom.helper |
|
13
|
|
|
*/ |
|
14
|
|
|
class midcom_helper_toolbar_host extends midcom_helper_toolbar |
|
15
|
|
|
{ |
|
16
|
8 |
|
public function __construct() |
|
17
|
|
|
{ |
|
18
|
8 |
|
$config = midcom::get()->config; |
|
19
|
8 |
|
parent::__construct($config->get('toolbars_host_style_class'), $config->get('toolbars_host_style_id')); |
|
|
|
|
|
|
20
|
8 |
|
$this->label = midcom::get()->i18n->get_string('host', 'midcom'); |
|
21
|
8 |
|
$this->add_commands(); |
|
22
|
8 |
|
} |
|
23
|
|
|
|
|
24
|
8 |
|
private function add_commands() |
|
25
|
|
|
{ |
|
26
|
8 |
|
$buttons = []; |
|
27
|
8 |
|
if (midcom::get()->auth->user) { |
|
28
|
8 |
|
$buttons[] = [ |
|
29
|
8 |
|
MIDCOM_TOOLBAR_URL => midcom_connection::get_url('self') . "midcom-logout-", |
|
30
|
8 |
|
MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('logout', 'midcom'), |
|
31
|
8 |
|
MIDCOM_TOOLBAR_GLYPHICON => 'sign-out', |
|
32
|
8 |
|
MIDCOM_TOOLBAR_ACCESSKEY => 'l', |
|
33
|
|
|
]; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
8 |
|
$buttons[] = [ |
|
37
|
8 |
|
MIDCOM_TOOLBAR_URL => midcom_connection::get_url('self') . "__mfa/asgard/", |
|
38
|
8 |
|
MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('midgard.admin.asgard', 'midgard.admin.asgard'), |
|
39
|
8 |
|
MIDCOM_TOOLBAR_GLYPHICON => 'server', |
|
40
|
8 |
|
MIDCOM_TOOLBAR_ACCESSKEY => 'a', |
|
41
|
8 |
|
MIDCOM_TOOLBAR_ENABLED => midcom::get()->auth->can_user_do('midgard.admin.asgard:access', null, 'midgard_admin_asgard_plugin'), |
|
42
|
|
|
]; |
|
43
|
|
|
|
|
44
|
8 |
|
if (midcom_connection::is_admin()) { |
|
45
|
|
|
$buttons[] = [ |
|
46
|
|
|
MIDCOM_TOOLBAR_URL => midcom_connection::get_url('self') . "midcom-cache-invalidate", |
|
47
|
|
|
MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('invalidate cache', 'midcom'), |
|
48
|
|
|
MIDCOM_TOOLBAR_GLYPHICON => 'refresh', |
|
49
|
|
|
]; |
|
50
|
|
|
$workflow = new midcom\workflow\viewer; |
|
51
|
|
|
$buttons[] = $workflow->get_button(midcom_connection::get_url('self') . "midcom-config-test", [ |
|
52
|
|
|
MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('test settings', 'midcom'), |
|
53
|
|
|
MIDCOM_TOOLBAR_GLYPHICON => 'wrench', |
|
54
|
|
|
]); |
|
55
|
|
|
} |
|
56
|
8 |
|
$this->add_items($buttons); |
|
57
|
8 |
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|