/**
* Display a Planning Item
*
* @param $val Array of the item to display
* @param $who ID of the user (0 if all)
* @param $type position of the item in the time block (in, through, begin or end)
* @param $complete complete display (more details)
*
* @return Nothing (display function)
**/
static function displayPlanningItem($val, $who, $type = "", $complete = 0)
{
global $CFG_GLPI, $LANG, $PLUGIN_HOOKS;
$color = "#e4e4e4";
if (isset($val["state"])) {
switch ($val["state"]) {
case 0:
$color = "#efefe7";
// Information
break;
case 1:
$color = "#fbfbfb";
// To be done
break;
case 2:
$color = "#e7e7e2";
// Done
break;
}
}
echo "<div style=' margin:auto; text-align:left; border:1px dashed #cccccc;\n background-color: {$color}; font-size:9px; width:98%;'>";
// Plugins case
if (isset($val["plugin"]) && isset($PLUGIN_HOOKS['display_planning'][$val["plugin"]])) {
$function = $PLUGIN_HOOKS['display_planning'][$val["plugin"]];
if (is_callable($function)) {
$val["type"] = $type;
call_user_func($function, $val);
}
} else {
if (isset($val["tickets_id"])) {
// show tracking
TicketPlanning::displayPlanningItem($val, $who, $type, $complete);
} else {
// show Reminder
Reminder::displayPlanningItem($val, $who, $type, $complete);
}
}
echo "</div><br>";
}