diff --git a/hook.php b/hook.php
index 1f9a686..918c2e3 100644
--- a/hook.php
+++ b/hook.php
@@ -119,7 +119,7 @@ function plugin_example_displayConfigItem($type, $ID, $data, $num) {
function plugin_example_addDefaultJoin($type, $ref_table, &$already_link_tables) {
- // Example of default JOIN clause
+ // Example of default JOIN clause
// No need of the function if you do not have specific cases
switch ($type) {
// case "PluginExampleExample" :
@@ -291,7 +291,7 @@ function plugin_example_MassiveActionsDisplay($options=array()) {
case 'Computer' :
switch ($options['action']) {
case "plugin_example_DoIt" :
-
+
echo " but do nothing :)";
break;
@@ -388,13 +388,13 @@ function plugin_example_MassiveActionsFieldsDisplay($options=array()) {
// MUST Use a specific AddWhere & $tab[X]['searchtype'] = 'equals'; declaration
function plugin_example_searchOptionsValues($options=array()) {
global $LANG;
-
+
$table = $options['searchoption']['table'];
$field = $options['searchoption']['field'];
-
+
// Table fields
switch ($table.".".$field) {
-
+
case "glpi_plugin_example_examples.serial" :
echo "Not really specific - Use your own dropdown - Just for example ";
Dropdown::show(getItemTypeForTable($options['searchoption']['table']),
@@ -788,4 +788,13 @@ function plugin_example_get_events(NotificationTargetTicket $target) {
function plugin_example_get_datas(NotificationTargetTicket $target) {
$target->datas['##ticket.example##'] = "Example datas";
}
+
+function plugin_example_postinit() {
+ global $CFG_GLPI;
+
+ // All plugins are initialized, so all types are registered
+ foreach ($CFG_GLPI["infocom_types"] as $type) {
+ // do something
+ }
+}
?>
\ No newline at end of file
diff --git a/setup.php b/setup.php
index 20aca84..895a9c4 100755
--- a/setup.php
+++ b/setup.php
@@ -48,8 +48,8 @@ function plugin_init_example() {
Plugin::registerClass('PluginExampleExample',
array('notificationtemplates_types' => true));
-
- Plugin::registerClass('PluginExampleRuleTestCollection',
+
+ Plugin::registerClass('PluginExampleRuleTestCollection',
array('rulecollections_types' => true));
// Display a menu entry ?
@@ -146,6 +146,8 @@ function plugin_init_example() {
// Stats
$PLUGIN_HOOKS['stats']['example'] = array('stat.php' => 'New stat',
'stat.php?other' => 'New stats 2',);
+
+ $PLUGIN_HOOKS['post_init']['example'] = 'plugin_example_postinit';
}