From 760c7de79bc9e3b64d0da30e2d6f1a725d875cab Mon Sep 17 00:00:00 2001 From: moyooo Date: Fri, 19 Jun 2009 15:20:56 +0000 Subject: [PATCH] [example] clean usage for planning : set planningID git-svn-id: https://forge.glpi-project.org/svn/example/trunk@79 349b9182-4a13-0410-896f-e5e9767dd1b3 --- hook.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hook.php b/hook.php index 7dd52fa..50b0ce2 100644 --- a/hook.php +++ b/hook.php @@ -479,19 +479,21 @@ function plugin_item_transfer_example($parm){ // Parm contains begin, end and who // Create data to be displayed in the planning of $parm["who"] or $parm["who_group"] 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 - list($date,$time)=explode(" ",$parm["begin"]); - $end=$date." 13:33:00"; - + $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["plugin"]="example"; - $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["begin"]=$parm["begin"]; - $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["end"]=$end; + $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["begin"]=date("Y-m-d 17:00:00"); + $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["end"]=date("Y-m-d 18:00:00"); $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["name"]="test planning example 1 "; + // Set the ID using the ID of the item in the database to have unique ID + $ID=date("Ymd"); // Current date for example + $parm["items"][$parm["begin"]."$$$"."plugin_example1"]["planningID"]="plugin_example".$ID; return $parm; }