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