"] = 'index.php'; $PLUGIN_HOOKS['submenu_entry']['example'][$LANGEXAMPLE["test"]] = 'index.php'; $PLUGIN_HOOKS["helpdesk_menu_entry"]['example'] = true; // Setup/Update functions $PLUGIN_HOOKS['setup']['example'] = "plugin_setup_example"; // Config function $PLUGIN_HOOKS['config']['example'] = 'plugin_config_example'; // Config page $PLUGIN_HOOKS['config_page']['example'] = 'config.php'; // Item action event // See config.php for defined ITEM_TYPE $PLUGIN_HOOKS['item_update']['example'] = 'plugin_item_update_example'; $PLUGIN_HOOKS['item_add']['example'] = 'plugin_item_add_example'; $PLUGIN_HOOKS['item_delete']['example'] = 'plugin_item_delete_example'; $PLUGIN_HOOKS['item_purge']['example'] = 'plugin_item_purge_example'; $PLUGIN_HOOKS['item_restore']['example'] = 'plugin_item_restore_example'; // Onglets management $PLUGIN_HOOKS['headings']['example'] = 'plugin_get_headings_example'; $PLUGIN_HOOKS['headings_action']['example'] = 'plugin_headings_actions_example'; // Display on central page $PLUGIN_HOOKS['central_action']['example'] = 'plugin_central_action_example'; // Cron action $PLUGIN_HOOKS['cron']['example'] = DAY_TIMESTAMP; //redirect appel http://localhost/glpi/index.php?redirect=plugin_example_2 (ID 2 du form) $PLUGIN_HOOKS['redirect_page']['example']="example.form.php"; } // Get the name and the version of the plugin - Needed function plugin_version_example(){ return array( 'name' => 'Plugin Example', 'version' => '0.0.1'); } // Get config of the plugin function plugin_config_example(){ global $CFG_GLPI_PLUGINS; $CFG_GLPI_PLUGINS["example"]["test"]="test"; } // Config form od the plugin function plugin_config_form_example(){ echo "This is the form config of the plugin"; } // Hook done on update item case function plugin_item_update_example($parm){ if (isset($parm["type"])) switch ($parm["type"]){ case COMPUTER_TYPE : if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="
"; $_SESSION["MESSAGE_AFTER_REDIRECT"].="Update Computer Hook"; return true; break; } return false; } // Hook done on add item case function plugin_item_add_example($parm){ if (isset($parm["type"])) switch ($parm["type"]){ case COMPUTER_TYPE : if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="
"; $_SESSION["MESSAGE_AFTER_REDIRECT"].="Add Computer Hook"; return true; break; } return false; } // Hook done on delete item case function plugin_item_delete_example($parm){ if (isset($parm["type"])) switch ($parm["type"]){ case COMPUTER_TYPE : if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="
"; $_SESSION["MESSAGE_AFTER_REDIRECT"].="Delete Computer Hook"; return true; break; } return false; } // Hook done on purge item case function plugin_item_purge_example($parm){ if (isset($parm["type"])) switch ($parm["type"]){ case COMPUTER_TYPE : if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="
"; $_SESSION["MESSAGE_AFTER_REDIRECT"].="Purge Computer Hook"; return true; break; } return false; } // Hook done on restore item case function plugin_item_restore_example($parm){ if (isset($parm["type"])) switch ($parm["type"]){ case COMPUTER_TYPE : if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="
"; $_SESSION["MESSAGE_AFTER_REDIRECT"].="Restore Computer Hook"; return true; break; } return false; } // Define headings added by the plugin function plugin_get_headings_example($type,$withtemplate){ switch ($type){ case COMPUTER_TYPE : // template case if ($withtemplate) return array(); // Non template case else return array( 1 => "Test PLugin", ); break; case ENTERPRISE_TYPE : return array( 1 => "Test PLugin", 2 => "Test PLugin 2", ); break; } return false; } // Define headings actions added by the plugin function plugin_headings_actions_example($type){ switch ($type){ case COMPUTER_TYPE : return array( 1 => "plugin_headings_example", ); break; case ENTERPRISE_TYPE : return array( 1 => "plugin_headings_example", 2 => "plugin_headings_example", ); break; } return false; } // Example of an action heading function plugin_headings_example($type,$ID,$withtemplate=0){ if (!$withtemplate){ echo "
"; echo "Plugin function with headings TYPE=".$type." ID=".$ID; echo "
"; } } // Hook to be launch on central function plugin_central_action_example(){ global $LANGEXAMPLE; echo "
"; echo "Plugin central action ".$LANGEXAMPLE["test"]; echo "
"; } // Cron function : name= cron_plugin_PLUGINNAME function cron_plugin_example(){ echo "tttt"; } ?>