SOAP API: do not try to unserialize an invalid filter
[mantis.git] / summary_page.php
blobe0c990864bf3075008006cf54a80cf11c33cf83f
1 <?php
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/>.
17 /**
18 * @package MantisBT
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
23 * @uses core.php
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
29 * @uses gpc_api.php
30 * @uses helper_api.php
31 * @uses html_api.php
32 * @uses lang_api.php
33 * @uses print_api.php
34 * @uses summary_api.php
35 * @uses user_api.php
38 /**
39 * MantisBT Core API's
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
79 ORDER BY b.id ASC";
80 $result = db_query_bound( $query, Array( $t_resolved, $t_resolved ) );
81 $bug_count = db_num_rows( $result );
83 $t_bug_id = 0;
84 $t_largest_diff = 0;
85 $t_total_time = 0;
86 for ($i=0;$i<$bug_count;$i++) {
87 $row = db_fetch_array( $result );
88 $t_date_submitted = $row['date_submitted'];
89 $t_id = $row['id'];
90 $t_status = $row['status'];
91 if ( $row['hist_update'] !== NULL ) {
92 $t_last_updated = $row['hist_update'];
93 } else {
94 $t_last_updated = $row['last_updated'];
97 if ($t_last_updated < $t_date_submitted) {
98 $t_last_updated = 0;
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 ) {
110 $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 );
120 $t_orcttab = "";
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' ) );
130 <br />
131 <?php
132 print_summary_menu( 'summary_page.php' );
133 print_summary_submenu(); ?>
134 <br />
135 <table class="width100" cellspacing="1">
136 <tr>
137 <td class="form-title" colspan="2">
138 <?php echo lang_get( 'summary_title' ) ?>
139 </td>
140 </tr>
141 <tr>
142 <td width="50%">
143 <?php # PROJECT #
144 if ( 1 < count( $t_project_ids ) ) { ?>
145 <table class="width100" cellspacing="1">
146 <tr>
147 <td class="form-title" colspan="1">
148 <?php echo lang_get( 'by_project' ) ?>
149 </td>
150 <?php echo $t_orcttab ?>
151 </tr>
152 <?php summary_print_by_project(); ?>
153 </table>
155 <br />
156 <?php } ?>
158 <table class="width100" cellspacing="1">
159 <tr>
160 <td class="form-title" colspan="1">
161 <?php echo lang_get( 'by_status' ) ?>
162 </td>
163 <?php echo $t_orcttab ?>
164 </tr>
165 <?php summary_print_by_enum( 'status' ) ?>
166 </table>
168 <br />
170 <table class="width100" cellspacing="1">
171 <tr>
172 <td class="form-title" colspan="1">
173 <?php echo lang_get( 'by_severity' ) ?>
174 </td>
175 <?php echo $t_orcttab ?>
176 </tr>
177 <?php summary_print_by_enum( 'severity' ) ?>
178 </table>
180 <br />
182 <table class="width100" cellspacing="1">
183 <tr>
184 <td class="form-title" colspan="1">
185 <?php echo lang_get( 'by_category' ) ?>
186 </td>
187 <?php echo $t_orcttab ?>
188 </tr>
189 <?php summary_print_by_category() ?>
190 </table>
192 <br />
194 <table class="width100">
195 <tr>
196 <td class="form-title" colspan="5">
197 <?php echo lang_get( 'time_stats' ) ?>
198 </td>
199 </tr>
200 <tr class="row-1">
201 <td width="50%">
202 <?php echo lang_get( 'longest_open_bug' ) ?>
203 </td>
204 <td width="50%">
205 <?php
206 if ($t_bug_id>0) {
207 print_bug_link( $t_bug_id );
210 </td>
211 </tr>
212 <tr class="row-2">
213 <td>
214 <?php echo lang_get( 'longest_open' ) ?>
215 </td>
216 <td>
217 <?php echo $t_largest_diff ?>
218 </td>
219 </tr>
220 <tr class="row-1">
221 <td>
222 <?php echo lang_get( 'average_time' ) ?>
223 </td>
224 <td>
225 <?php echo $t_average_time ?>
226 </td>
227 </tr>
228 <tr class="row-2">
229 <td>
230 <?php echo lang_get( 'total_time' ) ?>
231 </td>
232 <td>
233 <?php echo $t_total_time ?>
234 </td>
235 </tr>
236 </table>
238 <br />
240 <table class="width100" cellspacing="1">
241 <tr>
242 <td class="form-title" colspan="1">
243 <?php echo lang_get( 'developer_stats' ) ?>
244 </td>
245 <?php echo $t_orcttab ?>
246 </tr>
247 <?php summary_print_by_developer() ?>
248 </table>
249 </td>
253 <td width="50%">
254 <table class="width100" cellspacing="1">
255 <tr>
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>
260 </tr>
261 <?php summary_print_by_date( config_get( 'date_partitions' ) ) ?>
262 </table>
264 <br />
266 <table class="width100" cellspacing="1">
267 <tr>
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>
270 </tr>
271 <?php summary_print_by_activity() ?>
272 </table>
274 <br />
276 <table class="width100" cellspacing="1">
277 <tr>
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>
280 </tr>
281 <?php summary_print_by_age() ?>
282 </table>
284 <br />
286 <table class="width100" cellspacing="1">
287 <tr>
288 <td class="form-title" colspan="1">
289 <?php echo lang_get( 'by_resolution' ) ?>
290 </td>
291 <?php echo $t_orcttab ?>
292 </tr>
293 <?php summary_print_by_enum( 'resolution' ) ?>
294 </table>
296 <br />
298 <table class="width100" cellspacing="1">
299 <tr>
300 <td class="form-title" colspan="1">
301 <?php echo lang_get( 'by_priority' ) ?>
302 </td>
303 <?php echo $t_orcttab ?>
304 </tr>
305 <?php summary_print_by_enum( 'priority' ) ?>
306 </table>
308 <br />
310 <table class="width100" cellspacing="1">
311 <tr>
312 <td class="form-title" colspan="1">
313 <?php echo lang_get( 'reporter_stats' ) ?>
314 </td>
315 <?php echo $t_orcttab ?>
316 </tr>
317 <?php summary_print_by_reporter() ?>
318 </table>
320 <br />
322 <table class="width100" cellspacing="1">
323 <tr>
324 <td class="form-title" colspan="1">
325 <?php echo lang_get( 'reporter_effectiveness' ) ?>
326 </td>
327 <td>
328 <?php echo lang_get( 'severity' ) ?>
329 </td>
330 <td>
331 <?php echo lang_get( 'errors' ) ?>
332 </td>
333 <td>
334 <?php echo lang_get( 'total' ) ?>
335 </td>
336 </tr>
337 <?php summary_print_reporter_effectiveness( config_get( 'severity_enum_string' ), config_get( 'resolution_enum_string' ) ) ?>
338 </table>
339 </td>
340 </tr>
342 <tr>
343 <td colspan="2">
344 <table class="width100" cellspacing="1">
345 <tr>
346 <td class="form-title" colspan="1">
347 <?php echo lang_get( 'reporter_by_resolution' ) ?>
348 </td>
349 <?php
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>';
358 </tr>
359 <?php summary_print_reporter_resolution( config_get( 'resolution_enum_string' ) ) ?>
360 </table>
361 </td>
362 </tr>
364 <tr>
365 <td colspan="2">
366 <table class="width100" cellspacing="1">
367 <tr>
368 <td class="form-title" colspan="1">
369 <?php echo lang_get( 'developer_by_resolution' ) ?>
370 </td>
371 <?php
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>';
380 </tr>
381 <?php summary_print_developer_resolution( config_get( 'resolution_enum_string' ) ) ?>
382 </table>
383 </td>
384 </tr>
385 </table>
387 <?php
388 html_page_bottom();