forked from pluginsGLPI/satisfaction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.php
77 lines (63 loc) · 2.65 KB
/
setup.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
<?php
/**
* Init the hooks of the plugins -Needed
*/
function plugin_init_satisfaction() {
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['satisfaction'] = true;
$PLUGIN_HOOKS['change_profile']['satisfaction'] = ['PluginSatisfactionProfile', 'initProfile'];
$plugin = new Plugin();
if ($plugin->isInstalled('satisfaction') && $plugin->isActivated('satisfaction')) {
$PLUGIN_HOOKS['item_get_datas']['satisfaction'] = ['NotificationTargetTicket' => ['PluginSatisfactionSurveyAnswer',
'addNotificationDatas']];
//if glpi is loaded
if (Session::getLoginUserID()) {
Plugin::registerClass('PluginSatisfactionProfile',
['addtabon' => 'Profile']);
$PLUGIN_HOOKS['pre_item_form']['satisfaction'] = ['PluginSatisfactionSurveyAnswer', 'displaySatisfaction'];
$PLUGIN_HOOKS['pre_item_update']['satisfaction']['TicketSatisfaction'] = ['PluginSatisfactionSurveyAnswer',
'preUpdateSatisfaction'];
//current user must have config rights
if (Session::haveRight('plugin_satisfaction', READ)) {
$config_page = 'front/survey.php';
$PLUGIN_HOOKS['config_page']['satisfaction'] = $config_page;
$PLUGIN_HOOKS["menu_toadd"]['satisfaction'] = ['admin' => 'PluginSatisfactionMenu'];
}
}
}
}
/**
* Get the name and the version of the plugin - Needed
*
* @return array
*/
function plugin_version_satisfaction() {
$author = "<a href='www.teclib.com'>TECLIB'</a>";
$author.= ", <a href='http://infotel.com/services/expertise-technique/glpi/'>Infotel</a>";
return ['name' => __("More satisfaction", 'satisfaction'),
'version' => '1.2.1',
'author' => $author,
'license' => 'GPLv2+',
'homepage' => 'https://github.com/pluginsGLPI/satisfaction',
'minGlpiVersion' => '9.2'];
}
/**
* Optional : check prerequisites before install : may print errors or add to message after redirect
*
* @return bool
*/
function plugin_satisfaction_check_prerequisites() {
if (version_compare(GLPI_VERSION, '9.2', 'lt') || version_compare(GLPI_VERSION, '9.3', 'ge')) {
echo __('This plugin requires GLPI >= 9.2', 'satisfaction');
return false;
}
return true;
}
/**
* Uninstall process for plugin : need to return true if succeeded : may display messages or add to message after redirect
*
* @return bool
*/
function plugin_satisfaction_check_config() {
return true;
}