-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.php
More file actions
99 lines (84 loc) · 2.97 KB
/
setup.php
File metadata and controls
99 lines (84 loc) · 2.97 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
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
93
94
95
96
97
98
99
<?php
define('PLUGIN_FLEETBOOKING_VERSION', '1.0.9');
define('PLUGIN_FLEETBOOKING_MIN_GLPI_VERSION', '11.0.0');
/**
* Init hooks of the plugin.
* REQUIRED
*
* @return void
*/
function plugin_init_fleetbooking()
{
global $PLUGIN_HOOKS, $CFG_GLPI;
$PLUGIN_HOOKS['csrf_compliant']['fleetbooking'] = true;
$PLUGIN_HOOKS['config_page']['fleetbooking'] = 'front/config.php';
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
}
if (Plugin::isPluginActive('fleetbooking')) {
Plugin::registerClass('GlpiPlugin\Fleetbooking\Request', ['addtabon' => ['Ticket']]);
Plugin::registerClass('GlpiPlugin\Fleetbooking\GroupManager');
Plugin::registerClass('GlpiPlugin\Fleetbooking\Holiday');
Plugin::registerClass('GlpiPlugin\Fleetbooking\Config', ['addtabon' => ['Entity']]);
Plugin::registerClass('GlpiPlugin\Fleetbooking\Profile', ['addtabon' => ['Profile']]);
$PLUGIN_HOOKS['add_css']['fleetbooking'] = 'css/fleetbooking.css';
$PLUGIN_HOOKS['add_javascript']['fleetbooking'] = ['js/fleetbooking.js'];
$PLUGIN_HOOKS['item_get_events']['fleetbooking'] = ['GlpiPlugin\Fleetbooking\Service\CalendarService', 'plugin_fleetbooking_item_get_events'];
$PLUGIN_HOOKS['menu_toadd']['fleetbooking'] = ['tools' => 'GlpiPlugin\Fleetbooking\Request'];
// Session right injection hook
$PLUGIN_HOOKS['change_profile']['fleetbooking'] = ['GlpiPlugin\Fleetbooking\Profile', 'initProfile'];
// Auto-load rights into current session if active but not loaded yet (prevents logout/login requirement)
if (isset($_SESSION['glpiactiveprofile']['id']) && !isset($_SESSION['glpiactiveprofile']['fleetbooking_rights_loaded'])) {
\GlpiPlugin\Fleetbooking\Profile::initProfile();
}
// Add to Self-Service Homepage
$PLUGIN_HOOKS['helpdesk_menu_entry']['fleetbooking'] = '/plugins/fleetbooking/front/request.form.php';
$PLUGIN_HOOKS['helpdesk_menu_entry_icon']['fleetbooking'] = 'ti ti-car';
}
}
/**
* Get the name and the version of the plugin
* REQUIRED
*
* @return array
*/
function plugin_version_fleetbooking()
{
return [
'name' => 'Fleet Booking',
'version' => PLUGIN_FLEETBOOKING_VERSION,
'author' => 'Francisco Neto, Getsmart',
'license' => 'GPLv3+',
'homepage' => '',
'requirements' => [
'glpi' => [
'min' => PLUGIN_FLEETBOOKING_MIN_GLPI_VERSION,
]
]
];
}
/**
* Check pre-requisites before install
* REQUIRED
*
* @return boolean
*/
function plugin_fleetbooking_check_prerequisites()
{
if (version_compare(GLPI_VERSION, PLUGIN_FLEETBOOKING_MIN_GLPI_VERSION, '<')) {
return false;
}
return true;
}
/**
* Check configuration process
* REQUIRED
*
* @param boolean $for_update
*
* @return boolean
*/
function plugin_fleetbooking_check_config($for_update = false)
{
return true;
}