Location: PHPKode > projects > Nukequiz > html/modules/Nukequiz/public/NQPShowSection.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	 */
/*****************************************************************/
include('header.php');
logoheader(); 
$pagenum = $nq_config['pagenum'];
$formatdate = $nq_config['dateformat'];
$userhelp = $nq_config['user_help'];
$userhelp = intval($userhelp);
$sscoreboard = $nq_config['showscoreboard'];
$sscoreboard = intval($sscoreboard);
//$number_of_days = $nq_config['numberofdays'];//Not used yet!
$totalpages = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_nquiz_quiz WHERE sid='$sid' AND active > '0'"));
if (!isset($min)) { $min = 0; }
if (!isset($max)) { $max = $min + $pagenum; }       
$result = $db->sql_query("SELECT * FROM ".$prefix."_nquiz_sections WHERE sid='$sid'");
if ($totalpages == ''){
OpenTable();
echo "<br><center><font class='title'>"._NQ_NO."&nbsp;"._NQ_TOTALQUIZZESINCAT."</font><br><br>"._GOBACK."<br><br></center>";
CloseTable();
include("footer.php");
exit();
}
list($sid, $secname, $secdesc, $secimage) = $db->sql_fetchrow($result);
OpenTable();
$myquizimage = myquizimage("$secimage");
echo "<center><table width='100%' cellpadding='2' cellspacing='2' border='0'><tr>";
if (!$secimage == ''){
echo "<td align='center' colspan='3'><img src='$myquizimage' border='0' alt='$secname'></td></tr><tr>";
}
else {
echo "<td align='center' colspan='3'><font class='title'>&loz;&nbsp;$secname&nbsp;&loz;</font></td></tr><tr>";
}
echo "<td align='center' colspan='3'>$secdesc</td></tr></table>";
CloseTable();
echo "<table border='0' cellpadding='2' cellspacing='2' width='100%'>";
// START LISTING
$x = 0;
$a = 0;
$result = $db->sql_query("SELECT qid, sid, active, iscq,  prize_desc, sponsor, title, limit_attempts, expire, hit_count, maxqnum, points_total, rate, votes FROM ".$prefix."_nquiz_quiz WHERE sid=$sid  AND active ='1' ORDER BY title ASC LIMIT $min,$pagenum");
while(list($qid, $sid, $active, $iscq, $prize_desc, $sponsor,$title, $limit, $expire, $hits, $maxqnum, $points_total, $rate, $votes) = $db->sql_fetchrow($result)){
$cal= $rate/$votes;
$ratevalue  =  round($cal,2);
if ($limit == "1") {$limit = "<b>"._NQ_LIMITEDONLY."</b>";} else {$limit = ""._NQ_UNLIMITED."";}
if ($expire == "0"){$expire = ""._NQ_NOCLOSEDATESET."<br><br>";} else {$expire = ""._NQ_EXPIRESON."<br>".date($formatdate,$expire);}
if ($prize_desc == "") {$prize_desc = ""._NQ_NOPRIZE."";} else {$prize_desc = $prize_desc;}
if ($sponsor == "") {$sponsor = ""._NQ_NOSPONSOR."";} else {$sponsor = $sponsor;}
if ($a == 0) { echo "<tr>"; }
echo "<td width='50%'>";
OpenTable();
echo "<br><center><table width='100%' border='0' cellpadding='2' cellspacing='2'>";
echo "<td align='center'><a href='modules.php?name=$module_name&amp;op=startquiz&amp;qid=$qid'>$title</a></td></tr>";
echo "<td align='center'><b>[&nbsp;"._NQ_COMPLETED."&nbsp;$hits&nbsp;"._NQ_TIMES."&nbsp;]</b></td></tr>";
echo "<tr><td align='center' $maxqnum "._NQ_QUES."<br>";
echo "$ratevalue&nbsp;/&nbsp;"._NQ_TEN."&nbsp;"._NQ_AFTER."&nbsp;<b>$votes</b>&nbsp;"._NQ_VOTES."<br>";
echo "$limit</td></tr><tr>";
echo "<td align='center'><b>$expire</b></td></tr><tr>";
if ($sscoreboard == '1'){
scoreboardwin();
echo "<td align='center'>[&nbsp;<a href='modules.php?name=$module_name&amp;op=scoreboard&amp;qid=$qid'  Onclick=\"Scoreboarddisp(this.href,'','500','400','yes');return false;\">"._NQ_SHOWSCOREBOARD."</a>&nbsp;]</td>";
}
else {
echo "<td align='center'>[&nbsp;"._NQ_NOVIEWSCOREBOARD."&nbsp;]</td>";
}
if ($iscq == '1'){
$myquizimage = myquizimage("comp.png");
echo "<tr><td align='center'><img src='$myquizimage' alt='".NQ_COMPETITONRULESAPPLY."' title='".NQ_COMPETITONRULESAPPLY."'></td></tr>";
echo "<tr><td align='center'>$prize_desc</td></tr>";
echo "<tr><td align='center'>$sponsor</td></tr>";
}
else
{
$myquizimage = myquizimage("nocomp.png");
echo "<tr><td align='center'><img src='$myquizimage'></td></tr>";
echo "<tr><td align='center'>$prize_desc</td></tr>";
echo "<tr><td align='center'>$sponsor</td></tr>";
}
echo "<td align='center'><table cellpadding='3' cellspacing='3' border='0'><tr>";
$myquizimage = myquizimage("broken.png");//needs more testing
echo "<td align='center'><a href='modules.php?name=$module_name&amp;op=report&amp;qid=$qid'><img src='$myquizimage' title=\""._NQ_ERRORREPORT."\" onMouseOver=\"self.status='"._NQ_ERRORREPORT." ';return true\" onmouseout=\"self.status='';return true\" alt=\" "._NQ_ERRORREPORT."\"></a></td>";
$myquizimage = myquizimage("recfriend.png");
echo "<td align='center'><a href=\"modules.php?name=$module_name&amp;op=friendmail\"><img src='$myquizimage' title=\""._NQ_EMAILFRIEND."\" onMouseOver=\"self.status='"._NQ_EMAILFRIEND." ';return true\" onmouseout=\"self.status='';return true\" alt=\" "._NQ_EMAILFRIEND."\"></a></td>";
$ip = $_SERVER['REMOTE_ADDR'];
$qid = intval($qid);
$db->sql_query("DELETE FROM ".$prefix."_nquiz_rate WHERE date < '$past'");
$past = time()-21600;
//$past = time()-86400*$number_of_days;
$row = $db->sql_fetchrow($db->sql_query("SELECT ip, qid FROM ".$prefix."_nquiz_rate WHERE (ip='$ip') AND (qid='$qid')"));
$ips = $row['ip'];
$qids = $row['qid'];
$ctime = time();
if ($ip == $ips || $qid == $qids) {
$myquizimage = myquizimage("rateblocked.png");
echo "<td align='center'><img src='$myquizimage' title=\""._NQ_ALREADYVOTED."\" onMouseOver=\"self.status='"._NQ_ALREADYVOTED." ';return true\" onmouseout=\"self.status='';return true\" alt=\" "._NQ_ALREADYVOTED."\"></a>";
}
else{
$myquizimage = myquizimage("rate.png");
echo "<td align='center'><a href='modules.php?name=$module_name&amp;op=ratequiz&amp;qid=$qid'><img src='$myquizimage' title=\""._NQ_RATEQ."\" onMouseOver=\"self.status='"._NQ_RATEQ." ';return true\" onmouseout=\"self.status='';return true\" alt=\" "._NQ_RATEQ."\"></a>";
}
echo"</td></tr></table>";
echo "</td></tr></table><br></center>";
CloseTable();
echo "</td>";
$a++;
if ($a == 2) { echo "</tr>"; $a = 0; }
$x++;
}
if ($a == 1) { echo "<td width='50%'>&nbsp;</td></tr>"; } else { echo "</tr>"; }
echo "</table>";
OpenTable();
echo "<br><center>"._GOBACK."<br></center>";
if ($userhelp > '0'){
echo "<div align='right'>".quizhelp_img(_NQ_HELPUSERSELCAT)."&nbsp;</div><br>";
}
CloseTable();
pagesections($pagenum, $totalpages, $max, $min);
include("footer.php");
?>
Return current item: Nukequiz