wahlhelfer/statistics/index.php

94 lines
2.6 KiB
PHP
Raw Permalink Normal View History

2014-05-15 16:49:45 +00:00
<?php
include('../config/config.php');
include(STATE_HTML.'html.inc.php');
include(STATE_INCLUDES.'functions.php');
checkLoginAdmin();
startHtml($title = "Dashboard");
tophead($title);
leftNav();
?>
<?php
if ( isset($_SESSION['succesMessage']) )
{
successMsg($_SESSION['succesMessage']);
unset($_SESSION['succesMessage']);
}
?>
<section id="main" class="column">
<article class="module width_quarter">
<header>
<h3>Account Management</h3>
</header>
<ul>
<li class="icn_edit_article"><a href="<?php echo STATE_URL;?>change-password.php">Change Password</a></li>
</ul>
</article>
<article class="module width_quarter">
<header>
<h3>Generate Party Report</h3>
</header>
<ul>
<li class="icn_view"><a href="<?php echo STATE_URL;?>party-report.php">View Parties Statistics</a></li>
</ul>
</article>
<article class="module width_quarter">
<header>
<h3>Questions Response Report</h3>
</header>
<ul>
<li class="icn_view"><a href="<?php echo STATE_URL;?>question-report.php">View Questions Statistics</a></li>
</ul>
</article>
<div class="spacer"></div>
<br/>
<div style="width:100%;float:left;margin-top:15px;">
<div style="width:820px;margin:0 auto;">
<div id="chart_div" style="width: 800px; height: 300px;float:left;background-color:white;margin-top:80px"></div>
</div>
</div>
</section>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart()
{
var data = google.visualization.arrayToDataTable([
['Party','Points'],
<?php
$getRes = mysql_query("SELECT Id, Logo, Party, Name, Description,Points FROM tbl_candidate ORDER BY Points DESC");
$data=mysql_num_rows($getRes);
if($data>0)
{
while($row = mysql_fetch_array($getRes))
{
?>
['<?php echo $row['Party']." (".$row['Name'].")"; ?>', <?php echo $row['Points'];?>],
<?php }
}
else
{
?> ['0',0]
<?php }?>
]);
var options = {
title: 'Party/Candidate Statistics Report',
hAxis: {title: 'Party/Candidate Wise', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
<?php
endHtml();
?>