Correction du fichier hook.php pour le plugin SOC

This commit is contained in:
tips-of-mine
2025-05-31 14:43:12 +02:00
committed by GitHub
parent 5b30a110ac
commit 4622a1a2cd
6 changed files with 554 additions and 24 deletions

View File

@ -65,35 +65,51 @@ function plugin_init_soc() {
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['soc'] = true;
$PLUGIN_HOOKS['menu_toadd']['soc'] = ['management' => 'PluginSocCase'];
// Add JavaScript and CSS
$PLUGIN_HOOKS['javascript']['soc'] = ['plugins/soc/js/soc.js'];
$PLUGIN_HOOKS['add_css']['soc'] = ['plugins/soc/css/soc.css'];
// Initialize translations
include_once(GLPI_ROOT . '/plugins/soc/inc/plugin_init_translations.php');
$PLUGIN_HOOKS['init_translations']['soc'] = 'plugin_init_soc_translations';
// Register plugin classes
Plugin::registerClass('PluginSocCase');
Plugin::registerClass('PluginSocProfile', ['addtabtypes' => ['Profile']]);
// Add menu items
if (Session::haveRight('plugin_soc_case', READ)) {
$PLUGIN_HOOKS['menu_toadd']['soc'] = ['management' => 'PluginSocCase'];
}
// Add a tab to Changes
if (Session::haveRight('change', READ)) {
Plugin::registerClass('PluginSocCase', [
'addtabtypes' => ['Change']
]);
$PLUGIN_HOOKS['add_tab']['soc'] = [
'Change' => 'PluginSocCase',
];
}
// Add a tab to Tickets
if (Session::haveRight('ticket', READ)) {
Plugin::registerClass('PluginSocCase', [
'addtabtypes' => ['Ticket']
]);
$PLUGIN_HOOKS['add_tab']['soc'] = [
'Ticket' => 'PluginSocCase',
];
}
// Add config page
if (Session::haveRight('config', UPDATE)) {
$PLUGIN_HOOKS['config_page']['soc'] = 'front/config.form.php';
}
// Hook for item actions
$PLUGIN_HOOKS['item_add']['soc'] = ['*' => 'plugin_soc_item_add'];
$PLUGIN_HOOKS['item_update']['soc'] = ['*' => 'plugin_soc_item_update'];
$PLUGIN_HOOKS['item_delete']['soc'] = ['*' => 'plugin_soc_item_delete'];
$PLUGIN_HOOKS['item_purge']['soc'] = ['*' => 'plugin_soc_item_purge'];
// Display hooks
$PLUGIN_HOOKS['post_item_form']['soc'] = ['PluginSocCase', 'displayTabContentForItem'];
}
/**