SOAP API: do not try to unserialize an invalid filter
[mantis.git] / bugnote_stats_inc.php
blob81f9617e195bc69405edf3e24b4d095ffa86df10
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 * This include file prints out the bug bugnote_stats
19 * $f_bug_id must already be defined
21 * @package MantisBT
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
31 * @uses gpc_api.php
32 * @uses helper_api.php
33 * @uses lang_api.php
34 * @uses utility_api.php
37 if ( !defined( 'BUGNOTE_STATS_INC_ALLOW' ) ) {
38 return;
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') ) {
52 return;
56 <a id="bugnotestats"></a><br />
58 <?php
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">
87 <tr>
88 <td class="form-title" colspan="4">
89 <?php
90 collapse_icon( 'bugnotestats' );
91 echo lang_get( 'time_tracking' ) ?>
92 </td>
93 </tr>
94 <tr class="row-2">
95 <td class="category" width="25%">
96 <?php
97 $t_filter = array();
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);
107 </td>
108 </tr>
109 <tr>
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' ) ?>" />
112 </td>
113 </tr>
115 </table>
116 </form>
117 <?php
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 );
123 <br />
124 <table class="width100" cellspacing="0">
125 <tr class="row-category-history">
126 <td class="small-caption">
127 <?php echo lang_get( 'username' ) ?>
128 </td>
129 <td class="small-caption">
130 <?php echo lang_get( 'time_tracking' ) ?>
131 </td>
132 </tr>
133 <?php
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'] ) ?>
143 </td>
144 <td class="small-caption">
145 <?php echo $t_item['sum_time_tracking'] ?>
146 </td>
147 </tr>
148 <?php } # end for loop ?>
149 <tr <?php echo helper_alternate_class() ?>>
150 <td class="small-caption">
151 <?php echo lang_get( 'total_time' ) ?>
152 </td>
153 <td class="small-caption">
154 <?php echo db_minutes_to_hhmm ( $t_sum_in_minutes ) ?>
155 </td>
156 </tr>
157 </table>
158 <?php
159 } # end if
161 collapse_closed( 'bugnotestats' );
163 <table class="width100" cellspacing="0">
164 <tr>
165 <td class="form-title" colspan="4">
166 <?php
167 collapse_icon( 'bugnotestats' );
168 echo lang_get( 'time_tracking' ) ?>
169 </td>
170 </tr>
171 </table>
172 <?php
173 collapse_end( 'bugnotestats' );