/**
  * Used to display each status time used for each group/user
  *
  *
  * @param Ticket $ticket
  */
 static function ShowDetail(Ticket $ticket, $type)
 {
     $ptState = new PluginTimelineticketState();
     if ($type == 'group') {
         $ptItem = new PluginTimelineticketAssignGroup();
     } else {
         if ($type == 'user') {
             $ptItem = new PluginTimelineticketAssignUser();
         }
     }
     $a_states = $ptState->find("`tickets_id`='" . $ticket->getField('id') . "'", "`date`");
     $a_state_delays = array();
     $a_state_num = array();
     $delay = 0;
     $list_status = Ticket::getAllStatusArray();
     $status = "new";
     foreach ($a_states as $array) {
         $delay += $array['delay'];
         $a_state_delays[$delay] = $array['old_status'];
         $a_state_num[] = $delay;
     }
     $a_state_num[] = $delay;
     $last_delay = $delay;
     $a_groups = $ptItem->find("`tickets_id`='" . $ticket->getField('id') . "'", "`date`");
     echo "<table class='tab_cadre_fixe' width='100%'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th colspan='" . (count($list_status) + 1) . "'>";
     _e('Result details');
     if ($type == 'group') {
         echo " (" . __('Groups in charge of the ticket', 'timelineticket') . ")";
     } else {
         if ($type == 'user') {
             echo " (" . __('Technicians in charge of the ticket', 'timelineticket') . ")";
         }
     }
     echo "</th>";
     echo "</tr>";
     echo "</tr>";
     echo "<th>";
     echo "</th>";
     foreach ($list_status as $name) {
         echo "<th>";
         echo $name;
         echo "</th>";
     }
     echo "</tr>";
     if ($type == 'group') {
         $a_details = PluginTimelineticketToolbox::getDetails($ticket, 'group', false);
     } else {
         if ($type == 'user') {
             $a_details = PluginTimelineticketToolbox::getDetails($ticket, 'user', false);
         }
     }
     foreach ($a_details as $items_id => $a_detail) {
         $a_status = array();
         foreach ($a_detail as $data) {
             if (!isset($a_status[$data['Status']])) {
                 $a_status[$data['Status']] = 0;
             }
             $a_status[$data['Status']] += $data['End'] - $data['Start'];
         }
         echo "<tr class='tab_bg_1'>";
         if ($type == 'group') {
             echo "<td>" . Dropdown::getDropdownName("glpi_groups", $items_id) . "</td>";
         } else {
             if ($type == 'user') {
                 echo "<td>" . Dropdown::getDropdownName("glpi_users", $items_id) . "</td>";
             }
         }
         foreach ($list_status as $status => $name) {
             echo "<td>";
             if (isset($a_status[$status])) {
                 echo Html::timestampToString($a_status[$status], true);
             }
             echo "</td>";
         }
         echo "</tr>";
     }
     echo "</table>";
 }