Commit | Line | Data |
---|---|---|
e3599ddc PM |
1 | <?PHP |
2 | include_once('security.php'); | |
3d88cafe PM |
3 | include_once('/var/www/secure.php'); //outside webserver |
4 | if (isset($_GET['override'])){ | |
5 | $id = $_GET['override']; | |
6 | $petition->query("update signatures set signature_status = 'verified' where id = '$id' "); | |
7 | header('Location: report.php'); | |
8 | } | |
9 | if (isset($_GET['delete'])){ | |
10 | $id = $_GET['delete']; | |
11 | $petition->query("update signatures set signature_status = 'deleted' where id = '$id' "); | |
12 | header('Location: report.php'); | |
13 | } | |
dddebd21 PM |
14 | if (isset($_GET['review'])){ |
15 | $id = $_GET['review']; | |
16 | $petition->query("update signatures set signature_status = 'review_requested' where id = '$id' "); | |
17 | header('Location: report.php'); | |
18 | } | |
e3599ddc | 19 | include_once('header.php'); |
9970efb3 | 20 | slack_general('ADMIN: Reports Loaded ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition'); |
f1f9b284 | 21 | $group_id = $_COOKIE['group_id']; |
6865119a | 22 | $javascript=''; |
3f627365 PM |
23 | ?> |
24 | <script> | |
25 | function checkAll(formname, checktoggle) | |
26 | { | |
27 | var checkboxes = new Array(); | |
28 | checkboxes = document[formname].getElementsByTagName('input'); | |
29 | ||
30 | for (var i=0; i<checkboxes.length; i++) { | |
31 | if (checkboxes[i].type == 'checkbox') { | |
32 | checkboxes[i].checked = checktoggle; | |
33 | } | |
34 | } | |
35 | } | |
36 | </script> | |
a8545882 PM |
37 | <style> |
38 | body { background-color:lightgrey; } | |
3f6d2be7 PM |
39 | fieldset{ border: solid 1px lightblue; background-color:white; margin:10px; padding:10px; } |
40 | legend{ border: solid 1px blue; background-color:white; margin:10px; padding:10px; } | |
ecd65c5a | 41 | td{ white-space: pre; } |
a8545882 | 42 | </style> |
fbdd1785 PM |
43 | <?PHP |
44 | if($_COOKIE['level'] == 'admin'){ | |
78dc9b02 | 45 | $q="SELECT * FROM petitions where admin_status = 'approved' order by admin_sort DESC "; |
fbdd1785 PM |
46 | }else{ |
47 | $q="SELECT * FROM petitions where group_id = '$group_id' and admin_status = 'approved'"; | |
48 | } | |
7daacef3 | 49 | //echo "<li>$q</li>"; |
fbdd1785 PM |
50 | $r = $petition->query($q); |
51 | while($d = mysqli_fetch_array($r)){ | |
7ff158cf | 52 | $pID = $d['petition_id']; |
daead987 | 53 | echo "<div id=\"chartContainer$pID\" style=\"height: 400px; width: 100%; margin: 0px auto;\"></div>"; |
fbdd1785 PM |
54 | $chart=''; |
55 | $chart2=''; | |
5c5f8cd7 | 56 | $chart3=''; |
74236c17 | 57 | $q3 = "SELECT just_date FROM signatures where petition_id = '$pID' and just_date <> '0000-00-00' group by just_date"; |
0dd72a90 | 58 | //echo "<li>$q3</li>"; |
33bfb36c | 59 | $r3 = $petition->query($q3); |
fbdd1785 | 60 | $total=0; |
dec234c2 PM |
61 | $goal = $d['signature_goal']; |
62 | if ($goal == 0){ | |
63 | $goal = 10000; | |
64 | } | |
74236c17 | 65 | while ($d3 = mysqli_fetch_array($r3)){ |
978b4a40 PM |
66 | $just_date = $d3['just_date']; |
67 | $q2 = "SELECT * FROM signatures where petition_id = '$pID' and just_date = '$just_date' and signature_status = 'verified' "; | |
0dd72a90 | 68 | //echo "<li>$q2</li>"; |
33bfb36c | 69 | $r2 = $petition->query($q2); |
fbdd1785 | 70 | $count = mysqli_num_rows($r2); |
be6173ff | 71 | $chart .= '{ label: "'.$just_date.'", y: '.intval($count).' }, '; |
fbdd1785 | 72 | $total = $total + intval($count); |
be6173ff | 73 | $chart2 .= '{ label: "'.$just_date.'", y: '.intval($total).' }, '; |
dec234c2 PM |
74 | $goal = $goal - intval($count); |
75 | $chart3 .= '{ label: "'.$just_date.'", y: '.intval($goal).' }, '; | |
fbdd1785 PM |
76 | } |
77 | $chart = rtrim(trim($chart), ","); | |
78 | $chart2 = rtrim(trim($chart2), ","); | |
dec234c2 | 79 | $chart3 = rtrim(trim($chart3), ","); |
978b4a40 | 80 | |
fbdd1785 | 81 | ob_start(); ?> |
978b4a40 PM |
82 | |
83 | var chart<?PHP echo $pID;?> = new CanvasJS.Chart("chartContainer<?PHP echo $pID;?>", { | |
fbdd1785 PM |
84 | theme:"light2", |
85 | animationEnabled: true, | |
86 | exportEnabled: true, | |
87 | title:{ | |
88 | text: "<?PHP echo $d['petition_name'];?> MD-Petition.com Signature Tracker" | |
89 | }, | |
90 | axisY :{ | |
91 | includeZero: false, | |
92 | title: "Number of Signatures", | |
93 | suffix: "", | |
94 | scaleBreaks: { | |
95 | autoCalculate: true | |
96 | } | |
97 | }, | |
98 | toolTip: { | |
99 | shared: "true" | |
100 | }, | |
101 | legend:{ | |
102 | cursor:"pointer", | |
103 | itemclick : toggleDataSeries | |
104 | }, | |
105 | data: [{ | |
91eeb77b | 106 | type: "line", |
fbdd1785 PM |
107 | visible: true, |
108 | showInLegend: true, | |
109 | yValueFormatString: "#####", | |
dec234c2 | 110 | name: "Total Signatures Count", |
fbdd1785 PM |
111 | dataPoints: [ |
112 | <?PHP echo $chart2; ?> | |
113 | ] | |
6c5eed80 | 114 | },<?PHP if(1 == 2){ ?>{ |
91eeb77b | 115 | type: "line", |
dec234c2 PM |
116 | visible: true, |
117 | showInLegend: true, | |
118 | yValueFormatString: "#####", | |
119 | name: "Signatures Remaining to Goal", | |
120 | dataPoints: [ | |
121 | <?PHP echo $chart3; ?> | |
122 | ] | |
7b3ddaef | 123 | },<?PHP } ?>{ |
2e96f88a | 124 | type: "column", |
fbdd1785 PM |
125 | visible: true, |
126 | showInLegend: true, | |
127 | yValueFormatString: "#####", | |
dec234c2 | 128 | name: "New Daily Signatures", |
fbdd1785 PM |
129 | dataPoints: [ |
130 | <?PHP echo $chart; ?> | |
131 | ] | |
132 | }] | |
133 | } | |
134 | ||
135 | ||
136 | ); | |
978b4a40 | 137 | chart<?PHP echo $pID;?>.render(); |
fbdd1785 PM |
138 | |
139 | <?PHP $javascript .= ob_get_clean(); | |
140 | } | |
141 | ?> | |
142 | ||
143 | ||
144 | ||
145 | ||
146 | ||
147 | ||
148 | ||
149 | ||
150 | ||
151 | ||
152 | ||
153 | ||
154 | ||
155 | ||
6865119a | 156 | |
79f261d4 | 157 | <form id='form3' name='form3' method='POST' action='printer.php'> |
3f627365 | 158 | <?PHP |
214e6829 | 159 | if($_COOKIE['level'] == 'admin'){ |
feef9b7e | 160 | $q="SELECT * FROM petitions where admin_status = 'approved' "; |
214e6829 | 161 | }else{ |
feef9b7e | 162 | $q="SELECT * FROM petitions where group_id = '$group_id' and admin_status = 'approved'"; |
80b72550 PM |
163 | } |
164 | $r = $petition->query($q); | |
165 | while($d = mysqli_fetch_array($r)){ | |
6b1f3680 | 166 | echo "<fieldset style='background-color:$d[web_color];'><legend style='background-color:white;'>$d[petition_name] - Unprinted</legend> |
9a5ee71a PM |
167 | <a onclick=\"javascript:checkAll('form3', true);\" href=\"javascript:void();\">Check All</a> |
168 | <a onclick=\"javascript:checkAll('form3', false);\" href=\"javascript:void();\">Uncheck All</a> | |
169 | <input type='submit' value='PRINT'>"; | |
80b72550 PM |
170 | echo "<table border='1' cellpadding='0' cellspacing='5'>"; |
171 | unset($hide); | |
172 | $hide = array(); | |
173 | $pID = $d['petition_id']; | |
5a5d6cfb | 174 | $q2="SELECT * FROM signatures where petition_id = '$pID' and printed_status = '' and signature_status = 'verified' order by signature_status, id desc"; |
80b72550 PM |
175 | $r2 = $petition->query($q2); |
176 | while($d2 = mysqli_fetch_array($r2)){ | |
6a911fb1 | 177 | if ($d2['signature_status'] == 'verified'){ |
1d464bd9 | 178 | $id = $d2['id']; |
d2f3ba75 | 179 | echo "<tr> |
1d464bd9 | 180 | <td><input type='checkbox' name='print[".$id."]'></td><td>$d2[ip_address]</td><td>$d2[date_time_signed]</td><td>$d2[signed_name_as]</td><td>$d2[signed_name_as_circulator]</td><td>$d2[contact_phone]</td><td>$d2[signature_status]-<a href='?review=$d2[id]'>Flag for Review</a></td><td>$d2[printed_status]</td></tr>"; |
8452f380 | 181 | }else{ |
d2f3ba75 PM |
182 | echo "<tr> |
183 | <td><a href='?override=$d2[id]'>Override</a> or <a href='?delete=$d2[id]'>Delete</a></td><td>$d2[ip_address]</td><td>$d2[date_time_signed]</td><td>$d2[signed_name_as]</td><td>$d2[signed_name_as_circulator]</td><td>$d2[contact_phone]</td><td>$d2[signature_status]</td><td>$d2[printed_status]</td></tr>"; | |
8452f380 | 184 | } |
80b72550 | 185 | } |
22e166b5 | 186 | echo '</table></fieldset>'; |
fbdd1785 | 187 | |
6865119a PM |
188 | |
189 | ||
190 | } | |
191 | ?> | |
192 | </form> | |
193 | ||
5a5d6cfb | 194 | |
f757cf9a | 195 | <?PHP if($_COOKIE['level'] == 'admin'){ ?> |
5a5d6cfb PM |
196 | |
197 | <form id='form5' name='form5' method='POST' action='printer.php'> | |
198 | <?PHP | |
199 | if($_COOKIE['level'] == 'admin'){ | |
200 | $q="SELECT * FROM petitions where admin_status = 'approved' "; | |
201 | }else{ | |
202 | $q="SELECT * FROM petitions where group_id = '$group_id' and admin_status = 'approved'"; | |
203 | } | |
204 | $r = $petition->query($q); | |
205 | while($d = mysqli_fetch_array($r)){ | |
206 | echo "<fieldset style='background-color:$d[web_color];'><legend style='background-color:white;'>$d[petition_name] - Flagged for Deletion or Override</legend> | |
207 | <a onclick=\"javascript:checkAll('form3', true);\" href=\"javascript:void();\">Check All</a> | |
208 | <a onclick=\"javascript:checkAll('form3', false);\" href=\"javascript:void();\">Uncheck All</a> | |
209 | <input type='submit' value='PRINT'>"; | |
210 | echo "<table border='1' cellpadding='0' cellspacing='5'>"; | |
211 | unset($hide); | |
212 | $hide = array(); | |
213 | $pID = $d['petition_id']; | |
214 | $q2="SELECT * FROM signatures where petition_id = '$pID' and printed_status = '' and signature_status <> 'deleted' and signature_status <> 'verified' order by signature_status, id desc"; | |
215 | $r2 = $petition->query($q2); | |
216 | while($d2 = mysqli_fetch_array($r2)){ | |
217 | if ($d2['signature_status'] == 'verified'){ | |
218 | echo "<tr> | |
219 | <td><input type='checkbox' name='print[".$d2[id]."]'></td><td>$d2[ip_address]</td><td>$d2[date_time_signed]</td><td>$d2[signed_name_as]</td><td>$d2[signed_name_as_circulator]</td><td>$d2[contact_phone]</td><td>$d2[signature_status]-<a href='?review=$d2[id]'>Flag for Review</a></td><td>$d2[printed_status]</td></tr>"; | |
220 | }else{ | |
221 | echo "<tr> | |
222 | <td><a href='?override=$d2[id]'>Override</a> or <a href='?delete=$d2[id]'>Delete</a></td><td>$d2[ip_address]</td><td>$d2[date_time_signed]</td><td>$d2[signed_name_as]</td><td>$d2[signed_name_as_circulator]</td><td>$d2[contact_phone]</td><td>$d2[signature_status]</td><td>$d2[printed_status]</td></tr>"; | |
223 | } | |
224 | } | |
225 | echo '</table></fieldset>'; | |
226 | ||
227 | ||
228 | ||
229 | } | |
230 | ?> | |
231 | </form> | |
232 | ||
f757cf9a | 233 | <?PHP } ?> |
5a5d6cfb PM |
234 | |
235 | ||
6865119a PM |
236 | <form id='form2' name='form2' method='POST' action='printer.php'> |
237 | ||
238 | <?PHP | |
239 | if($_COOKIE['level'] == 'admin'){ | |
240 | $q="SELECT * FROM petitions where admin_status = 'approved' "; | |
241 | }else{ | |
242 | $q="SELECT * FROM petitions where group_id = '$group_id' and admin_status = 'approved' "; | |
243 | } | |
244 | $r = $petition->query($q); | |
245 | while($d = mysqli_fetch_array($r)){ | |
246 | echo "<fieldset style='background-color:$d[web_color];'><legend style='background-color:white;'>$d[petition_name] - Printed</legend> | |
247 | <a onclick=\"javascript:checkAll('form2', true);\" href=\"javascript:void();\">Check All</a> | |
248 | <a onclick=\"javascript:checkAll('form2', false);\" href=\"javascript:void();\">Uncheck All</a> | |
249 | <input type='submit' value='PRINT'>"; | |
250 | echo "<table border='1' cellpadding='0' cellspacing='5'>"; | |
251 | unset($hide); | |
252 | $hide = array(); | |
253 | $pID = $d['petition_id']; | |
254 | $q2="SELECT * FROM signatures where petition_id = '$pID' and printed_status <> '' and signature_status <> 'deleted' order by signature_status, id desc"; | |
255 | $r2 = $petition->query($q2); | |
256 | while($d2 = mysqli_fetch_array($r2)){ | |
257 | if ($d2['signature_status'] == 'verified'){ | |
258 | echo "<tr><td><input type='checkbox' name='print[".$d2[id]."]'></td><td>$d2[ip_address]</td><td>$d2[date_time_signed]</td><td>$d2[signed_name_as]</td><td>$d2[signed_name_as_circulator]</td><td>$d2[contact_phone]</td><td>$d2[signature_status]-<a href='?review=$d2[id]'>Flag for Review</a></td><td>$d2[printed_status]</td></tr>"; | |
259 | }else{ | |
260 | echo "<tr><td><a href='?override=$d2[id]'>Override</a> or <a href='?delete=$d2[id]'>Delete</a></td><td>$d2[ip_address]</td><td>$d2[date_time_signed]</td><td>$d2[signed_name_as]</td><td>$d2[signed_name_as_circulator]</td><td>$d2[contact_phone]</td><td>$d2[signature_status]</td><td>$d2[printed_status]</td></tr>"; | |
261 | } | |
262 | } | |
263 | echo '</table></fieldset>'; | |
264 | ||
265 | ||
266 | } | |
267 | ?> | |
268 | </form> | |
269 | ||
270 | ||
271 | ||
272 | ||
273 | ||
274 | <script> | |
275 | window.onload = function () { | |
276 | ||
277 | <?PHP echo $javascript;?> | |
ddec0164 PM |
278 | |
279 | function toggleDataSeries(e) { | |
280 | if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible ){ | |
281 | e.dataSeries.visible = false; | |
282 | } else { | |
283 | e.dataSeries.visible = true; | |
284 | } | |
285 | chart.render(); | |
286 | } | |
287 | ||
288 | } | |
289 | </script> | |
290 | ||
291 | ||
292 | ||
6865119a | 293 | <script src="../files/canvasjs.min.js"></script> |
3f627365 | 294 | <?PHP |
e3599ddc PM |
295 | include_once('footer.php'); |
296 | ?> |