Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / bugnote_stats_inc.php
blob3bed2f27b27b9e67c6b963e50de7c947e7afaddc
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 - 2010 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 require_api( 'bugnote_api.php' );
38 require_api( 'collapse_api.php' );
39 require_api( 'config_api.php' );
40 require_api( 'constant_inc.php' );
41 require_api( 'filter_api.php' );
42 require_api( 'gpc_api.php' );
43 require_api( 'helper_api.php' );
44 require_api( 'lang_api.php' );
45 require_api( 'utility_api.php' );
47 if ( OFF == config_get('time_tracking_enabled') ) {
48 return;
52 <a name="bugnotestats" id="bugnotestats" /><br />
54 <?php
55 collapse_open( 'bugnotestats' );
57 $t_bugnote_stats_from_def = date( "d:m:Y", $t_bug->date_submitted );
58 $t_bugnote_stats_from_def_ar = explode ( ":", $t_bugnote_stats_from_def );
59 $t_bugnote_stats_from_def_d = $t_bugnote_stats_from_def_ar[0];
60 $t_bugnote_stats_from_def_m = $t_bugnote_stats_from_def_ar[1];
61 $t_bugnote_stats_from_def_y = $t_bugnote_stats_from_def_ar[2];
63 $t_bugnote_stats_from_d = gpc_get_string('start_day', $t_bugnote_stats_from_def_d);
64 $t_bugnote_stats_from_m = gpc_get_string('start_month', $t_bugnote_stats_from_def_m);
65 $t_bugnote_stats_from_y = gpc_get_string('start_year', $t_bugnote_stats_from_def_y);
67 $t_bugnote_stats_to_def = date( "d:m:Y" );
68 $t_bugnote_stats_to_def_ar = explode ( ":", $t_bugnote_stats_to_def );
69 $t_bugnote_stats_to_def_d = $t_bugnote_stats_to_def_ar[0];
70 $t_bugnote_stats_to_def_m = $t_bugnote_stats_to_def_ar[1];
71 $t_bugnote_stats_to_def_y = $t_bugnote_stats_to_def_ar[2];
73 $t_bugnote_stats_to_d = gpc_get_string('end_day', $t_bugnote_stats_to_def_d);
74 $t_bugnote_stats_to_m = gpc_get_string('end_month', $t_bugnote_stats_to_def_m);
75 $t_bugnote_stats_to_y = gpc_get_string('end_year', $t_bugnote_stats_to_def_y);
77 $f_get_bugnote_stats_button = gpc_get_string('get_bugnote_stats_button', '');
79 <form method="post" action="<?php echo $_SERVER['SCRIPT_NAME'] ?>">
80 <?php # CSRF protection not required here - form does not result in modifications ?>
81 <input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" />
82 <table border=0 class="width100" cellspacing="0">
83 <tr>
84 <td class="form-title" colspan="4">
85 <?php
86 collapse_icon( 'bugnotestats' );
87 echo lang_get( 'time_tracking' ) ?>
88 </td>
89 </tr>
90 <tr class="row-2">
91 <td class="category" width="25%">
92 <?php
93 $t_filter = array();
94 $t_filter['do_filter_by_date'] = 'on';
95 $t_filter['start_day'] = $t_bugnote_stats_from_d;
96 $t_filter['start_month'] = $t_bugnote_stats_from_m;
97 $t_filter['start_year'] = $t_bugnote_stats_from_y;
98 $t_filter['end_day'] = $t_bugnote_stats_to_d;
99 $t_filter['end_month'] = $t_bugnote_stats_to_m;
100 $t_filter['end_year'] = $t_bugnote_stats_to_y;
101 print_filter_do_filter_by_date(true);
103 </td>
104 </tr>
105 <tr>
106 <td class="center" colspan="2">
107 <input type="submit" class="button" name="get_bugnote_stats_button" value="<?php echo lang_get( 'time_tracking_get_info_button' ) ?>" />
108 </td>
109 </tr>
111 </table>
112 </form>
113 <?php
114 if ( !is_blank( $f_get_bugnote_stats_button ) ) {
115 $t_from = "$t_bugnote_stats_from_y-$t_bugnote_stats_from_m-$t_bugnote_stats_from_d";
116 $t_to = "$t_bugnote_stats_to_y-$t_bugnote_stats_to_m-$t_bugnote_stats_to_d";
117 $t_bugnote_stats = bugnote_stats_get_events_array( $f_bug_id, $t_from, $t_to );
119 <br />
120 <table border=0 class="width100" cellspacing="0">
121 <tr class="row-category-history">
122 <td class="small-caption">
123 <?php echo lang_get( 'username' ) ?>
124 </td>
125 <td class="small-caption">
126 <?php echo lang_get( 'time_tracking' ) ?>
127 </td>
128 </tr>
129 <?php
130 $t_sum_in_minutes = 0;
131 foreach ( $t_bugnote_stats as $t_item ) {
132 $t_sum_in_minutes += $t_item['sum_time_tracking'];
133 $t_item['sum_time_tracking'] = db_minutes_to_hhmm ( $t_item['sum_time_tracking'] );
136 <tr <?php echo helper_alternate_class() ?>>
137 <td class="small-caption">
138 <?php echo $t_item['username'] ?>
139 </td>
140 <td class="small-caption">
141 <?php echo $t_item['sum_time_tracking'] ?>
142 </td>
143 </tr>
144 <?php } # end for loop ?>
145 <tr <?php echo helper_alternate_class() ?>>
146 <td class="small-caption">
147 <?php echo lang_get( 'total_time' ) ?>
148 </td>
149 <td class="small-caption">
150 <?php echo db_minutes_to_hhmm ( $t_sum_in_minutes ) ?>
151 </td>
152 </tr>
153 </table>
154 <?php
155 } # end if
157 collapse_closed( 'bugnotestats' );
159 <table class="width100" cellspacing="0">
160 <tr>
161 <td class="form-title" colspan="4">
162 <?php
163 collapse_icon( 'bugnotestats' );
164 echo lang_get( 'time_tracking' ) ?>
165 </td>
166 </tr>
167 </table>
168 <?php
169 collapse_end( 'bugnotestats' );