mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-04 18:08:42 +02:00
add item_empty hook
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@145 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
parent
ac2400cb71
commit
cba8235d1f
10
hook.php
10
hook.php
@ -232,7 +232,8 @@ function plugin_example_MassiveActionsDisplay($options=array()) {
|
||||
case 'Computer' :
|
||||
switch ($options['action']) {
|
||||
case "plugin_example_DoIt" :
|
||||
echo " <input type='submit' name='massiveaction' class='submit' value='".
|
||||
|
||||
echo " <input type='hidden' name='toto' value='1'><input type='submit' name='massiveaction' class='submit' value='".
|
||||
$LANG["buttons"][2]."'> 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) {
|
||||
|
16
setup.php
16
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";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user