-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.php
executable file
·104 lines (87 loc) · 2.7 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
global $CFG_GLPI;
define('PLUGIN_GESTAOHORAS_VERSION', '1.0.0');
define('GESTAOHORAS_ROOTDOC', $CFG_GLPI['root_doc'] . '/plugins/gestaohoras');
define('PLUGIN_GESTAOHORAS_GLPI_MIN_VERSION', '9.3.3');
/**
* Define the plugin's version and informations
*
* @return Array [name, version, author, homepage, license, minGlpiVersion]
*/
if (!function_exists("plugin_version_gestaohoras")) {
function plugin_version_gestaohoras()
{
$glpiVersion = rtrim(GLPI_VERSION, '-dev');
if (!method_exists('Plugins', 'checkGlpiVersion') && version_compare($glpiVersion, PLUGIN_GESTAOHORAS_GLPI_MIN_VERSION, 'lt')) {
echo 'This plugin requires GLPI >= ' . PLUGIN_GESTAOHORAS_GLPI_MIN_VERSION;
return false;
}
$requirements = [
'name' => _n('Gestão de Horas', 'Gestão de Horas', 2, 'gestaohoras'),
'version' => PLUGIN_GESTAOHORAS_VERSION,
'author' => '<b>Kedson Silva</b>',
'homepage' => 'https://github.com/kedson42/gestaohoras',
'requirements' => [
'glpi' => [
'min' => PLUGIN_GESTAOHORAS_GLPI_MIN_VERSION,
]
]
];
return $requirements;
}
}
/**
* Check plugin's prerequisites before installation
*
* @return boolean
*/
if (!function_exists("plugin_gestaohoras_check_prerequisites")) {
function plugin_gestaohoras_check_prerequisites()
{
return true;
}
}
/**
* Check plugin's config before activation (if needed)
*
* @return boolean
*/
if (!function_exists("plugin_gestaohoras_check_config")) {
function plugin_gestaohoras_check_config()
{
return true;
}
}
/**
* Class autoload
*
* @param $classname
* @return bool
*/
if (!function_exists("plugin_gestaohoras_autoload")) {
function plugin_gestaohoras_autoload($classname)
{
if (strpos($classname, 'PluginGestaohoras') === 0) {
$filename = __DIR__ . '/inc/' . strtolower(str_replace('PluginGestaohoras', '', $classname)) . '.class.php';
if (is_readable($filename) && is_file($filename)) {
include_once($filename);
return true;
}
}
}
}
/**
* Initialize all classes and generic variables of the plugin
*/
if (!function_exists("plugin_init_gestaohoras")) {
function plugin_init_gestaohoras()
{
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['gestaohoras'] = true;
$PLUGIN_HOOKS['display_central']['gestaohoras'] = 'display_resume';
// Menus
$PLUGIN_HOOKS['config_page']['gestaohoras'] = 'front/balance_hour.php';
$PLUGIN_HOOKS['menu_toadd']['gestaohoras']['admin'] = 'PluginGestaohorasBalance_Hour';
$PLUGIN_HOOKS['add_javascript']['gestaohoras'][] = 'js/scripts.js.php';
}
}