+<?PHP
+if($_COOKIE['level'] == 'admin'){
+ $q="SELECT * FROM petitions where admin_status = 'approved' order by admin_sort DESC ";
+}else{
+ $q="SELECT * FROM petitions where group_id = '$group_id' and admin_status = 'approved'";
+}
+//echo "<li>$q</li>";
+$r = $petition->query($q);
+while($d = mysqli_fetch_array($r)){
+ $pID = $d['petition_id'];
+ echo "<div id=\"chartContainer$pID\" style=\"height: 400px; width: 100%; margin: 0px auto;\"></div>";
+ $chart='';
+ $chart2='';
+ $chart3='';
+ $q3 = "SELECT just_date FROM signatures where petition_id = '$pID' and just_date <> '0000-00-00' group by just_date";
+ //echo "<li>$q3</li>";
+ $r3 = $petition->query($q3);
+ $total=0;
+ $goal = $d['signature_goal'];
+ if ($goal == 0){
+ $goal = 10000;
+ }
+ while ($d3 = mysqli_fetch_array($r3)){
+ $just_date = $d3['just_date'];
+ $q2 = "SELECT * FROM signatures where petition_id = '$pID' and just_date = '$just_date' and signature_status = 'verified' ";
+ //echo "<li>$q2</li>";
+ $r2 = $petition->query($q2);
+ $count = mysqli_num_rows($r2);
+ $chart .= '{ label: "'.$just_date.'", y: '.intval($count).' }, ';
+ $total = $total + intval($count);
+ $chart2 .= '{ label: "'.$just_date.'", y: '.intval($total).' }, ';
+ $goal = $goal - intval($count);
+ $chart3 .= '{ label: "'.$just_date.'", y: '.intval($goal).' }, ';
+ }
+ $chart = rtrim(trim($chart), ",");
+ $chart2 = rtrim(trim($chart2), ",");
+ $chart3 = rtrim(trim($chart3), ",");
+
+ ob_start(); ?>
+
+ var chart<?PHP echo $pID;?> = new CanvasJS.Chart("chartContainer<?PHP echo $pID;?>", {
+ theme:"light2",
+ animationEnabled: true,
+ exportEnabled: true,
+ title:{
+ text: "<?PHP echo $d['petition_name'];?> MD-Petition.com Signature Tracker"
+ },
+ axisY :{
+ includeZero: false,
+ title: "Number of Signatures",
+ suffix: "",
+ scaleBreaks: {
+ autoCalculate: true
+ }
+ },
+ toolTip: {
+ shared: "true"
+ },
+ legend:{
+ cursor:"pointer",
+ itemclick : toggleDataSeries
+ },
+ data: [{
+ type: "line",
+ visible: true,
+ showInLegend: true,
+ yValueFormatString: "#####",
+ name: "Total Signatures Count",
+ dataPoints: [
+ <?PHP echo $chart2; ?>
+ ]
+ },<?PHP if(1 == 2){ ?>{
+ type: "line",
+ visible: true,
+ showInLegend: true,
+ yValueFormatString: "#####",
+ name: "Signatures Remaining to Goal",
+ dataPoints: [
+ <?PHP echo $chart3; ?>
+ ]
+ },<?PHP } ?>{
+ type: "column",
+ visible: true,
+ showInLegend: true,
+ yValueFormatString: "#####",
+ name: "New Daily Signatures",
+ dataPoints: [
+ <?PHP echo $chart; ?>
+ ]
+ }]
+ }
+
+
+ );
+ chart<?PHP echo $pID;?>.render();
+
+ <?PHP $javascript .= ob_get_clean();
+}
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+