Location: PHPKode > projects > Nukequiz > html/blocks/block-NQ_Scroll_Side_Top_List.php
<?php
/************************************************************************/
/*    Nukequiz	Version 3.0.0  Oct 06									*/
/*    For Further Information Visit 									*/
/*	  www.kissoftware.org.uk              								*/
/*    Refer to The Readme.txt & Use The Nukequiz Help Module Online     */
/************************************************************************/
/* Block To Show Toplist Scores For Each Active Quiz					*/
/* **********************************************************************/
if(!defined('NUKE_FILE') && !defined('BLOCK_FILE')) { die('You can\'t access this file directly...'); }
global $prefix, $db, $currentlang;
$module_name="Nukequiz";
include_once("modules/$module_name/language/lang-".$currentlang.".php");

/*Language Definitions*/
define("_NQ_TOQUIZZES","Quizzes");
define("_NQ_TOTCATS","Categories");
define("_NQ_QUES","Questions ");
define("_NQ_TOTALCOMPLETED","Completed");
define("_NQ_NOSCORESENT","No Scores Entered");
define("_NQ_HIGHSCORES","Highscores");
define("_NQ_TOP","Top");
/*End Language Definitions*/


$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 = $config['blocklist'];
$name_len = $config['cutoff'];
$scrdir = $config['scrdir'];
$height = $config['scrollheight'];
$scroll = $config['scroll'];
}









$content .= "<center><table cellpadding='3' cellspacing='3' border='0'><tr><td>";
if ($scroll == '1') {
$content .= "<div align='center'><Marquee behavior=\"scroll\" direction=\"$scrdir\" height=\"$height\" scrollAmount=\"3\" scrolldelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
}
$content .= "<table width='100%' border='0' cellpadding='2' cellspacing='2'><tr>";
$result = $db->sql_query("SELECT qid, sid, active, title FROM ".$prefix."_nquiz_quiz  WHERE active ='1' AND iscq='0' ORDER BY title ASC LIMIT 0,$blkh");
while(list($qid, $sid, $active, $title) = $db->sql_fetchrow($result)){
$sid = intval($sid);
$qid = intval($qid);
$content .= "<td colspan='2' height='10' align='center'></td></tr>";
$content .= "<td colspan='2' align='center'><a href=\"modules.php?name=$module_name&amp;op=startquiz&qid=$qid\">$title</a></td></tr>";
$resultq = $db->sql_query("SELECT COUNT(*) FROM ".$prefix."_nquiz_questions WHERE qid='$qid'");
list($a) = $db->sql_fetchrow($resultq);
$content .="<tr><td colspan='2' align='center'>( $a "._NQ_QUES." )</td></tr>";
$scores = $db->sql_query("SELECT username, perc, ttime FROM ".$prefix."_nquiz_scoreboard WHERE qid=$qid AND score >'0' ORDER BY perc DESC, ttime ASC LIMIT 0,$blkh ");
if ($db->sql_numrows($scores)==""){
$content .="<tr><td align='center' colspan='2'><b>"._NQ_NOSCORESENT."</b><br><b>&ndash;&nbsp;&ndash;&nbsp;&loz;&nbsp;&loz;&nbsp;&ndash;&nbsp;&ndash;</b></td></tr>";
}
else{
$content .= "<tr><td colspan='2' align='center'><font class='content'>"._NQ_TOP."&nbsp;<b>$blkh</b>&nbsp;"._NQ_HIGHSCORES."</font><br><br></td></tr>";
$content .= "<tr>";
while(list($username,$perc) = $db->sql_fetchrow($scores)){
if (strlen($username) > $name_len)
$username = substr($username, 0, ($name_len-2))."...";
$content .= "<td align=\"left\" width='80%'>$username</td><td align=\"right\">$perc%<br></td><tr></tr>";
}#scoreboard tag
$content .= "<td align=\"center\" colspan='2'><b>&ndash;&nbsp;&ndash;&nbsp;&loz;&nbsp;&loz;&nbsp;&ndash;&nbsp;&ndash;</b></td><tr></tr>";
}
}#List Tag
$content .= "</table></center><br><br></marquee><br></td></tr></table>";






//* Please Leave this Copyright Link In Here - Fair is Fair. Thanks */
$content .="<div align=\"right\"><a href=\"http://www.kissoftware.org.uk/\" target=\"_blank\"><img src=\"modules/$module_name/images/kiss.gif\"></a>&nbsp;";
?>
Return current item: Nukequiz