-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.php
85 lines (70 loc) · 2.15 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
78
79
80
81
82
83
84
85
<?php
define('Gamification', '1.0');
/**
* Init the hooks of the plugins - Needed
*
* @return void
*/
function plugin_init_gamification() {
global $PLUGIN_HOOKS;
//required!
$PLUGIN_HOOKS['csrf_compliant']['gamification'] = true;
Plugin::registerClass('PluginGamificationScore');
Plugin::registerClass('PluginCustomfieldsDropdowns');
$PLUGIN_HOOKS['item_update']['gamification'] = ['Ticket' => 'plugin_add_score',
'TicketSatisfaction' => 'plugin_add_score_satisfaction'];
$PLUGIN_HOOKS['item_update']['gamification'] = ['TicketSatisfaction' => 'plugin_add_score_satisfaction'];
if (Session::haveRight('config', UPDATE)) {
$PLUGIN_HOOKS['config_page']['gamification'] = 'config.php';
}
$_SESSION["glpi_plugin_gamification_profile"]['gamification'] = 'w';
if (isset($_SESSION["glpi_plugin_gamification_profile"])) {
$PLUGIN_HOOKS['menu_toadd']['gamification'] = ['management' => 'PluginGamificationScore'];
}
$PLUGIN_HOOKS['add_css']['gamification'] = 'style.css';
}
/**
* Get the name and the version of the plugin - Needed
*
* @return array
*/
function plugin_version_gamification() {
return [
'name' => 'Gamification',
'version' => '1.0',
'author' => 'Truly Systems',
'license' => 'GLPv3',
'homepage' => 'https://www.trulysystems.com/',
'requirements' => [
'glpi' => [
'min' => '9.5'
]
]
];
}
/**
* Optional : check prerequisites before install : may print errors or add to message after redirect
*
* @return boolean
*/
function plugin_gamification_check_prerequisites() {
//do what the checks you want
return true;
}
/**
* Check configuration process for plugin : need to return true if succeeded
* Can display a message only if failure and $verbose is true
*
* @param boolean $verbose Enable verbosity. Default to false
*
* @return boolean
*/
function plugin_gamification_check_config($verbose = false) {
if (true) { // Your configuration check
return true;
}
if ($verbose) {
echo "Installed, but not configured";
}
return false;
}