-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathsetup.php
More file actions
executable file
·174 lines (149 loc) · 6.65 KB
/
Copy pathsetup.php
File metadata and controls
executable file
·174 lines (149 loc) · 6.65 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
/**
* -------------------------------------------------------------------------
* TimelineTicket
* Copyright (C) 2013-2026 by the TimelineTicket Development Team.
*
* https://github.com/pluginsGLPI/timelineticket
* ------------------------------------------------------------------------
*
* LICENSE
*
* This file is part of TimelineTicket project.
*
* TimelineTicket plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TimelineTicket plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with TimelineTicket plugin. If not, see <http://www.gnu.org/licenses/>.
*
* ------------------------------------------------------------------------
*
* @copyright Copyright (C) 2013-2025 TimelineTicket team
* @license AGPL License 3.0 or (at your option) any later version
* @link https://github.com/pluginsGLPI/timelineticket
* @package TimelineTicket plugin
* @since 2013
* http://www.gnu.org/licenses/agpl-3.0-standalone.html
* --------------------------------------------------------------------------
*/
/*
-------------------------------------------------------------------------
TimelineTicket
Copyright (C) 2013-2026 by the TimelineTicket Development Team.
https://github.com/pluginsGLPI/timelineticket
------------------------------------------------------------------------
LICENSE
This file is part of TimelineTicket project.
TimelineTicket plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
TimelineTicket plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with TimelineTicket plugin. If not, see <http://www.gnu.org/licenses/>.
------------------------------------------------------------------------
@package TimelineTicket plugin
@copyright Copyright (C) 2013-2025 TimelineTicket team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://github.com/pluginsGLPI/timelineticket
@since 2013
--------------------------------------------------------------------------
*/
global $CFG_GLPI;
use Glpi\Plugin\Hooks;
use GlpiPlugin\Timelineticket\AssignGroup;
use GlpiPlugin\Timelineticket\AssignUser;
use GlpiPlugin\Timelineticket\Dashboard;
use GlpiPlugin\Timelineticket\Display;
use GlpiPlugin\Timelineticket\Profile;
define("PLUGIN_TIMELINETICKET_VERSION", "11.2.0");
if (!defined("PLUGIN_TIMELINETICKET_DIR")) {
define("PLUGIN_TIMELINETICKET_DIR", Plugin::getPhpDir("timelineticket"));
$root = $CFG_GLPI['root_doc'] . '/plugins/timelineticket';
define("PLUGIN_TIMELINETICKET_WEBDIR", $root);
}
function plugin_version_timelineticket()
{
return ['name' => _n("Timeline of ticket", "Timeline of tickets", 2, "timelineticket"),
'version' => PLUGIN_TIMELINETICKET_VERSION,
'homepage' => 'https://github.com/pluginsGLPI/timelineticket',
'license' => 'AGPLv3+',
'author' => 'Nelly Mahu-Lasson && David Durieux && Xavier Caillaud',
'requirements' => [
'glpi' => [
'min' => '11.0',
'max' => '12.0',
'dev' => false,
],
],
];
}
function plugin_init_timelineticket()
{
global $PLUGIN_HOOKS;
// add autoload for vendor
include_once(PLUGIN_TIMELINETICKET_DIR . "/vendor/autoload.php");
if (Plugin::isPluginActive('timelineticket')) { // check if plugin is active
$PLUGIN_HOOKS[Hooks::CHANGE_PROFILE]['timelineticket'] = [Profile::class, 'initProfile'];
$PLUGIN_HOOKS[Hooks::ADD_JAVASCRIPT]['timelineticket'][] = 'js/google-charts/loader.js';
// Swimlane arrow renderer, loaded as an ES module (no inline <script>).
$PLUGIN_HOOKS[Hooks::ADD_JAVASCRIPT_MODULE]['timelineticket'][] = 'js/swimlane.js';
$PLUGIN_HOOKS[Hooks::ADD_CSS]['timelineticket'][] = 'css/timelineticket.css';
Plugin::registerClass(Profile::class, ['addtabon' => 'Profile']);
if (Session::haveRightsOr('plugin_timelineticket_ticket', [READ, UPDATE])) {
// Same right gate as the Display tab: don't expose the stats hook
// to users who lack the plugin right.
$PLUGIN_HOOKS[Hooks::SHOW_ITEM_STATS]['timelineticket'] = [
'Ticket' => 'plugin_timelineticket_item_stats',
];
Plugin::registerClass(
Display::class,
['addtabon' => ['Ticket']],
);
}
$PLUGIN_HOOKS[Hooks::ITEM_PURGE]['timelineticket'] = [
'Ticket' => 'plugin_timelineticket_ticket_purge',
'Group_Ticket' => [AssignGroup::class, 'deleteGroupTicket'],
'Ticket_User' => [AssignUser::class, 'deleteUserTicket'],
];
$PLUGIN_HOOKS[Hooks::ITEM_ADD]['timelineticket'] = [
'Ticket' => 'plugin_timelineticket_ticket_add',
'Group_Ticket' => [AssignGroup::class, 'addGroupTicket'],
'Ticket_User' => [AssignUser::class, 'addUserTicket'],
];
$PLUGIN_HOOKS[Hooks::ITEM_UPDATE]['timelineticket'] = [
'Ticket' => 'plugin_timelineticket_ticket_update',
];
if (Session::haveRight("config", UPDATE)
|| Session::haveRight('plugin_timelineticket_ticket', UPDATE)) {// Config page
$PLUGIN_HOOKS[Hooks::CONFIG_PAGE]['timelineticket'] = 'front/config.form.php';
}
if (Plugin::isPluginActive('mydashboard')) {
$PLUGIN_HOOKS['mydashboard']['timelineticket'] = [Dashboard::class];
}
}
}
/**
* @return bool
*/
function plugin_timelineticket_check_prerequisites()
{
if (!is_readable(__DIR__ . '/vendor/autoload.php')
|| !is_file(__DIR__ . '/vendor/autoload.php')) {
echo "Run composer install --no-dev in the plugin directory<br>";
return false;
}
return true;
}