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 * Display summary page of Statistics
19 *
20 * @package MantisBT
21 * @copyright Copyright 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
22 * @copyright Copyright 2002  MantisBT Team - mantisbt-dev@lists.sourceforge.net
23 * @link http://www.mantisbt.org
24 *
25 * @uses core.php
26 * @uses access_api.php
27 * @uses authentication_api.php
28 * @uses config_api.php
29 * @uses constant_inc.php
30 * @uses database_api.php
31 * @uses gpc_api.php
32 * @uses helper_api.php
33 * @uses html_api.php
34 * @uses lang_api.php
35 * @uses print_api.php
36 * @uses summary_api.php
37 * @uses user_api.php
38 */
39
40require_once( 'core.php' );
41require_api( 'access_api.php' );
42require_api( 'authentication_api.php' );
43require_api( 'config_api.php' );
44require_api( 'constant_inc.php' );
45require_api( 'database_api.php' );
46require_api( 'gpc_api.php' );
47require_api( 'helper_api.php' );
48require_api( 'html_api.php' );
49require_api( 'lang_api.php' );
50require_api( 'print_api.php' );
51require_api( 'summary_api.php' );
52require_api( 'user_api.php' );
53
54$f_project_id = gpc_get_int( 'project_id', helper_get_current_project() );
55
56# Override the current page to make sure we get the appropriate project-specific configuration
57$g_project_override = $f_project_id;
58
59access_ensure_project_level( config_get( 'view_summary_threshold' ) );
60
61$t_filter = summary_get_filter();
62
63$t_time_stats = summary_helper_get_time_stats( $f_project_id, $t_filter );
64
65$t_summary_header_arr = explode( '/', lang_get( 'summary_header' ) );
66
67$t_summary_header = '';
68foreach ( $t_summary_header_arr as $t_summary_header_name ) {
69	$t_summary_header .= '<th class="align-right">';
70	$t_summary_header .= $t_summary_header_name;
71	$t_summary_header .= '</th>';
72}
73
74layout_page_header( lang_get( 'summary_link' ) );
75
76layout_page_begin( __FILE__ );
77
78print_summary_menu( 'summary_page.php', $t_filter );
79print_summary_submenu();
80?>
81
82<div class="col-md-12 col-xs-12">
83<div class="space-10"></div>
84
85<div class="widget-box widget-color-blue2">
86<div class="widget-header widget-header-small">
87	<h4 class="widget-title lighter">
88		<?php print_icon( 'fa-bar-chart-o', 'ace-icon' ); ?>
89		<?php echo lang_get('summary_title') ?>
90	</h4>
91</div>
92
93<div class="widget-body">
94<div class="widget-main no-padding">
95
96
97<!-- LEFT COLUMN -->
98<div class="col-md-6 col-xs-12">
99
100	<!-- BY PROJECT -->
101	<div class="space-10"></div>
102	<div class="widget-box table-responsive">
103		<table class="table table-hover table-bordered table-condensed table-striped">
104		<thead>
105			<tr>
106				<th class="width-35"><?php echo lang_get( 'by_project' ) ?></th>
107				<?php echo $t_summary_header ?>
108			</tr>
109		</thead>
110		<?php summary_print_by_project( array(), null, null, $t_filter ); ?>
111	</table>
112	</div>
113
114	<!-- BY STATUS -->
115	<div class="space-10"></div>
116	<div class="widget-box table-responsive">
117		<table class="table table-hover table-bordered table-condensed table-striped">
118		<thead>
119			<tr>
120				<th class="width-35"><?php echo lang_get( 'by_status' ) ?></th>
121				<?php echo $t_summary_header ?>
122			</tr>
123		</thead>
124		<?php summary_print_by_enum( 'status', $t_filter ) ?>
125	</table>
126	</div>
127
128	<!-- BY SEVERITY -->
129	<div class="space-10"></div>
130	<div class="widget-box table-responsive">
131		<table class="table table-hover table-bordered table-condensed table-striped">
132		<thead>
133			<tr>
134				<th class="width-35"><?php echo lang_get( 'by_severity' ) ?></th>
135				<?php echo $t_summary_header ?>
136			</tr>
137		</thead>
138		<?php summary_print_by_enum( 'severity', $t_filter ) ?>
139	</table>
140	</div>
141
142	<!-- BY CATEGORY -->
143	<div class="space-10"></div>
144	<div class="widget-box table-responsive">
145		<table class="table table-hover table-bordered table-condensed table-striped">
146		<thead>
147			<tr>
148				<th class="width-35"><?php echo lang_get( 'by_category' ) ?></th>
149				<?php echo $t_summary_header ?>
150			</tr>
151		</thead>
152		<?php summary_print_by_category( $t_filter ) ?>
153	</table>
154	</div>
155
156	<!-- TIME STATS -->
157	<div class="space-10"></div>
158	<div class="widget-box table-responsive">
159		<table class="table table-hover table-bordered table-condensed table-striped">
160		<thead>
161			<tr>
162				<th colspan="2"><?php echo lang_get( 'time_stats' ) ?></th>
163			</tr>
164		</thead>
165		<tr>
166			<td><?php echo lang_get( 'longest_open_bug' ) ?></td>
167			<td class="align-right"><?php
168				if( $t_time_stats['bug_id'] > 0 )  {
169					print_bug_link( $t_time_stats['bug_id'] );
170				}
171			?></td>
172		</tr>
173		<tr>
174			<td><?php echo lang_get( 'longest_open' ) ?></td>
175			<td class="align-right"><?php echo $t_time_stats['largest_diff'] ?></td>
176		</tr>
177		<tr>
178			<td><?php echo lang_get( 'average_time' ) ?></td>
179			<td class="align-right"><?php echo $t_time_stats['average_time'] ?></td>
180		</tr>
181		<tr>
182			<td><?php echo lang_get( 'total_time' ) ?></td>
183			<td class="align-right"><?php echo $t_time_stats['total_time'] ?></td>
184		</tr>
185	</table>
186	</div>
187
188	<!-- DEVELOPER STATS -->
189	<div class="space-10"></div>
190	<div class="widget-box table-responsive">
191		<table class="table table-hover table-bordered table-condensed table-striped">
192		<thead>
193			<tr>
194				<th><?php echo lang_get( 'developer_stats' ) ?></th>
195				<?php echo $t_summary_header ?>
196			</tr>
197		</thead>
198		<?php summary_print_by_developer( $t_filter ) ?>
199	</table>
200</div>
201</div>
202
203<!-- RIGHT COLUMN -->
204<div class="col-md-6 col-xs-12">
205
206	<!-- BY DATE -->
207	<div class="space-10"></div>
208	<div class="widget-box table-responsive">
209		<table class="table table-hover table-bordered table-condensed table-striped">
210		<thead>
211			<tr>
212				<th class="width-35"><?php echo lang_get( 'by_date' ) ?></th>
213				<th class="align-right"><?php echo lang_get( 'opened' ); ?></th>
214				<th class="align-right"><?php echo lang_get( 'resolved' ); ?></th>
215				<th class="align-right"><?php echo lang_get( 'balance' ); ?></th>
216			</tr>
217		</thead>
218		<?php summary_print_by_date( config_get( 'date_partitions' ), $t_filter ) ?>
219	</table>
220	</div>
221
222	<!-- MOST ACTIVE -->
223	<div class="space-10"></div>
224	<div class="widget-box table-responsive">
225		<table class="table table-hover table-bordered table-condensed table-striped">
226		<thead>
227			<tr>
228				<th class="width-85"><?php echo lang_get( 'most_active' ) ?></th>
229				<th class="align-right"><?php echo lang_get( 'score' ); ?></th>
230			</tr>
231		</thead>
232		<?php summary_print_by_activity( $t_filter ) ?>
233	</table>
234	</div>
235
236	<!-- LONGEST OPEN -->
237	<div class="space-10"></div>
238	<div class="widget-box table-responsive">
239		<table class="table table-hover table-bordered table-condensed table-striped">
240		<thead>
241			<tr>
242				<th class="width-85"><?php echo lang_get( 'longest_open' ) ?></th>
243				<th class="align-right"><?php echo lang_get( 'days' ); ?></th>
244			</tr>
245		</thead>
246		<?php summary_print_by_age( $t_filter ) ?>
247	</table>
248	</div>
249
250	<!-- BY RESOLUTION -->
251	<div class="space-10"></div>
252	<div class="widget-box table-responsive">
253		<table class="table table-hover table-bordered table-condensed table-striped">
254		<thead>
255			<tr>
256				<th class="width-35"><?php echo lang_get( 'by_resolution' ) ?></th>
257				<?php echo $t_summary_header ?>
258			</tr>
259		</thead>
260		<?php summary_print_by_enum( 'resolution', $t_filter ) ?>
261	</table>
262	</div>
263
264	<!-- BY PRIORITY -->
265	<div class="space-10"></div>
266	<div class="widget-box table-responsive">
267		<table class="table table-hover table-bordered table-condensed table-striped">
268		<thead>
269			<tr>
270				<th class="width-35"><?php echo lang_get( 'by_priority' ) ?></th>
271				<?php echo $t_summary_header ?>
272			</tr>
273		</thead>
274		<?php summary_print_by_enum( 'priority', $t_filter ) ?>
275	</table>
276	</div>
277
278	<!-- REPORTER STATS -->
279	<div class="space-10"></div>
280	<div class="widget-box table-responsive">
281		<table class="table table-hover table-bordered table-condensed table-striped">
282		<thead>
283			<tr>
284				<th class="width-35"><?php echo lang_get( 'reporter_stats' ) ?></th>
285				<?php echo $t_summary_header ?>
286			</tr>
287		</thead>
288		<?php summary_print_by_reporter( $t_filter ) ?>
289	</table>
290	</div>
291
292	<!-- REPORTER EFFECTIVENESS -->
293	<div class="space-10"></div>
294	<div class="widget-box table-responsive">
295		<table class="table table-hover table-bordered table-condensed table-striped">
296		<thead>
297			<tr>
298				<th class="width-35"><?php echo lang_get( 'reporter_effectiveness' ) ?></th>
299				<th class="align-right"><?php echo lang_get( 'severity' ); ?></th>
300				<th class="align-right"><?php echo lang_get( 'errors' ); ?></th>
301				<th class="align-right"><?php echo lang_get( 'total' ); ?></th>
302			</tr>
303		</thead>
304		<?php summary_print_reporter_effectiveness( config_get( 'severity_enum_string' ), config_get( 'resolution_enum_string' ), $t_filter ) ?>
305	</table>
306	</div>
307
308</div>
309
310<!-- BOTTOM -->
311<div class="col-md-12 col-xs-12">
312
313	<!-- REPORTER BY RESOLUTION -->
314	<div class="space-10"></div>
315	<div class="widget-box table-responsive">
316		<table class="table table-hover table-bordered table-condensed table-striped">
317		<thead>
318			<tr>
319				<th class="width-15"><?php echo lang_get( 'reporter_by_resolution' ) ?></th>
320				<?php
321					$t_resolutions = MantisEnum::getValues( config_get( 'resolution_enum_string' ) );
322
323					foreach ( $t_resolutions as $t_resolution ) {
324						echo '<th class="align-right">', get_enum_element( 'resolution', $t_resolution ), "</th>\n";
325					}
326
327					echo '<th class="align-right">', lang_get( 'total' ), "</th>\n";
328					echo '<th class="align-right">', lang_get( 'percentage_errors' ), "</th>\n";
329				?>
330			</tr>
331		</thead>
332		<?php summary_print_reporter_resolution( config_get( 'resolution_enum_string' ), $t_filter ) ?>
333	</table>
334	</div>
335
336	<!-- DEVELOPER BY RESOLUTION -->
337	<div class="space-10"></div>
338	<div class="widget-box table-responsive">
339		<table class="table table-hover table-bordered table-condensed table-striped">
340		<thead>
341			<tr>
342				<th class="width-15"><?php echo lang_get( 'developer_by_resolution' ) ?></th>
343				<?php
344					$t_resolutions = MantisEnum::getValues( config_get( 'resolution_enum_string' ) );
345
346					foreach ( $t_resolutions as $t_resolution ) {
347						echo '<th class="align-right">', get_enum_element( 'resolution', $t_resolution ), "</th>\n";
348					}
349
350					echo '<th class="align-right">', lang_get( 'total' ), "</th>\n";
351					echo '<th class="align-right">', lang_get( 'percentage_fixed' ), "</th>\n";
352				?>
353			</tr>
354		</thead>
355		<?php summary_print_developer_resolution( config_get( 'resolution_enum_string' ), $t_filter ) ?>
356	</table>
357	</div>
358
359</div>
360
361</div>
362</div>
363<div class="clearfix"></div>
364<div class="space-10"></div>
365</div>
366</div>
367
368<?php
369layout_page_end();
370