/
issues_trend_page.php
117 lines (106 loc) · 3.63 KB
/
issues_trend_page.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
# MantisBT - A PHP based bugtracking system
# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
/**
* Generate custom graphs e.g. by status for given date range
* @package MantisBT
* @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
* @uses core.php
* @uses Period.php
* @uses access_api.php
* @uses config_api.php
* @uses gpc_api.php
* @uses html_api.php
* @uses plugin_api.php
*/
require_once( 'core.php' );
plugin_require_api( 'core/Period.php' );
require_api( 'access_api.php' );
require_api( 'config_api.php' );
require_api( 'gpc_api.php' );
require_api( 'html_api.php' );
require_api( 'plugin_api.php' );
access_ensure_project_level( config_get( 'view_summary_threshold' ) );
$f_interval = gpc_get_int( 'interval', 0 );
$t_today = date( 'Y-m-d' );
$f_type = gpc_get_int( 'graph_type', 0 );
$f_show_as_table = gpc_get_bool( 'show_table', false );
layout_page_header_begin( plugin_lang_get( 'graph_page' ) );
$t_path = config_get( 'path' );
layout_page_header_end();
layout_page_begin();
$t_period = new Period();
$t_period->set_period_from_selector( 'interval' );
$t_types = array(
1 => plugin_lang_get( 'status_link' ),
2 => plugin_lang_get( 'category_link' ),
);
?>
<div class="col-md-12 col-xs-12">
<div class="space-10"></div>
<form id="graph_form" method="post" action="<?php echo plugin_page( 'issues_trend_page.php' ); ?>" class="form-inline">
<div class="widget-box widget-color-blue2">
<div class="widget-body">
<div class="widget-main no-padding">
<div class="table-responsive">
<table class="table table-condensed">
<tr>
<td class="center">
<div class="form-group">
<?php echo get_dropdown( $t_types, 'graph_type', $f_type ); ?>
</div>
</td>
<td class="center">
<div class="form-group">
<?php echo $t_period->period_selector( 'interval' ); ?>
</div>
</td>
<td class="center">
<div class="form-group">
<input type="submit" class="btn btn-sm btn-primary btn-white btn-round" name="show" value="<?php echo lang_get( 'proceed' ); ?>"/>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</form>
<?php
# build the graphs if both an interval and graph type are selected
if( ( 0 != $f_type ) && ( $f_interval > 0 ) ) {
$f_start = $t_period->get_start_formatted();
$f_end = $t_period->get_end_formatted();
switch( $f_type ) {
case 1:
$t_page_to_include = 'issues_trend_bystatus_table.php';
break;
case 2:
$t_page_to_include = 'issues_trend_bycategory_table.php';
break;
default:
$t_page_to_include = '';
break;
}
if( !is_blank( $t_page_to_include ) ) {
include( config_get_global( 'plugin_path' ) . plugin_get_current() . '/pages/' . $t_page_to_include );
}
}
?>
</div>
<?php
layout_page_end();