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