-
Notifications
You must be signed in to change notification settings - Fork 0
/
UploadMediasPlugin.php
92 lines (80 loc) · 2.39 KB
/
UploadMediasPlugin.php
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
class UploadMediasPlugin extends BaseApplicationPlugin
{
# -------------------------------------------------------
private $opo_config;
private $ops_plugin_path;
# -------------------------------------------------------
public function __construct($ps_plugin_path)
{
$this->ops_plugin_path = $ps_plugin_path;
$this->description = "";
parent::__construct();
$ps_plugin_path = __CA_BASE_DIR__ . "/app/plugins/UploadMedias";
if (file_exists($ps_plugin_path . '/conf/local/UploadMedias.conf')) {
$this->opo_config = Configuration::load($ps_plugin_path . '/conf/local/UploadMedias.conf');
} else {
$this->opo_config = Configuration::load($ps_plugin_path . '/conf/UploadMedias.conf');
}
}
# -------------------------------------------------------
/**
* Override checkStatus() to return true - the ampasFrameImporterPlugin plugin always initializes ok
*/
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()) {
$va_menu_items = array();
$va_menu_items['upload_medias'] = array(
'displayName' => _t('Uload Medias'),
"default" => array(
'module' => 'UploadMedias',
'controller' => 'Upload',
'action' => 'Index'
)
);
$pa_menu_bar["Import"]["navigation"]["upload_medias"] = $va_menu_items['upload_medias'];
}
//var_dump($pa_menu_bar["Import"]["navigation"]);die();
return $pa_menu_bar;
}
# -------------------------------------------------------
/**
* Get plugin user actions
*/
static public function getRoleActionList() {
return array(
'can_use_upload_medias_plugin' => array(
'label' => "Can use UploadMedias plugin",
'description' => "Can use UploadMedias plugin"
),
);
}
# -------------------------------------------------------
/**
* Add plugin user actions
*/
public function hookGetRoleActionList($pa_role_list) {
$pa_role_list['can_use_upload_medias_plugin'] = array(
'label' => _t('Plugin UploadMedias'),
'description' => _t('Actions pour le plugin UploadMedias'),
'actions' => UploadMediasPlugin::getRoleActionList()
);
return $pa_role_list;
}
}
?>