forked from salleman33/reservation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.php
84 lines (74 loc) · 2.42 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
<?php
define('PLUGIN_VERSION', '2.1.0');
/**
* Init the hooks of the plugins - Needed
*
* @return void
*/
function plugin_init_reservation() {
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['reservation'] = true;
$PLUGIN_HOOKS['add_css']['reservation'][] = "css/views.css";
$PLUGIN_HOOKS['add_javascript']['reservation'] = ['js/tools.js'];
$PLUGIN_HOOKS['config_page']['reservation'] = 'front/config.form.php';
$PLUGIN_HOOKS['item_add']['reservation'] = ['Reservation' => 'plugin_item_add_reservation'];
$PLUGIN_HOOKS['item_update']['reservation'] = ['Reservation' => 'plugin_item_update_reservation'];
$PLUGIN_HOOKS['item_purge']['reservation'] = ['Reservation' => 'plugin_item_purge_reservation'];
$PLUGIN_HOOKS['menu_toadd']['reservation'] = ['plugins' => 'PluginReservationMenu'];
Plugin::registerClass('PluginReservationMenu');
Plugin::registerClass('PluginReservationConfig');
Plugin::registerClass('PluginReservationReservation');
Plugin::registerClass('PluginReservationTask');
Plugin::registerClass('PluginReservationApi');
// Notifications
$PLUGIN_HOOKS['item_get_events']['reservation'] =
[ 'NotificationTargetReservation' => [ 'PluginReservationTask', 'addEvents' ] ];
if (Session::getLoginUserID()) {
$PLUGIN_HOOKS['menu_entry']['reservation'] = 'front/reservation.php';
}
}
/**
* Get the name and the version of the plugin - Needed
*
* @return array
*/
function plugin_version_reservation() {
return [
'name' => 'Reservation',
'version' => PLUGIN_VERSION,
'author' => 'Sylvain Allemand',
'license' => 'GLPv3',
'homepage' => 'https://github.com/salleman33/reservation',
'requirements' => [
'glpi' => [
'min' => '9.3',
'dev' => true,
],
],
];
}
/**
* Optional : check prerequisites before install : may print errors or add to message after redirect
*
* @return boolean
*/
function plugin_reservation_check_prerequisites() {
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_reservation_check_config($verbose = false) {
if (true) { // Your configuration check
return true;
}
if ($verbose) {
echo 'Installed / not configured';
}
return false;
}