diff --git a/hook.php b/hook.php index a6193bb..afb4762 100644 --- a/hook.php +++ b/hook.php @@ -232,7 +232,8 @@ function plugin_example_MassiveActionsDisplay($options=array()) { case 'Computer' : switch ($options['action']) { case "plugin_example_DoIt" : - echo "  but do nothing :)"; break; } @@ -348,6 +349,13 @@ function plugin_item_update_example($item) { return true; } +// Hook done on get empty item case +function plugin_item_empty_example($item) { + + addMessageAfterRedirect("Empty Computer Hook",true); + return true; +} + // Hook done on before delete item case function plugin_pre_item_delete_example($object) { diff --git a/setup.php b/setup.php index de8fd54..52eb7b1 100755 --- a/setup.php +++ b/setup.php @@ -49,10 +49,6 @@ function plugin_init_example() { Plugin::registerClass('PluginExampleExample', array('notificationtemplates_types' => true)); - //Classes for rulesengine - Plugin::registerClass('PluginExampleRuleTest'); - Plugin::registerClass('PluginExampleRuleTestCollection',array('rulecollections_types'=>true)); - // Display a menu entry ? if (isset($_SESSION["glpi_plugin_example_profile"])) { // Right set in change_profile hook $PLUGIN_HOOKS['menu_entry']['example'] = 'front/example.php'; @@ -88,6 +84,8 @@ function plugin_init_example() { $PLUGIN_HOOKS['pre_item_update']['example'] = array('Computer'=>'plugin_pre_item_update_example'); $PLUGIN_HOOKS['item_update']['example'] = array('Computer'=>'plugin_item_update_example'); + $PLUGIN_HOOKS['item_empty']['example'] = array('Computer'=>'plugin_item_empty_example'); + // Example using a method in class $PLUGIN_HOOKS['pre_item_add']['example'] = array('Computer' => array('PluginExampleExample', 'pre_item_add_example')); @@ -152,20 +150,20 @@ function plugin_init_example() { function plugin_version_example() { return array('name' => 'Plugin Example', - 'version' => '4.0', + 'version' => '0.3.0', 'author' => 'Julien Dombre', - 'homepage' => 'https://forge.indepnet.net/projects/show/example', - 'minGlpiVersion' => '0.78');// For compatibility / no install in version < 0.72 + 'homepage' => 'https://forge.indepnet.net/projects/example', + 'minGlpiVersion' => '0.80');// For compatibility / no install in version < 0.80 } // Optional : check prerequisites before install : may print errors or add to message after redirect function plugin_example_check_prerequisites() { - if (GLPI_VERSION >= 0.78) { + if (GLPI_VERSION >= 0.80) { return true; } else { - echo "GLPI version not compatible need 0.78"; + echo "GLPI version not compatible need 0.80"; } } @@ -185,4 +183,4 @@ function plugin_example_check_config($verbose=false) { } -?> +?> \ No newline at end of file