diff --git a/hook.php b/hook.php index 88eb873..4147bf5 100644 --- a/hook.php +++ b/hook.php @@ -557,6 +557,11 @@ function plugin_example_addParamFordynamicReport($itemtype) { function plugin_example_install() { global $DB; + $config = new Config(); + $config->setConfigurationValues('plugin:Example', array('configuration' => false)); + + ProfileRight::addProfileRights(array('example:read')); + if (!TableExists("glpi_plugin_example_examples")) { $query = "CREATE TABLE `glpi_plugin_example_examples` ( `id` int(11) NOT NULL auto_increment, @@ -611,6 +616,10 @@ function plugin_example_install() { function plugin_example_uninstall() { global $DB; + $config = new Config(); + $config->deleteConfigurationValues('plugin:Example', array('configuration' => false)); + + ProfileRight::deleteProfileRights(array('example:read')); $notif = new Notification(); $options = array('itemtype' => 'Ticket', diff --git a/inc/config.class.php b/inc/config.class.php new file mode 100644 index 0000000..9bb0950 --- /dev/null +++ b/inc/config.class.php @@ -0,0 +1,88 @@ +. + -------------------------------------------------------------------------- + */ + +class PluginExampleConfig extends CommonDBTM { + + static protected $notable = true; + + function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { + + if (!$withtemplate) { + if ($item->getType() == 'Config') { + return __('Example plugin'); + } + } + return ''; + } + + static function configUpdate($input) { + $input['configuration'] = 1 - $input['configuration']; + return $input; + } + + function showFormExample() { + global $CFG_GLPI; + + if (!Session::haveRight("config", "w")) { + return false; + } + + $my_config = Config::getConfigurationValues('plugin:Example'); + + echo "