mirror of
https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management.git
synced 2025-06-28 05:38:42 +02:00
Start repository
This commit is contained in:
90
plugin.php
Normal file
90
plugin.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/*
|
||||
* @version 1.0.0
|
||||
* @license GPL-3.0+
|
||||
* @brief GLPI SOC Case Management Plugin
|
||||
* @copyright 2025 Your Organization
|
||||
*/
|
||||
|
||||
define('PLUGIN_SOC_VERSION', '1.0.0');
|
||||
define('PLUGIN_SOC_MIN_GLPI', '10.0.0');
|
||||
define('PLUGIN_SOC_MAX_GLPI', '10.1.0');
|
||||
|
||||
/**
|
||||
* Plugin description
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function plugin_version_soc() {
|
||||
return [
|
||||
'name' => 'SOC Case Management',
|
||||
'version' => PLUGIN_SOC_VERSION,
|
||||
'author' => 'Your Organization',
|
||||
'license' => 'GPL-3.0+',
|
||||
'homepage' => 'https://yourorganization.com',
|
||||
'requirements' => [
|
||||
'glpi' => [
|
||||
'min' => PLUGIN_SOC_MIN_GLPI,
|
||||
'max' => PLUGIN_SOC_MAX_GLPI,
|
||||
],
|
||||
'php' => [
|
||||
'min' => '7.4.0',
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check plugin prerequisites before installation
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function plugin_soc_check_prerequisites() {
|
||||
if (version_compare(GLPI_VERSION, PLUGIN_SOC_MIN_GLPI, 'lt') || version_compare(GLPI_VERSION, PLUGIN_SOC_MAX_GLPI, 'gt')) {
|
||||
echo "This plugin requires GLPI >= " . PLUGIN_SOC_MIN_GLPI . " and < " . PLUGIN_SOC_MAX_GLPI;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if plugin configuration is compatible with current GLPI status
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function plugin_soc_check_config() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugin initialization
|
||||
*
|
||||
* @global array $PLUGIN_HOOKS
|
||||
* @return void
|
||||
*/
|
||||
function plugin_init_soc() {
|
||||
global $PLUGIN_HOOKS;
|
||||
|
||||
$PLUGIN_HOOKS['csrf_compliant']['soc'] = true;
|
||||
$PLUGIN_HOOKS['menu_toadd']['soc'] = ['management' => 'PluginSocCase'];
|
||||
$PLUGIN_HOOKS['javascript']['soc'] = ['/plugins/soc/js/soc.js'];
|
||||
$PLUGIN_HOOKS['add_css']['soc'] = ['/plugins/soc/css/soc.css'];
|
||||
|
||||
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']
|
||||
]);
|
||||
}
|
||||
|
||||
// Add a tab to Tickets
|
||||
if (Session::haveRight('ticket', READ)) {
|
||||
Plugin::registerClass('PluginSocCase', [
|
||||
'addtabtypes' => ['Ticket']
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user