From 510d6fbc727ae9f688fa673e82639537f498a44f Mon Sep 17 00:00:00 2001 From: moyooo Date: Sun, 25 Mar 2007 21:49:53 +0000 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20d'un=20hook=20planning=20pour?= =?UTF-8?q?=20les=20plugins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://forge.glpi-project.org/svn/example/trunk@16 349b9182-4a13-0410-896f-e5e9767dd1b3 --- setup.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/setup.php b/setup.php index 7ab2e7b..965be54 100755 --- a/setup.php +++ b/setup.php @@ -67,6 +67,11 @@ function plugin_init_example() { $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"; + //function to populate planning + $PLUGIN_HOOKS['planning_populate']['example']="plugin_planning_populate_example"; + //function to populate planning + $PLUGIN_HOOKS['display_planning']['example']="plugin_display_planning_example"; + } @@ -160,6 +165,28 @@ function plugin_item_restore_example($parm){ return false; } +// Parm contains begin, end and who +// Create data to be displayed in the planning of $parm["who"] between $parm["begin"] and $parm["end"] +function plugin_planning_populate_example($parm){ + + // Add items in the items fields of the parm array + // Items need to have an unique index beginning by the begin date of the item to display + // needed to be correcly displayed + $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["plugin"]="example"; + $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["begin"]=$parm["begin"]; + $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["end"]=$parm["begin"]; + $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["name"]="test planning example 1 "; + + return $parm; +} + +// Display the planning item +function plugin_display_planning_example($parm){ + + // Add items in the items fields of the parm array + echo "--".$parm["name"]."--"; +} + // Define headings added by the plugin function plugin_get_headings_example($type,$withtemplate){ switch ($type){