-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_reports.php
220 lines (215 loc) · 6.54 KB
/
custom_reports.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php
/**
* PEP Capping 2017 Algozzine's Class
*
* Allows users to create a custom report.
*
* This allows users to specify what information they would
* like to see in a custom report.
* The 'Generate Report' button will kick off a custom query
* to the database and display the results in a new page
* (defined in 'custom_reports_table.php')
*
* @author Daniel Ahl
* Rafael Mormol
* @copyright 2017 Marist College
* @version 0.3
* @since 0.1.4
*/
include('header.php');
?>
<div class="container py-5">
<div class="col-auto" >
<form action="custom-reports-table" method="POST" autocomplete="on">
<fieldset>
<!-- Select Basic -->
<div class="form-group row">
<label class="col-md-2 col-form-label" for="month"><b>Month</b></label>
<div class="col-md-4">
<select id="month" name="month" class="form-control">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
</div>
</div>
<!-- Select Basic -->
<div class="form-group row">
<label class="col-md-2 col-form-label" for="year"><b>Year</b></label>
<div class="col-md-4">
<select id="year" name="year" class="form-control">
<!-- YEAR OPTIONS INIT IN JAVASCRIPT BELOW.
BASED ON CURRENT YEAR.-->
</select>
</div>
</div>
<!-- Multiple Checkboxes -->
<div class="form-group row">
<label class="col-md-2 col-form-label" for="location[]"><b>Location</b></label>
<div class="col-md-4">
<div class="checkbox">
<label for="location-0">
<input type="checkbox" name="location[]" id="location-0" value="Cornerstone">
Cornerstone
</label>
</div>
<div class="checkbox">
<label for="location-1">
<input type="checkbox" name="location[]" id="location-1" value="Dutchess County Jail">
Dutchess County Jail
</label>
</div>
<div class="checkbox">
<label for="location-2">
<input type="checkbox" name="location[]" id="location-2" value="Florence Manor">
Florence Manor
</label>
</div>
<div class="checkbox">
<label for="location-3">
<input type="checkbox" name="location[]" id="location-3" value="Fox Run">
Fox Run
</label>
</div>
<div class="checkbox">
<label for="location-4">
<input type="checkbox" name="location[]" id="location-4" value="ITAP Meadow Run">
ITAP Meadow Run
</label>
</div>
</div>
</div>
<!-- Multiple Checkboxes -->
<div class="form-group row">
<label class="col-md-2 col-form-label" for="race[]"><b>Race</b></label>
<div class="col-md-4">
<div class="checkbox">
<label for="race-0">
<input type="checkbox" name="race[]" id="race-0" value="Caucasian">
Caucasian
</label>
</div>
<div class="checkbox">
<label for="race-1">
<input type="checkbox" name="race[]" id="race-1" value="African American">
African American
</label>
</div>
<div class="checkbox">
<label for="race-2">
<input type="checkbox" name="race[]" id="race-2" value="Multi Racial">
Multi Racial
</label>
</div>
<div class="checkbox">
<label for="race-3">
<input type="checkbox" name="race[]" id="race-3" value="Latino">
Latino
</label>
</div>
<div class="checkbox">
<label for="race-4">
<input type="checkbox" name="race[]" id="race-4" value="Pacific Islander">
Pacific Islander
</label>
</div>
<div class="checkbox">
<label for="race-5">
<input type="checkbox" name="race[]" id="race-5" value="Native American">
Native American
</label>
</div>
<div class="checkbox">
<label for="race-6">
<input type="checkbox" name="race[]" id="race-6" value="Other">
Other
</label>
</div>
</div>
</div>
<!-- Multiple Checkboxes -->
<div class="form-group row">
<label class="col-md-2 col-form-label"><b>Age</b></label>
<div class="col-md-5">
<div class="row">
<div class="col-md-5">
<select id="minAge" name="minAge" class="form-control" onchange="minAgeChange()">
<option value="any">Any</option>
<?php
for ($i = 65; $i >= 18; $i--) {
echo "<option value='$i'>$i</option>";
}
?>
</select>
</div>
<div class="col-md-1" align="center">To</div>
<div class="col-md-5">
<select id="maxAge" name="maxAge" class="form-control" onchange="maxAgeChange()">
<option value="any">Any</option>
<?php
for ($i = 65; $i >= 18; $i--) {
echo "<option value='$i'>$i</option>";
}
?>
</select>
</div>
</div>
</div>
</div>
<!-- Submit -->
<div class="form-group pt-2">
<div class="col-md-7" align="center">
<button type="submit" class="btn cpca">Generate Report</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
<script>
const NUM_YEARS_BACK = 4;
window.onload = initPage;
function initPage() {
var d = new Date();
var monthElem = document.getElementById("month");
monthElem.selectedIndex = d.getMonth();
var yearElem = document.getElementById("year");
var year = d.getFullYear();
for (i = 0; i <= NUM_YEARS_BACK; i++) {
var opt = document.createElement('option');
opt.value = year - i;
opt.innerHTML = year - i;
yearElem.appendChild(opt);
}
}
function minAgeChange() {
var minIndex = document.getElementById("minAge").selectedIndex;
var maxList = document.getElementById("maxAge").options;
if (minIndex === 0) {
for (i = 1; i < maxList.length; i++) {
maxList[i].disabled = false;
}
} else {
for (i = 1; i < maxList.length; i++) {
maxList[i].disabled = i > minIndex;
}
}
}
function maxAgeChange() {
var maxIndex = document.getElementById("maxAge").selectedIndex;
var minList = document.getElementById("minAge").options;
for (i = 1; i < minList.length; i++) {
minList[i].disabled = i < maxIndex;
}
}
</script>
<?php include('footer.php'); ?>