-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.php
More file actions
93 lines (81 loc) · 3.23 KB
/
setup.php
File metadata and controls
93 lines (81 loc) · 3.23 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
<?php
/*
-------------------------------------------------------------------------
Ticket Answers
Copyright (C) 2023 by Jeferson Penna Alves
-------------------------------------------------------------------------
LICENSE
This file is part of Ticket Answers.
Ticket Answers is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Ticket Answers 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Ticket Answers. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
define('PLUGIN_TICKETANSWERS_VERSION', '1.2.1');
// Definir diretório raiz do plugin
define('PLUGIN_TICKETANSWERS_DIR', Plugin::getPhpDir('ticketanswers'));
define('PLUGIN_TICKETANSWERS_WEB_DIR', Plugin::getWebDir('ticketanswers'));
/**
* Inicialização do plugin
*/
function plugin_init_ticketanswers() {
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['ticketanswers'] = true;
// Registrar as classes do plugin
Plugin::registerClass('PluginTicketanswersProfile', ['addtabon' => 'Profile']);
if (Session::getLoginUserID()) {
// Adicionar submenu dentro do menu "Assistance" (Chamados)
$PLUGIN_HOOKS['menu_toadd']['ticketanswers'] = ['helpdesk' => 'PluginTicketanswersMenu'];
// Link de configuração na página de plugins (ícone de chavinha)
if (Session::haveRight('config', UPDATE)) {
$PLUGIN_HOOKS['config_page']['ticketanswers'] = 'front/config.php';
}
// Assets globais (GLPI 11 serve a partir de public/plugins/ticketanswers)
$PLUGIN_HOOKS['add_css']['ticketanswers'][] = 'css/vol_icone_notification.css';
$PLUGIN_HOOKS['add_css']['ticketanswers'][] = 'css/notification_dropdown.css';
$PLUGIN_HOOKS['add_javascript']['ticketanswers'][] = 'js/unified_notifications.js';
$PLUGIN_HOOKS['add_javascript']['ticketanswers'][] = 'js/notification_bell.js';
$PLUGIN_HOOKS['add_javascript']['ticketanswers'][] = 'js/notification_dropdown.js';
}
}
/**
* Informações do plugin
*/
function plugin_version_ticketanswers() {
return [
'name' => 'TicketAnswers',
'version' => PLUGIN_TICKETANSWERS_VERSION,
'author' => 'Jeferson Penna Alves & Luiz Gustavo',
'license' => 'GPLv2+',
'homepage' => 'https://github.com/NiceATC/TicketAnswers',
'requirements' => [
'glpi' => [
'min' => '11.0',
'dev' => false
]
]
];
}
/**
* Verificação de requisitos
*/
function plugin_ticketanswers_check_prerequisites() {
if (version_compare(GLPI_VERSION, '11.0', 'lt')) {
echo "Este plugin requer GLPI >= 11.0";
return false;
}
return true;
}
/**
* Verificação de configuração
*/
function plugin_ticketanswers_check_config() {
return true;
}