-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDateTimeConfiguratorPlugin.php
More file actions
66 lines (58 loc) · 1.95 KB
/
DateTimeConfiguratorPlugin.php
File metadata and controls
66 lines (58 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
class DateTimeConfiguratorPlugin extends BaseApplicationPlugin {
# -------------------------------------------------------
protected $description = null;
private $opo_config;
private $ops_plugin_path;
# -------------------------------------------------------
public function __construct($ps_plugin_path) {
$this->ops_plugin_path = $ps_plugin_path;
$this->description = _t('DateTime configurator plugin');
parent::__construct();
$this->opo_config = Configuration::load($ps_plugin_path.'/conf/DateTimeConfigurator.conf');
}
# -------------------------------------------------------
/**
* Override checkStatus() to return true - the statisticsViewerPlugin always initializes ok... (part to complete)
*/
public function checkStatus() {
return array(
'description' => $this->getDescription(),
'errors' => array(),
'warnings' => array(),
'available' => ((bool)$this->opo_config->get('enabled'))
);
}
# -------------------------------------------------------
/**
* Insert activity menu
*/
public function hookRenderMenuBar($pa_menu_bar) {
if ($o_req = $this->getRequest()) {
if(!(bool)$this->opo_config->get('enabled')) { return $pa_menu_bar; }
if (isset($pa_menu_bar['manage'])) {
$va_menu_items = $pa_menu_bar['manage']['navigation'];
if (!is_array($va_menu_items)) { $va_menu_items = array(); }
} else {
$va_menu_items = array();
}
$va_menu_items['DateTimeConfigator'] = array(
'displayName' => _t('Gestion des dates'),
"default" => array(
'module' => 'DateTimeConfigurator',
'controller' => 'DateTime',
'action' => 'Index'
)
);
if (isset($pa_menu_bar['manage'])) {
$pa_menu_bar['manage']['navigation'] = $va_menu_items;
} else {
$pa_menu_bar['manage'] = array(
'displayName' => _t('manage'),
'navigation' => $va_menu_items
);
}
}
return $pa_menu_bar;
}
}