From 5046de969e714584a5cd926887cfadc2deedafff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Legastelois?= Date: Fri, 5 Aug 2016 11:07:20 +0200 Subject: [PATCH] add example for import_item and autoinventory_information HOOKS --- inc/computer.class.php | 58 ++++++++++++++++++++++++++++++++++++++++++ setup.php | 8 ++++++ 2 files changed, 66 insertions(+) create mode 100644 inc/computer.class.php diff --git a/inc/computer.class.php b/inc/computer.class.php new file mode 100644 index 0000000..a6a70ac --- /dev/null +++ b/inc/computer.class.php @@ -0,0 +1,58 @@ +. + -------------------------------------------------------------------------- + */ + +// ---------------------------------------------------------------------- +// Original Author of file: +// Purpose of file: +// ---------------------------------------------------------------------- + +// Class of the defined type + +if (!defined('GLPI_ROOT')) { + die("Sorry. You can't access directly to this file"); +} + +class PluginExampleComputer extends CommonDBTM { + + static function showInfo($this) { + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
'.__('More information').'
'; + echo __('Test successful'); + echo '
'; + } + +} + diff --git a/setup.php b/setup.php index 93da1d2..f70f091 100755 --- a/setup.php +++ b/setup.php @@ -186,6 +186,14 @@ function plugin_init_example() { $PLUGIN_HOOKS['pre_show_item']['example'] = array( 'PluginExampleShowtabitem', 'pre_show_item' ); $PLUGIN_HOOKS['post_show_item']['example'] = array( 'PluginExampleShowtabitem', 'post_show_item' ); + // declare this plugin as an import plugin for Computer itemtype + $PLUGIN_HOOKS['import_item']['exemple'] = array('Computer' => array('Plugin')); + + // add additional informations on Computer::showForm + $PLUGIN_HOOKS['autoinventory_information']['exemple'] = array( + 'Computer' => array('PluginExampleComputer', 'showInfo') + ); + }