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 - 2011 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
41 require_once( 'core.php' );
42 require_api( 'access_api.php' );
43 require_api( 'authentication_api.php' );
44 require_api( 'config_api.php' );
45 require_api( 'constant_inc.php' );
46 require_api( 'database_api.php' );
47 require_api( 'gpc_api.php' );
48 require_api( 'helper_api.php' );
49 require_api( 'html_api.php' );
50 require_api( 'lang_api.php' );
51 require_api( 'print_api.php' );
52 require_api( 'summary_api.php' );
53 require_api( 'user_api.php' );
55 $f_project_id = gpc_get_int( 'project_id', helper_get_current_project() );
57 # Override the current page to make sure we get the appropriate project-specific configuration
58 $g_project_override = $f_project_id;
60 access_ensure_project_level( config_get( 'view_summary_threshold' ) );
62 $t_user_id = auth_get_current_user_id();
64 $t_project_ids = user_get_all_accessible_projects( $t_user_id, $f_project_id);
65 $specific_where = helper_project_specific_where( $f_project_id, $t_user_id);
67 $t_bug_table = db_get_table( 'bug' );
68 $t_history_table = db_get_table( 'bug_history' );
70 $t_resolved = config_get( 'bug_resolved_status_threshold' );
71 # the issue may have passed through the status we consider resolved
72 # (e.g., bug is CLOSED, not RESOLVED). The linkage to the history field
73 # will look up the most recent 'resolved' status change and return it as well
74 $query = "SELECT b.id, b.date_submitted, b.last_updated, MAX(h.date_modified) as hist_update, b.status
75 FROM $t_bug_table b LEFT JOIN $t_history_table h
76 ON b.id = h.bug_id AND h.type=0 AND h.field_name='status' AND h.new_value=" . db_param() . "
77 WHERE b.status >=" . db_param() . " AND $specific_where
78 GROUP BY b.id, b.status, b.date_submitted, b.last_updated
80 $result = db_query_bound( $query, Array( $t_resolved, $t_resolved ) );
81 $bug_count = db_num_rows( $result );
86 for ($i=0;$i<$bug_count;$i++
) {
87 $row = db_fetch_array( $result );
88 $t_date_submitted = $row['date_submitted'];
90 $t_status = $row['status'];
91 if ( $row['hist_update'] !== NULL ) {
92 $t_last_updated = $row['hist_update'];
94 $t_last_updated = $row['last_updated'];
97 if ($t_last_updated < $t_date_submitted) {
99 $t_date_submitted = 0;
102 $t_diff = $t_last_updated - $t_date_submitted;
103 $t_total_time = $t_total_time +
$t_diff;
104 if ( $t_diff > $t_largest_diff ) {
105 $t_largest_diff = $t_diff;
106 $t_bug_id = $row['id'];
109 if ( $bug_count < 1 ) {
112 $t_average_time = $t_total_time / $bug_count;
114 $t_largest_diff = number_format( $t_largest_diff / SECONDS_PER_DAY
, 2 );
115 $t_total_time = number_format( $t_total_time / SECONDS_PER_DAY
, 2 );
116 $t_average_time = number_format( $t_average_time / SECONDS_PER_DAY
, 2 );
118 $t_orct_arr = preg_split( '/[\)\/\(]/', lang_get( 'orct' ), -1, PREG_SPLIT_NO_EMPTY
);
121 foreach ( $t_orct_arr as $t_orct_s ) {
122 $t_orcttab .= '<td class="right">';
123 $t_orcttab .= $t_orct_s;
124 $t_orcttab .= '</td>';
127 html_page_top( lang_get( 'summary_link' ) );
132 print_summary_menu( 'summary_page.php' );
133 print_summary_submenu(); ?
>
135 <table
class="width100" cellspacing
="1">
137 <td
class="form-title" colspan
="2">
138 <?php
echo lang_get( 'summary_title' ) ?
>
144 if ( 1 < count( $t_project_ids ) ) { ?
>
145 <table
class="width100" cellspacing
="1">
147 <td
class="form-title" colspan
="1">
148 <?php
echo lang_get( 'by_project' ) ?
>
150 <?php
echo $t_orcttab ?
>
152 <?php
summary_print_by_project(); ?
>
158 <table
class="width100" cellspacing
="1">
160 <td
class="form-title" colspan
="1">
161 <?php
echo lang_get( 'by_status' ) ?
>
163 <?php
echo $t_orcttab ?
>
165 <?php
summary_print_by_enum( 'status' ) ?
>
170 <table
class="width100" cellspacing
="1">
172 <td
class="form-title" colspan
="1">
173 <?php
echo lang_get( 'by_severity' ) ?
>
175 <?php
echo $t_orcttab ?
>
177 <?php
summary_print_by_enum( 'severity' ) ?
>
182 <table
class="width100" cellspacing
="1">
184 <td
class="form-title" colspan
="1">
185 <?php
echo lang_get( 'by_category' ) ?
>
187 <?php
echo $t_orcttab ?
>
189 <?php
summary_print_by_category() ?
>
194 <table
class="width100">
196 <td
class="form-title" colspan
="5">
197 <?php
echo lang_get( 'time_stats' ) ?
>
202 <?php
echo lang_get( 'longest_open_bug' ) ?
>
207 print_bug_link( $t_bug_id );
214 <?php
echo lang_get( 'longest_open' ) ?
>
217 <?php
echo $t_largest_diff ?
>
222 <?php
echo lang_get( 'average_time' ) ?
>
225 <?php
echo $t_average_time ?
>
230 <?php
echo lang_get( 'total_time' ) ?
>
233 <?php
echo $t_total_time ?
>
240 <table
class="width100" cellspacing
="1">
242 <td
class="form-title" colspan
="1">
243 <?php
echo lang_get( 'developer_stats' ) ?
>
245 <?php
echo $t_orcttab ?
>
247 <?php
summary_print_by_developer() ?
>
254 <table
class="width100" cellspacing
="1">
256 <td
class="form-title"><?php
echo lang_get( 'by_date' ); ?
></td
>
257 <td
class="right"><?php
echo lang_get( 'opened' ); ?
></td
>
258 <td
class="right"><?php
echo lang_get( 'resolved' ); ?
></td
>
259 <td
class="right"><?php
echo lang_get( 'balance' ); ?
></td
>
261 <?php
summary_print_by_date( config_get( 'date_partitions' ) ) ?
>
266 <table
class="width100" cellspacing
="1">
268 <td
class="form-title" width
="86%"><?php
echo lang_get( 'most_active' ); ?
></td
>
269 <td
class="right" width
="14%"><?php
echo lang_get( 'score' ); ?
></td
>
271 <?php
summary_print_by_activity() ?
>
276 <table
class="width100" cellspacing
="1">
278 <td
class="form-title" width
="86%"><?php
echo lang_get( 'longest_open' ); ?
></td
>
279 <td
class="right" width
="14%"><?php
echo lang_get( 'days' ); ?
></td
>
281 <?php
summary_print_by_age() ?
>
286 <table
class="width100" cellspacing
="1">
288 <td
class="form-title" colspan
="1">
289 <?php
echo lang_get( 'by_resolution' ) ?
>
291 <?php
echo $t_orcttab ?
>
293 <?php
summary_print_by_enum( 'resolution' ) ?
>
298 <table
class="width100" cellspacing
="1">
300 <td
class="form-title" colspan
="1">
301 <?php
echo lang_get( 'by_priority' ) ?
>
303 <?php
echo $t_orcttab ?
>
305 <?php
summary_print_by_enum( 'priority' ) ?
>
310 <table
class="width100" cellspacing
="1">
312 <td
class="form-title" colspan
="1">
313 <?php
echo lang_get( 'reporter_stats' ) ?
>
315 <?php
echo $t_orcttab ?
>
317 <?php
summary_print_by_reporter() ?
>
322 <table
class="width100" cellspacing
="1">
324 <td
class="form-title" colspan
="1">
325 <?php
echo lang_get( 'reporter_effectiveness' ) ?
>
328 <?php
echo lang_get( 'severity' ) ?
>
331 <?php
echo lang_get( 'errors' ) ?
>
334 <?php
echo lang_get( 'total' ) ?
>
337 <?php
summary_print_reporter_effectiveness( config_get( 'severity_enum_string' ), config_get( 'resolution_enum_string' ) ) ?
>
344 <table
class="width100" cellspacing
="1">
346 <td
class="form-title" colspan
="1">
347 <?php
echo lang_get( 'reporter_by_resolution' ) ?
>
350 $t_resolutions = MantisEnum
::getValues( config_get( 'resolution_enum_string' ) );
352 foreach ( $t_resolutions as $t_resolution ) {
353 echo '<td>', get_enum_element( 'resolution', $t_resolution ), '</td>';
356 echo '<td>', lang_get( 'percentage_errors' ), '</td>';
359 <?php
summary_print_reporter_resolution( config_get( 'resolution_enum_string' ) ) ?
>
366 <table
class="width100" cellspacing
="1">
368 <td
class="form-title" colspan
="1">
369 <?php
echo lang_get( 'developer_by_resolution' ) ?
>
372 $t_resolutions = MantisEnum
::getValues( config_get( 'resolution_enum_string' ) );
374 foreach ( $t_resolutions as $t_resolution ) {
375 echo '<td>', get_enum_element( 'resolution', $t_resolution ), '</td>';
378 echo '<td>', lang_get( 'percentage_fixed' ), '</td>';
381 <?php
summary_print_developer_resolution( config_get( 'resolution_enum_string' ) ) ?
>