/
summary_graph_imp_severity.php
94 lines (83 loc) · 2.55 KB
/
summary_graph_imp_severity.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# <SQLI>
# This page displays "improved" charts on severities : bars, 3Dpie and a mix severities per status
?>
<?php include( 'core_API.php' ) ?>
<?php login_cookie_check() ?>
<?php
# if user below view summary threshold, then re-direct to mainpage.
if ( !access_level_check_greater_or_equal( $g_view_summary_threshold ) ) {
print_header_redirect( 'main_page.php' );
}
#checking if it's a per project statistic or all projects
if ($g_project_cookie_val=='0000000') {
$specific_where = ' 1=1';
} else {
$specific_where = " project_id='$g_project_cookie_val'";
}
$t_res_val = RESOLVED;
$query = "SELECT id, UNIX_TIMESTAMP(date_submitted) as date_submitted, last_updated
FROM $g_mantis_bug_table
WHERE project_id='$g_project_cookie_val' AND status='$t_res_val'";
$result = db_query( $query );
$bug_count = db_num_rows( $result );
$t_bug_id = 0;
$t_largest_diff = 0;
$t_total_time = 0;
for ($i=0;$i<$bug_count;$i++) {
$row = db_fetch_array( $result );
$t_date_submitted = ($row['date_submitted']);
$t_last_updated = $row['last_updated'];
if ($t_last_updated < $t_date_submitted) {
$t_last_updated = 0;
$t_date_submitted = 0;
}
$t_diff = $t_last_updated - $t_date_submitted;
$t_total_time = $t_total_time + $t_diff;
if ( $t_diff > $t_largest_diff ) {
$t_largest_diff = $t_diff;
$t_bug_id = $row['id'];
}
}
if ( $bug_count < 1 ) {
$bug_count = 1;
}
$t_average_time = $t_total_time / $bug_count;
$t_largest_diff = number_format( $t_largest_diff / 86400, 2 );
$t_total_time = number_format( $t_total_time / 86400, 2 );
$t_average_time = number_format( $t_average_time / 86400, 2 );
?>
<?php print_page_top1() ?>
<?php print_page_top2() ?>
<? print_summary_menu( 'summary_page.php' ) ?>
<p>
<? print_menu_graph() ?>
<p>
<table class="width100" cellspacing="1">
<tr>
<td class="form-title" colspan="2">
<?php echo $s_graph_imp_severity_title ?>
</td>
</tr>
<tr valign="top">
<td width="50%">
<img src="summary_graph_byseverity.php" border="0">
</td>
</tr>
<tr valign="top">
<td width="50%">
<img src="summary_graph_byseverity_pct.php" border="0">
</td>
</tr>
<tr valign="top">
<td width="50%">
<img src="summary_graph_byseverity_mix.php" border="0">
</td>
</tr>
</table>
<?php print_page_bot1( __FILE__ ) ?>