2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
24 * @uses access_api.php
25 * @uses authentication_api.php
26 * @uses config_api.php
27 * @uses constant_inc.php
28 * @uses database_api.php
30 * @uses helper_api.php
34 * @uses summary_api.php
38 require_once( 'core.php' );
39 require_api( 'access_api.php' );
40 require_api( 'authentication_api.php' );
41 require_api( 'config_api.php' );
42 require_api( 'constant_inc.php' );
43 require_api( 'database_api.php' );
44 require_api( 'gpc_api.php' );
45 require_api( 'helper_api.php' );
46 require_api( 'html_api.php' );
47 require_api( 'lang_api.php' );
48 require_api( 'print_api.php' );
49 require_api( 'summary_api.php' );
50 require_api( 'user_api.php' );
52 $f_project_id = gpc_get_int( 'project_id', helper_get_current_project() );
54 # Override the current page to make sure we get the appropriate project-specific configuration
55 $g_project_override = $f_project_id;
57 access_ensure_project_level( config_get( 'view_summary_threshold' ) );
59 $t_user_id = auth_get_current_user_id();
61 $t_project_ids = user_get_all_accessible_projects( $t_user_id, $f_project_id);
62 $specific_where = helper_project_specific_where( $f_project_id, $t_user_id);
64 $t_bug_table = db_get_table( 'bug' );
65 $t_history_table = db_get_table( 'bug_history' );
67 $t_resolved = config_get( 'bug_resolved_status_threshold' );
68 # the issue may have passed through the status we consider resolved
69 # (e.g., bug is CLOSED, not RESOLVED). The linkage to the history field
70 # will look up the most recent 'resolved' status change and return it as well
71 $query = "SELECT b.id, b.date_submitted, b.last_updated, MAX(h.date_modified) as hist_update, b.status
72 FROM $t_bug_table b LEFT JOIN $t_history_table h
73 ON b.id = h.bug_id AND h.type=0 AND h.field_name='status' AND h.new_value=" . db_param() . "
74 WHERE b.status >=" . db_param() . " AND $specific_where
75 GROUP BY b.id, b.status, b.date_submitted, b.last_updated
77 $result = db_query_bound( $query, Array( $t_resolved, $t_resolved ) );
78 $bug_count = db_num_rows( $result );
83 for ($i=0;$i<$bug_count;$i++
) {
84 $row = db_fetch_array( $result );
85 $t_date_submitted = $row['date_submitted'];
87 $t_status = $row['status'];
88 if ( $row['hist_update'] !== NULL ) {
89 $t_last_updated = $row['hist_update'];
91 $t_last_updated = $row['last_updated'];
94 if ($t_last_updated < $t_date_submitted) {
96 $t_date_submitted = 0;
99 $t_diff = $t_last_updated - $t_date_submitted;
100 $t_total_time = $t_total_time +
$t_diff;
101 if ( $t_diff > $t_largest_diff ) {
102 $t_largest_diff = $t_diff;
103 $t_bug_id = $row['id'];
106 if ( $bug_count < 1 ) {
109 $t_average_time = $t_total_time / $bug_count;
111 $t_largest_diff = number_format( $t_largest_diff / SECONDS_PER_DAY
, 2 );
112 $t_total_time = number_format( $t_total_time / SECONDS_PER_DAY
, 2 );
113 $t_average_time = number_format( $t_average_time / SECONDS_PER_DAY
, 2 );
115 $t_orct_arr = preg_split( '/[\)\/\(]/', lang_get( 'orct' ), -1, PREG_SPLIT_NO_EMPTY
);
118 foreach ( $t_orct_arr as $t_orct_s ) {
119 $t_orcttab .= '<td class="right">';
120 $t_orcttab .= $t_orct_s;
121 $t_orcttab .= '</td>';
124 html_page_top( lang_get( 'summary_link' ) );
129 print_summary_menu( 'summary_page.php' );
130 print_summary_submenu(); ?
>
132 <table
class="width100" cellspacing
="1">
134 <td
class="form-title" colspan
="2">
135 <?php
echo lang_get( 'summary_title' ) ?
>
141 if ( 1 < count( $t_project_ids ) ) { ?
>
142 <table
class="width100" cellspacing
="1">
144 <td
class="form-title" colspan
="1">
145 <?php
echo lang_get( 'by_project' ) ?
>
147 <?php
echo $t_orcttab ?
>
149 <?php
summary_print_by_project(); ?
>
155 <table
class="width100" cellspacing
="1">
157 <td
class="form-title" colspan
="1">
158 <?php
echo lang_get( 'by_status' ) ?
>
160 <?php
echo $t_orcttab ?
>
162 <?php
summary_print_by_enum( 'status' ) ?
>
167 <table
class="width100" cellspacing
="1">
169 <td
class="form-title" colspan
="1">
170 <?php
echo lang_get( 'by_severity' ) ?
>
172 <?php
echo $t_orcttab ?
>
174 <?php
summary_print_by_enum( 'severity' ) ?
>
179 <table
class="width100" cellspacing
="1">
181 <td
class="form-title" colspan
="1">
182 <?php
echo lang_get( 'by_category' ) ?
>
184 <?php
echo $t_orcttab ?
>
186 <?php
summary_print_by_category() ?
>
191 <table
class="width100">
193 <td
class="form-title" colspan
="5">
194 <?php
echo lang_get( 'time_stats' ) ?
>
199 <?php
echo lang_get( 'longest_open_bug' ) ?
>
204 print_bug_link( $t_bug_id );
211 <?php
echo lang_get( 'longest_open' ) ?
>
214 <?php
echo $t_largest_diff ?
>
219 <?php
echo lang_get( 'average_time' ) ?
>
222 <?php
echo $t_average_time ?
>
227 <?php
echo lang_get( 'total_time' ) ?
>
230 <?php
echo $t_total_time ?
>
237 <table
class="width100" cellspacing
="1">
239 <td
class="form-title" colspan
="1">
240 <?php
echo lang_get( 'developer_stats' ) ?
>
242 <?php
echo $t_orcttab ?
>
244 <?php
summary_print_by_developer() ?
>
251 <table
class="width100" cellspacing
="1">
253 <td
class="form-title"><?php
echo lang_get( 'by_date' ); ?
></td
>
254 <td
class="right"><?php
echo lang_get( 'opened' ); ?
></td
>
255 <td
class="right"><?php
echo lang_get( 'resolved' ); ?
></td
>
256 <td
class="right"><?php
echo lang_get( 'balance' ); ?
></td
>
258 <?php
summary_print_by_date( config_get( 'date_partitions' ) ) ?
>
263 <table
class="width100" cellspacing
="1">
265 <td
class="form-title" width
="86%"><?php
echo lang_get( 'most_active' ); ?
></td
>
266 <td
class="right" width
="14%"><?php
echo lang_get( 'score' ); ?
></td
>
268 <?php
summary_print_by_activity() ?
>
273 <table
class="width100" cellspacing
="1">
275 <td
class="form-title" width
="86%"><?php
echo lang_get( 'longest_open' ); ?
></td
>
276 <td
class="right" width
="14%"><?php
echo lang_get( 'days' ); ?
></td
>
278 <?php
summary_print_by_age() ?
>
283 <table
class="width100" cellspacing
="1">
285 <td
class="form-title" colspan
="1">
286 <?php
echo lang_get( 'by_resolution' ) ?
>
288 <?php
echo $t_orcttab ?
>
290 <?php
summary_print_by_enum( 'resolution' ) ?
>
295 <table
class="width100" cellspacing
="1">
297 <td
class="form-title" colspan
="1">
298 <?php
echo lang_get( 'by_priority' ) ?
>
300 <?php
echo $t_orcttab ?
>
302 <?php
summary_print_by_enum( 'priority' ) ?
>
307 <table
class="width100" cellspacing
="1">
309 <td
class="form-title" colspan
="1">
310 <?php
echo lang_get( 'reporter_stats' ) ?
>
312 <?php
echo $t_orcttab ?
>
314 <?php
summary_print_by_reporter() ?
>
319 <table
class="width100" cellspacing
="1">
321 <td
class="form-title" colspan
="1">
322 <?php
echo lang_get( 'reporter_effectiveness' ) ?
>
325 <?php
echo lang_get( 'severity' ) ?
>
328 <?php
echo lang_get( 'errors' ) ?
>
331 <?php
echo lang_get( 'total' ) ?
>
334 <?php
summary_print_reporter_effectiveness( config_get( 'severity_enum_string' ), config_get( 'resolution_enum_string' ) ) ?
>
341 <table
class="width100" cellspacing
="1">
343 <td
class="form-title" colspan
="1">
344 <?php
echo lang_get( 'reporter_by_resolution' ) ?
>
347 $t_resolutions = MantisEnum
::getValues( config_get( 'resolution_enum_string' ) );
349 foreach ( $t_resolutions as $t_resolution ) {
350 echo '<td>', get_enum_element( 'resolution', $t_resolution ), '</td>';
353 echo '<td>', lang_get( 'percentage_errors' ), '</td>';
356 <?php
summary_print_reporter_resolution( config_get( 'resolution_enum_string' ) ) ?
>
363 <table
class="width100" cellspacing
="1">
365 <td
class="form-title" colspan
="1">
366 <?php
echo lang_get( 'developer_by_resolution' ) ?
>
369 $t_resolutions = MantisEnum
::getValues( config_get( 'resolution_enum_string' ) );
371 foreach ( $t_resolutions as $t_resolution ) {
372 echo '<td>', get_enum_element( 'resolution', $t_resolution ), '</td>';
375 echo '<td>', lang_get( 'percentage_fixed' ), '</td>';
378 <?php
summary_print_developer_resolution( config_get( 'resolution_enum_string' ) ) ?
>