wahlhelfer/statistics/party-report.php
2014-05-15 18:49:45 +02:00

75 lines
2.6 KiB
PHP

<?php
include('../config/config.php');
include(STATE_HTML.'html.inc.php');
include(STATE_INCLUDES.'functions.php');
checkLoginAdmin();
startHtml($title = "Party Report");
tophead($title);
leftNav();
?>
<section id="main" class="column">
<article class="module width_full">
<header>
<h3 class="tabs_involved">Parties Statistics</h3>
</header>
<table class="display data-table" id="myTable">
<thead>
<tr>
<th width="50">Position</th>
<th width="150">Party</th>
<th width="90">Logo</th>
<th width="250">Description</th>
<th width="90">Total Points</th>
</tr>
</thead>
<tbody>
<?php
$getRes = mysql_query("SELECT Id, Logo, Party, Name, Description,Points FROM tbl_candidate ORDER BY Points DESC");
$count = 1;
$total=0;
while( $row = mysql_fetch_array($getRes) )
{
?>
<tr>
<td align="center"><?php echo $count;?></td>
<td align="center"><?php echo $row['Party']." (".$row['Name'].")";?></td>
<td align="center">
<a href="<?php echo UPLOADS_URL.'partylogo/'.$row['Logo'];?>" class="lightbox">
<img src="<?php echo UPLOADS_URL.'partylogo/thumbs/thumb_'.$row['Logo'];?>" />
</a>
</td>
<td><?php echo nl2br($row['Description']);?></td>
<td align="center">
<?php
$total+=$row['Points'];
?>
<span style="font-size:16px; font-weight:bold;"><?php echo $row['Points'];?></span>
</td>
</tr>
<?php
$count++;
}
?>
</tbody>
</table>
<h3>Average Score: <?php echo round($total/$count,2);?> </h3>
</article>
<div class="spacer"></div>
</section>
<script type="text/javascript" src="<?php echo STATE_LIGHTBOX;?>js/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo STATE_LIGHTBOX;?>themes/default/jquery.lightbox.css" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" href="<?php echo LIGHTBOX;?>themes/default/jquery.lightbox.ie6.css" /><![endif]-->
<script type="text/javascript" src="<?php echo STATE_LIGHTBOX;?>js/jquery.lightbox.js"></script>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery('.lightbox').lightbox();
});
</script>
<?php
endHtml();
?>