mirror of
https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management.git
synced 2025-06-27 21:28:42 +02:00
98 lines
2.7 KiB
PHP
98 lines
2.7 KiB
PHP
<?php
|
|
/**
|
|
* SOC Config Class
|
|
*/
|
|
class PluginSocConfig extends CommonDBTM {
|
|
|
|
static $rightname = 'config';
|
|
|
|
/**
|
|
* Show config form
|
|
*
|
|
* @return void
|
|
*/
|
|
function showConfigForm() {
|
|
global $CFG_GLPI;
|
|
|
|
$config = self::getConfig();
|
|
|
|
echo "<form name='form' action='".Toolbox::getItemTypeFormURL(__CLASS__)."' method='post'>";
|
|
echo "<div class='center' id='tabsbody'>";
|
|
echo "<table class='tab_cadre_fixe'>";
|
|
|
|
echo "<tr class='tab_bg_1'>";
|
|
echo "<th colspan='4'>".__('SOC Case Management Configuration', 'soc')."</th>";
|
|
echo "</tr>";
|
|
|
|
echo "<tr class='tab_bg_2'>";
|
|
echo "<td>".__('Auto-close cases after (days)', 'soc')."</td>";
|
|
echo "<td>";
|
|
Dropdown::showNumber('autoclose_delay', ['value' => $config['autoclose_delay'],
|
|
'min' => 0,
|
|
'max' => 999,
|
|
'toadd' => [0 => __('Never')]]);
|
|
echo "</td>";
|
|
echo "<td>".__('Default severity for new cases', 'soc')."</td>";
|
|
echo "<td>";
|
|
Dropdown::showFromArray('default_severity', PluginSocCase::getSeverityOptions(),
|
|
['value' => $config['default_severity']]);
|
|
echo "</td>";
|
|
echo "</tr>";
|
|
|
|
echo "<tr class='tab_bg_2'>";
|
|
echo "<td colspan='4' class='center'>";
|
|
echo "<input type='submit' name='update' value=\""._sx('button', 'Save')."\" class='submit'>";
|
|
echo "</td>";
|
|
echo "</tr>";
|
|
|
|
echo "</table>";
|
|
echo "</div>";
|
|
Html::closeForm();
|
|
}
|
|
|
|
/**
|
|
* Get plugin config
|
|
*
|
|
* @return array
|
|
*/
|
|
static function getConfig() {
|
|
$config = Config::getConfigurationValues('plugin:soc');
|
|
|
|
$default_config = [
|
|
'autoclose_delay' => 0,
|
|
'default_severity' => PluginSocCase::SEVERITY_MEDIUM
|
|
];
|
|
|
|
// Set default values if not set
|
|
foreach ($default_config as $key => $value) {
|
|
if (!isset($config[$key])) {
|
|
$config[$key] = $value;
|
|
}
|
|
}
|
|
|
|
return $config;
|
|
}
|
|
|
|
/**
|
|
* Hook to install initial configuration
|
|
*/
|
|
static function install() {
|
|
$default_config = [
|
|
'autoclose_delay' => 0,
|
|
'default_severity' => PluginSocCase::SEVERITY_MEDIUM
|
|
];
|
|
|
|
Config::setConfigurationValues('plugin:soc', $default_config);
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Hook to uninstall configuration
|
|
*/
|
|
static function uninstall() {
|
|
Config::deleteConfigurationValues('plugin:soc', ['autoclose_delay', 'default_severity']);
|
|
|
|
return true;
|
|
}
|
|
} |