Location: PHPKode > projects > Nukequiz > html/blocks/block-NQ_Center_Top_League.php
<?php
/*****************************************************************/
/* Nukequiz (tm)    v 3.1.0                                		 */
/* By: Kissoftware (hide@address.com)      		     */
/* http://www.kissoftware.org.uk                           		 */
/* http://www.kissoftware.co.uk                       		     */
/* Copyright © 2003-2008 by Kissoftware         				 */
/* See Docs For Information & Credits                 			 */
/* For More information Visit Forums Or The Online Help Manual	 */
/*****************************************************************/
/* Center-Block To Show League Results Average Score & Percentage*/
/* ***************************************************************/
if ( !defined('BLOCK_FILE') ) {Header("Location: index.php");die();}
global $prefix, $db, $currentlang, $nukeurl;
$module_name="Nukequiz";
include_once("modules/$module_name/language/lang-".$currentlang.".php");
$ThemeSel = get_theme();
$configresult = $db->sql_query("SELECT config_name, config_value FROM ".$prefix."_nquiz_config");
while (list($config_name, $config_value) = $db->sql_fetchrow($configresult)) {
$config[$config_name] = $config_value;
$blkh = intval($config['blocklist']);
$updated = $config['league_update'];
$name_len = $config['cutoff'];
$orderby = $config['league_orderby'];
$count = intval($config['league_count']);
$graphics = intval($config['league_graphics']);
$dateformat = $config['dateformat'];
}
$content .= "<center><table width='100%' border='0' cellpadding='2' cellspacing='2'><tr>";
$content .= "<th>"._NQ_NAME."</th><th width='65%'>"._NQ_PTS."</th><th>"._NQ_COMPLETEDQUIZZES."</th><th>"._NQ_PERCENTAGE."</th></tr><tr>";
$result = $db->sql_query("SELECT nqlid, username, count, score, perc from ".$prefix."_nquiz_league WHERE count>=$count ORDER BY $orderby DESC LIMIT 0,$blkh");
while(list($id, $username, $scount, $score, $perc) = $db->sql_fetchrow($result)){
if (strlen($username) > $name_len){$username = substr($username, 0, ($name_len-2))."...";}
$counter += 1;
$WidthIMG = round(1 * $perc,0);
$l_size = getimagesize("themes/$ThemeSel/images/leftbar.gif");
$m_size = getimagesize("themes/$ThemeSel/images/mainbar.gif");
$r_size = getimagesize("themes/$ThemeSel/images/rightbar.gif");
if  ($graphics =='1'){
$showgraphics = "<img src='themes/$ThemeSel/images/leftbar.gif' width='$l_size[0]' height='$l_size[1]'><img src='themes/$ThemeSel/images/mainbar.gif' height='$m_size[1]' width='$WidthIMG * 1'><img src='themes/$ThemeSel/images/rightbar.gif' width='$l_size[0]' height='$l_size[1]'>";
}
$content .= "<td class='row1' align='left'>$username</td><td width='65%' class='row1'>$showgraphics&nbsp;(&nbsp;<b>$score</b>&nbsp;"._NQ_PTS.")</td>";
$content .= "<td align='center' class='row1'><b>$scount</b></td><td align='center' class='row1'><b>$perc&nbsp;%</b></td></tr>";
}
$content .= "</table></center>";
$orderedbya = _NQ_PERCENT;
$orderedbyb = _NQ_SCORE;
$orderedbyd = _NQ_AVG;
$orderedbye = _NQ_COMPLETED;
if ($orderby == 'perc') { $orderedby = $orderedbya; } elseif ($orderby == 'score') { $orderedby = $orderedbyb; }elseif ($orderby == 'average') { $orderedby = $orderedbyd; }elseif ($orderby == 'count') { $orderedby = $orderedbye; }
$content .= "<br><center>"._NQ_TOP."&nbsp;<b>$blkh</b>&nbsp;"._NQ_LEAGUE."<br>"._NQ_POSITIONSORDERBY."&nbsp;<b>$orderedby</b><br>"._NQ_WHERECOMPLETED."&nbsp;<b>$count</b>&nbsp;"._NQ_QUIZZES."";
$date = date($dateformat,$updated);
$content .= "<br>"._NQ_LASTUPDATED."&nbsp;:&nbsp;<b>$date</b><br></center>";
$content .= "<div align='right'><a href='$nukeurl/rss-nukeleague.php' target='_blank'>";
$content .= "<img src='modules/$module_name/images/rssfeed.png' align='absmiddle' alt='"._NQ_RSSFEEDLEAGUE."' title='"._NQ_RSSFEEDLEAGUE."'></a>&nbsp;</div>";
?>
Return current item: Nukequiz