| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisBT - A PHP based bugtracking system 3 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. 8 # 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. 13 # 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/>. 16 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 22 * 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 36 */ 37 38 /** 39 * MantisBT Core API's 40 */ 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' ); 54 55 $f_project_id = gpc_get_int( 'project_id', helper_get_current_project() ); 56 57 # Override the current page to make sure we get the appropriate project-specific configuration 58 $g_project_override = $f_project_id; 59 60 access_ensure_project_level( config_get( 'view_summary_threshold' ) ); 61 62 $t_user_id = auth_get_current_user_id(); 63 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); 66 67 $t_bug_table = db_get_table( 'bug' ); 68 $t_history_table = db_get_table( 'bug_history' ); 69 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 ); 82 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']; 95 } 96 97 if ($t_last_updated < $t_date_submitted) { 98 $t_last_updated = 0; 99 $t_date_submitted = 0; 100 } 101 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']; 107 } 108 } 109 if ( $bug_count < 1 ) { 110 $bug_count = 1; 111 } 112 $t_average_time = $t_total_time / $bug_count; 113 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 ); 117 118 $t_orct_arr = preg_split( '/[\)\/\(]/', lang_get( 'orct' ), -1, PREG_SPLIT_NO_EMPTY ); 119 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>'; 125 } 126 127 html_page_top( lang_get( 'summary_link' ) ); 128 ?> 129 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> 154 155 <br /> 156 <?php } ?> 157 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> 167 168 <br /> 169 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> 179 180 <br /> 181 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> 191 192 <br /> 193 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 ); 208 } 209 ?> 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> 237 238 <br /> 239 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> 250 251 252 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> 263 264 <br /> 265 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> 273 274 <br /> 275 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> 283 284 <br /> 285 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> 295 296 <br /> 297 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> 307 308 <br /> 309 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> 319 320 <br /> 321 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> 341 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' ) ); 351 352 foreach ( $t_resolutions as $t_resolution ) { 353 echo '<td>', get_enum_element( 'resolution', $t_resolution ), '</td>'; 354 } 355 356 echo '<td>', lang_get( 'percentage_errors' ), '</td>'; 357 ?> 358 </tr> 359 <?php summary_print_reporter_resolution( config_get( 'resolution_enum_string' ) ) ?> 360 </table> 361 </td> 362 </tr> 363 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' ) ); 373 374 foreach ( $t_resolutions as $t_resolution ) { 375 echo '<td>', get_enum_element( 'resolution', $t_resolution ), '</td>'; 376 } 377 378 echo '<td>', lang_get( 'percentage_fixed' ), '</td>'; 379 ?> 380 </tr> 381 <?php summary_print_developer_resolution( config_get( 'resolution_enum_string' ) ) ?> 382 </table> 383 </td> 384 </tr> 385 </table> 386 387 <?php 388 html_page_bottom();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |