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/>.
18 * This include file prints out the bug bugnote_stats
19 * $f_bug_id must already be defined
22 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
23 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
24 * @link http://www.mantisbt.org
26 * @uses bugnote_api.php
27 * @uses collapse_api.php
28 * @uses config_api.php
29 * @uses constant_inc.php
30 * @uses filter_api.php
32 * @uses helper_api.php
34 * @uses utility_api.php
37 if ( !defined( 'BUGNOTE_STATS_INC_ALLOW' ) ) {
41 require_api( 'bugnote_api.php' );
42 require_api( 'collapse_api.php' );
43 require_api( 'config_api.php' );
44 require_api( 'constant_inc.php' );
45 require_api( 'filter_api.php' );
46 require_api( 'gpc_api.php' );
47 require_api( 'helper_api.php' );
48 require_api( 'lang_api.php' );
49 require_api( 'utility_api.php' );
51 if ( OFF
== config_get('time_tracking_enabled') ) {
56 <a id
="bugnotestats"></a
><br
/>
59 collapse_open( 'bugnotestats' );
61 $t_bugnote_stats_from_def = date( "d:m:Y", $tpl_bug->date_submitted
);
62 $t_bugnote_stats_from_def_ar = explode ( ":", $t_bugnote_stats_from_def );
63 $t_bugnote_stats_from_def_d = $t_bugnote_stats_from_def_ar[0];
64 $t_bugnote_stats_from_def_m = $t_bugnote_stats_from_def_ar[1];
65 $t_bugnote_stats_from_def_y = $t_bugnote_stats_from_def_ar[2];
67 $t_bugnote_stats_from_d = gpc_get_string( 'start_day', $t_bugnote_stats_from_def_d );
68 $t_bugnote_stats_from_m = gpc_get_string( 'start_month', $t_bugnote_stats_from_def_m );
69 $t_bugnote_stats_from_y = gpc_get_string( 'start_year', $t_bugnote_stats_from_def_y );
71 $t_bugnote_stats_to_def = date( "d:m:Y" );
72 $t_bugnote_stats_to_def_ar = explode ( ":", $t_bugnote_stats_to_def );
73 $t_bugnote_stats_to_def_d = $t_bugnote_stats_to_def_ar[0];
74 $t_bugnote_stats_to_def_m = $t_bugnote_stats_to_def_ar[1];
75 $t_bugnote_stats_to_def_y = $t_bugnote_stats_to_def_ar[2];
77 $t_bugnote_stats_to_d = gpc_get_string( 'end_day', $t_bugnote_stats_to_def_d );
78 $t_bugnote_stats_to_m = gpc_get_string( 'end_month', $t_bugnote_stats_to_def_m );
79 $t_bugnote_stats_to_y = gpc_get_string( 'end_year', $t_bugnote_stats_to_def_y );
81 $f_get_bugnote_stats_button = gpc_get_string( 'get_bugnote_stats_button', '' );
83 <form method
="post" action
="">
84 <?php
# CSRF protection not required here - form does not result in modifications ?>
85 <input type
="hidden" name
="id" value
="<?php echo $f_bug_id ?>" />
86 <table
class="width100" cellspacing
="0">
88 <td
class="form-title" colspan
="4">
90 collapse_icon( 'bugnotestats' );
91 echo lang_get( 'time_tracking' ) ?
>
95 <td
class="category" width
="25%">
98 $t_filter[FILTER_PROPERTY_FILTER_BY_DATE
] = 'on';
99 $t_filter[FILTER_PROPERTY_START_DAY
] = $t_bugnote_stats_from_d;
100 $t_filter[FILTER_PROPERTY_START_MONTH
] = $t_bugnote_stats_from_m;
101 $t_filter[FILTER_PROPERTY_START_YEAR
] = $t_bugnote_stats_from_y;
102 $t_filter[FILTER_PROPERTY_END_DAY
] = $t_bugnote_stats_to_d;
103 $t_filter[FILTER_PROPERTY_END_MONTH
] = $t_bugnote_stats_to_m;
104 $t_filter[FILTER_PROPERTY_END_YEAR
] = $t_bugnote_stats_to_y;
105 print_filter_do_filter_by_date(true);
110 <td
class="center" colspan
="2">
111 <input type
="submit" class="button" name
="get_bugnote_stats_button" value
="<?php echo lang_get( 'time_tracking_get_info_button' ) ?>" />
118 if ( !is_blank( $f_get_bugnote_stats_button ) ) {
119 $t_from = "$t_bugnote_stats_from_y-$t_bugnote_stats_from_m-$t_bugnote_stats_from_d";
120 $t_to = "$t_bugnote_stats_to_y-$t_bugnote_stats_to_m-$t_bugnote_stats_to_d";
121 $t_bugnote_stats = bugnote_stats_get_events_array( $f_bug_id, $t_from, $t_to );
124 <table
class="width100" cellspacing
="0">
125 <tr
class="row-category-history">
126 <td
class="small-caption">
127 <?php
echo lang_get( 'username' ) ?
>
129 <td
class="small-caption">
130 <?php
echo lang_get( 'time_tracking' ) ?
>
134 $t_sum_in_minutes = 0;
135 foreach ( $t_bugnote_stats as $t_item ) {
136 $t_sum_in_minutes +
= $t_item['sum_time_tracking'];
137 $t_item['sum_time_tracking'] = db_minutes_to_hhmm ( $t_item['sum_time_tracking'] );
140 <tr
<?php
echo helper_alternate_class() ?
>>
141 <td
class="small-caption">
142 <?php
echo string_display_line( $t_item['username'] ) ?
>
144 <td
class="small-caption">
145 <?php
echo $t_item['sum_time_tracking'] ?
>
148 <?php
} # end for loop ?>
149 <tr
<?php
echo helper_alternate_class() ?
>>
150 <td
class="small-caption">
151 <?php
echo lang_get( 'total_time' ) ?
>
153 <td
class="small-caption">
154 <?php
echo db_minutes_to_hhmm ( $t_sum_in_minutes ) ?
>
161 collapse_closed( 'bugnotestats' );
163 <table
class="width100" cellspacing
="0">
165 <td
class="form-title" colspan
="4">
167 collapse_icon( 'bugnotestats' );
168 echo lang_get( 'time_tracking' ) ?
>
173 collapse_end( 'bugnotestats' );