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'){ | |
45 | $q="SELECT * FROM petitions where admin_status = 'approved' "; | |
46 | }else{ | |
47 | $q="SELECT * FROM petitions where group_id = '$group_id' and admin_status = 'approved'"; | |
48 | } | |
49 | $r = $petition->query($q); | |
50 | while($d = mysqli_fetch_array($r)){ | |
51 | echo "$d[petition_id] <div id=\"chartContainer$d[petition_id]\" style=\"height: 200px; width: 100%; margin: 0px auto;\"></div>"; | |
52 | $chart=''; | |
53 | $chart2=''; | |
74236c17 PM |
54 | $q3 = "SELECT just_date FROM signatures where petition_id = '$pID' and just_date <> '0000-00-00' group by just_date"; |
55 | $r3 = $core->query($q3); | |
fbdd1785 | 56 | $total=0; |
74236c17 | 57 | while ($d3 = mysqli_fetch_array($r3)){ |
10815476 | 58 | $q2 = "SELECT * FROM signatures where petition_id = '$pID' and just_date = '$d3[just_date]' and signature_status = 'verified' "; |
fbdd1785 PM |
59 | $r2 = $core->query($q2); |
60 | $count = mysqli_num_rows($r2); | |
61 | $chart .= '{ label: "'.$d['just_date'].'", y: '.intval($count).' }, '; | |
62 | $total = $total + intval($count); | |
63 | $chart2 .= '{ label: "'.$d['just_date'].'", y: '.intval($total).' }, '; | |
64 | } | |
65 | $chart = rtrim(trim($chart), ","); | |
66 | $chart2 = rtrim(trim($chart2), ","); | |
67 | ||
68 | ob_start(); ?> | |
69 | var chart<?PHP echo $d['petition_id'];?> = new CanvasJS.Chart("chartContainer<?PHP echo $d['petition_id'];?>", { | |
70 | theme:"light2", | |
71 | animationEnabled: true, | |
72 | exportEnabled: true, | |
73 | title:{ | |
74 | text: "<?PHP echo $d['petition_name'];?> MD-Petition.com Signature Tracker" | |
75 | }, | |
76 | axisY :{ | |
77 | includeZero: false, | |
78 | title: "Number of Signatures", | |
79 | suffix: "", | |
80 | scaleBreaks: { | |
81 | autoCalculate: true | |
82 | } | |
83 | }, | |
84 | toolTip: { | |
85 | shared: "true" | |
86 | }, | |
87 | legend:{ | |
88 | cursor:"pointer", | |
89 | itemclick : toggleDataSeries | |
90 | }, | |
91 | data: [{ | |
92 | type: "spline", | |
93 | visible: true, | |
94 | showInLegend: true, | |
95 | yValueFormatString: "#####", | |
96 | name: "Total Signatures", | |
97 | dataPoints: [ | |
98 | <?PHP echo $chart2; ?> | |
99 | ] | |
100 | },{ | |
2e96f88a | 101 | type: "column", |
fbdd1785 PM |
102 | visible: true, |
103 | showInLegend: true, | |
104 | yValueFormatString: "#####", | |
105 | name: "New Signatures", | |
106 | dataPoints: [ | |
107 | <?PHP echo $chart; ?> | |
108 | ] | |
109 | }] | |
110 | } | |
111 | ||
112 | ||
113 | ); | |
114 | chart<?PHP echo $d['petition_id'];?>.render(); | |
115 | ||
116 | <?PHP $javascript .= ob_get_clean(); | |
117 | } | |
118 | ?> | |
119 | ||
120 | ||
121 | ||
122 | ||
123 | ||
124 | ||
125 | ||
126 | ||
127 | ||
128 | ||
129 | ||
130 | ||
131 | ||
132 | ||
6865119a | 133 | |
79f261d4 | 134 | <form id='form3' name='form3' method='POST' action='printer.php'> |
3f627365 | 135 | <?PHP |
214e6829 | 136 | if($_COOKIE['level'] == 'admin'){ |
feef9b7e | 137 | $q="SELECT * FROM petitions where admin_status = 'approved' "; |
214e6829 | 138 | }else{ |
feef9b7e | 139 | $q="SELECT * FROM petitions where group_id = '$group_id' and admin_status = 'approved'"; |
80b72550 PM |
140 | } |
141 | $r = $petition->query($q); | |
142 | while($d = mysqli_fetch_array($r)){ | |
6b1f3680 | 143 | echo "<fieldset style='background-color:$d[web_color];'><legend style='background-color:white;'>$d[petition_name] - Unprinted</legend> |
9a5ee71a PM |
144 | <a onclick=\"javascript:checkAll('form3', true);\" href=\"javascript:void();\">Check All</a> |
145 | <a onclick=\"javascript:checkAll('form3', false);\" href=\"javascript:void();\">Uncheck All</a> | |
146 | <input type='submit' value='PRINT'>"; | |
80b72550 PM |
147 | echo "<table border='1' cellpadding='0' cellspacing='5'>"; |
148 | unset($hide); | |
149 | $hide = array(); | |
150 | $pID = $d['petition_id']; | |
0c13e2c5 | 151 | $q2="SELECT * FROM signatures where petition_id = '$pID' and printed_status = '' and signature_status <> 'deleted' order by signature_status, id desc"; |
80b72550 PM |
152 | $r2 = $petition->query($q2); |
153 | while($d2 = mysqli_fetch_array($r2)){ | |
6a911fb1 | 154 | if ($d2['signature_status'] == 'verified'){ |
96e91f82 | 155 | 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>"; |
8452f380 PM |
156 | }else{ |
157 | 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>"; | |
158 | } | |
80b72550 | 159 | } |
22e166b5 | 160 | echo '</table></fieldset>'; |
fbdd1785 | 161 | |
6865119a PM |
162 | |
163 | ||
164 | } | |
165 | ?> | |
166 | </form> | |
167 | ||
168 | <form id='form2' name='form2' method='POST' action='printer.php'> | |
169 | ||
170 | <?PHP | |
171 | if($_COOKIE['level'] == 'admin'){ | |
172 | $q="SELECT * FROM petitions where admin_status = 'approved' "; | |
173 | }else{ | |
174 | $q="SELECT * FROM petitions where group_id = '$group_id' and admin_status = 'approved' "; | |
175 | } | |
176 | $r = $petition->query($q); | |
177 | while($d = mysqli_fetch_array($r)){ | |
178 | echo "<fieldset style='background-color:$d[web_color];'><legend style='background-color:white;'>$d[petition_name] - Printed</legend> | |
179 | <a onclick=\"javascript:checkAll('form2', true);\" href=\"javascript:void();\">Check All</a> | |
180 | <a onclick=\"javascript:checkAll('form2', false);\" href=\"javascript:void();\">Uncheck All</a> | |
181 | <input type='submit' value='PRINT'>"; | |
182 | echo "<table border='1' cellpadding='0' cellspacing='5'>"; | |
183 | unset($hide); | |
184 | $hide = array(); | |
185 | $pID = $d['petition_id']; | |
186 | $q2="SELECT * FROM signatures where petition_id = '$pID' and printed_status <> '' and signature_status <> 'deleted' order by signature_status, id desc"; | |
187 | $r2 = $petition->query($q2); | |
188 | while($d2 = mysqli_fetch_array($r2)){ | |
189 | if ($d2['signature_status'] == 'verified'){ | |
190 | 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>"; | |
191 | }else{ | |
192 | 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>"; | |
193 | } | |
194 | } | |
195 | echo '</table></fieldset>'; | |
196 | ||
197 | ||
198 | } | |
199 | ?> | |
200 | </form> | |
201 | ||
202 | ||
203 | ||
204 | ||
205 | ||
206 | <script> | |
207 | window.onload = function () { | |
208 | ||
209 | <?PHP echo $javascript;?> | |
ddec0164 PM |
210 | |
211 | function toggleDataSeries(e) { | |
212 | if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible ){ | |
213 | e.dataSeries.visible = false; | |
214 | } else { | |
215 | e.dataSeries.visible = true; | |
216 | } | |
217 | chart.render(); | |
218 | } | |
219 | ||
220 | } | |
221 | </script> | |
222 | ||
223 | ||
224 | ||
6865119a | 225 | <script src="../files/canvasjs.min.js"></script> |
3f627365 | 226 | <?PHP |
e3599ddc PM |
227 | include_once('footer.php'); |
228 | ?> |