break; } $i++; } $data = implode(",", $data); $links = "'" . implode("','", $links) . "'"; } else { $data = "['" . _("No tickets") . "',0]"; $colors = '"#E9967A"'; } break; case 'ticketResolutionTime': $ttl_groups = array(); $type_graph = 'bar'; $legend = empty($_GET['legend']) ? "s" : GET('legend'); $list = Incident::incidents_by_resolution_time($conn, null, $user); $ttl_groups = array("1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0); $total_days = 0; $day_count = null; foreach ($list as $incident) { $ttl_secs = $incident->get_life_time('s'); $days = round($ttl_secs / 60 / 60 / 24); $total_days += $days; $day_count++; if ($days < 1) { $days = 1; } if ($days > 6) { $days = 6; } @$ttl_groups[$days]++;
$assets = $shared->get("TicketsStatus4_assets"); $ticket_closed_by_month = Incident::incidents_closed_by_month($conn, $assets, $user); if (is_array($ticket_closed_by_month) && !empty($ticket_closed_by_month)) { foreach ($ticket_closed_by_month as $event_type => $months) { foreach ($months as $month => $occurrences) { $data[$month] = (int) $data[$month] + (int) $occurrences; } } } $labelx = array_keys($data); $datay = array_values($data); } elseif ($by == "resolution_time") { $user = $shared->get("TicketsStatus5_user"); $assets = $shared->get("TicketsStatus5_assets"); $args = $shared->get("TicketsStatus5_args"); $list = Incident::incidents_by_resolution_time($conn, $assets, $user, $args); $ttl_groups = array("1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0); $total_days = 0; $day_count = null; foreach ($list as $incident) { $ttl_secs = $incident->get_life_time('s'); $days = round($ttl_secs / 60 / 60 / 24); $total_days += $days; $day_count++; if ($days < 1) { $days = 1; } if ($days > 6) { $days = 6; } @$ttl_groups[$days]++;
$user_short = strlen($user) > 28 ? substr($user, 0, 25) . "..." : $user; $data[] = $ocurrences; $label[] = utf8_encode($user_short); $link = Menu::get_menu_url("/ossim/incidents/index.php?in_charge={$user}&status=not_closed&hmenu=Tickets&smenu=Tickets", 'analysis', 'tickets'); $links[] = $link; } else { break; } $i++; } } $colors = get_widget_colors(count($data)); break; case 'ticketResolutionTime': $ttl_groups = array(); $list = Incident::incidents_by_resolution_time($conn, $param_filters["assets"], $param_filters["user"]); $ttl_groups = array("1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0); $total_days = 0; $day_count = null; foreach ($list as $incident) { $ttl_secs = $incident->get_life_time('s'); $days = round($ttl_secs / 60 / 60 / 24); $total_days += $days; $day_count++; if ($days < 1) { $days = 1; } if ($days > 6) { $days = 6; } @$ttl_groups[$days]++;