<?
/*-------------------------------------------------------------------
reps_ques_type1_anal.php Ver. $Revision: 1.2 $ $Date: 2003/05/21 02:03:31 $
*
Copyright (C) 2000 Hong Kong Baptist University
*
This file is part of the Quadrille system.
* This program is free software; it is distributed under the terms of
the GNU General Public License, either version 2, or (at your option)
* any later version.
* This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*
---------------------------------------------------------------------
*/
?>
<?
require "config_inc.php";
require "global_inc.php";
require "template.php";
include $language_pack;
require "output_inc.php";
include "qreport_{$lang_name}_inc.php";
include "qreport_inc.php";
/*************/
/* Main Part */
/*************/
check_expire();
$role = check_role();
if (($role <>'Adm') && ($role <>'Tea'))
{
header("location:login.php?again=1");
}
set_cookie($cookie);
insert_header();
$uid=$cookie[user_uid];
$query_course="SELECT COURSE.UID COURSE_UID, COURSE.ID COURSE_ID, COURSE.NAME COURSE_NAME FROM COURSE WHERE COURSE.UID=$anal_course_uid";
$query_paper="SELECT ID PAPER_ID,NAME PAPER_NAME,PAPER_TYPE PAPERTYPE FROM PAPER WHERE UID=$anal_paper_uid";
//$query_paper_question="SELECT SUM(MARK_GAIN) AS FULL_MARK,COUNT(MARK_GAIN) AS QUES_NO FROM PAPER_QUESTION WHERE PAPER_UID=$anal_paper_uid";
$result_query_course=mysql_query($query_course);
if (mysql_errno() != 0)
header("location:qerror.php?qerr_type=1&qerr_mess=DB_ERR&qerr_messx=".mysql_error());
$result_paper=mysql_query($query_paper);
if (mysql_errno() != 0)
header("location:qerror.php?qerr_type=1&qerr_mess=DB_ERR&qerr_messx=".mysql_error());
//$result_paper_question=mysql_query($query_paper_question);
$row_paper=mysql_fetch_array($result_paper);
$row_query_course=mysql_fetch_array($result_query_course);
//$row_paper_question=mysql_fetch_array($result_paper_question);
$row=find_user($uid);
$idofuser = $row["ID"];
$nameofuser = $row["NAME"];
$roleofuser = $row["ROLE"];
$query_teacher="SELECT ID TID,NAME TNAME FROM USER,TEACH_COURSE WHERE USER.UID=TEACH_COURSE.USER_UID AND COURSE_UID=$row_query_course[COURSE_UID]";
$result_teacher=mysql_query($query_teacher);
if (mysql_errno() != 0)
header("location:qerror.php?qerr_type=1&qerr_mess=DB_ERR&qerr_messx=".mysql_error());
$course_teachers="";
$span=0;
while($row_teacher=mysql_fetch_array($result_teacher))
$course_teachers.=$row_teacher[TNAME]." (".$row_teacher[TID]."),<br />";
if ($roleofuser=="Adm")
$role = $ADMIN;
else
$role = $TEACHER;
$currentlocation = $role ." : ".$nameofuser." (".$idofuser.")";
if($row_paper[PAPERTYPE]=="ASSIGNMENT")
$row_paper[PAPERTYPE]=$ASSIGNMENT;
else
if($row_paper[PAPERTYPE]=="EXAM")
$row_paper[PAPERTYPE]=$EXAM;
$content.=<<<_HTML_
<form name="form1" method="post">
<input type="hidden" name="anal_course_uid" value="0">
<input type="hidden" name="anal_paper_uid" value="0">
<input type="hidden" name="anal_ques_no" value="0">
<input type="hidden" name="anal_ques_uid" value="0">
<input type="hidden" name="anal_ques_type" value="0">
</form>
<table width="" border=0 cellspacing=4 cellpadding=5 >
_HTML_;
// check if user has been chosen any class or group before enter this page as to display the class teacher or group teacher
if ($anal_class_uid!="") // class has been chosen
{
$class_info = get_class_info($anal_class_uid);
$content.=<<<_HTML_
<tr>
<td class="tableheading">$CLASS</td>
<td class="tblcolval" colspan="3">$class_info</td>
</tr>
_HTML_;
$class_teachers = get_teacher("", $anal_class_uid, "");
$content.=<<<_HTML_
<tr>
<td class="tableheading">$CLASS_TEACHER</td>
<td class="tblcolval" colspan="3">$class_teachers</td>
</tr>
_HTML_;
}
else
{
if ($anal_group_uid!="") // group has been chosen
{
$group_info = get_group_info($anal_group_uid);
$content.=<<<_HTML_
<tr>
<td class="tableheading">$GROUP</td>
<td class="tblcolval" colspan="3">$group_info</td>
</tr>
_HTML_;
$group_teachers = get_teacher("", "", $anal_group_uid);
$content.=<<<_HTML_
<tr>
<td class="tableheading">$GROUP_TEACHER</td>
<td class="tblcolval" colspan="3">$group_teachers</td>
</tr>
_HTML_;
}
}
$content.=<<<_HTML_
<tr>
<td nowrap class="tableheading">$COURSE</td>
<td nowrap class="tblcolval">$row_query_course[COURSE_NAME] ($row_query_course[COURSE_ID])</td>
</tr>
<tr>
<td nowrap class="tableheading">$COURSE_TEACHER</td>
<td nowrap class="tblcolval">$course_teachers</td>
</tr>
<tr>
<td class="tableheading">$PAPER</td>
<td nowrap class="tblcolval">$row_paper[PAPERTYPE]: $row_paper[PAPER_NAME] ($row_paper[PAPER_ID]) </td>
</tr>
<tr>
<td class="tableheading">$QUESTION_NO</td>
<td nowrap class="tblcolval">$anal_ques_no</td>
</tr>
</table>
<br />
_HTML_;
$content.=<<<_HTML_
<table width="500" border=0 cellspacing=4 cellpadding=5>
<tr class="tableoweven">
<td size="500" bgcolor="#88FFFF">
<center>Display Question Area</center>
<br /><br /><br /><br />
<br /><br /><br /><br />
<br /><br /><br /><br />
</td>
</tr>
</table>
<br />
_HTML_;
/*
anal_course_uid
anal_paper_uid
anal_ques_no
anal_ques_uid
anal_ques_type
*/
if($anal_class_uid=="")
$rept_class_uid="''";
if($anal_group_uid=="")
$rept_group_uid="''";
//print "course:$anal_course_uid,class:$anal_class_uid,group:$anal_group_uid";
print "Paper UID=$anal_paper_uid<br>";
print "Question Type=$anal_ques_type<br>";
print "Question UID=$anal_ques_uid<br>";
print "Question NO=$anal_ques_no<br>";
print "<br>$question_content<br>";
$question_content=get_question($anal_ques_uid,$anal_ques_type);
if($anal_ques_type==1)//TEXT_MC
{
print "This is Text MC";
}
else
if($anal_ques_type==2)//BINARY_MC
{
print "This is Binary MC";
}
else
if($anal_ques_type==3)//TF
{
print "This is TF";
$content.=<<<_HTML_
<table width="70%" border=1 cellspacing=4 cellpadding>
<tr class="tablerowodd">
<td class="tableheading" size="30%">$ANSWER</td>
<td class="tableheading" size="20%">T</td>
<td class="tableheading" size="20%">F</td>
<td class="tableheading" size="30%">$CUMU_NO_OF_STUD</td>
</tr>
<tr class="tableroweven">
<td class="tableheading">$NO_OF_STUD</td>
<td>6</td>
<td>4</td>
<td>10</td>
</tr>
</table>
_HTML_;
}
else
if($anal_ques_type==4)//CLICKING
{
print "This is Clicking";
}
/*
$content.=<<<_HTML_
<table width="" border=1 cellspacing=4 cellpadding>
<tr class="tablerowodd">
<td class="tableheading">$ANSWER</td>
<td class="tableheading">A</td>
<td class="tableheading">B</td>
<td class="tableheading">C</td>
<td class="tableheading">D</td>
<td class="tableheading">E</td>
<td class="tableheading">$CUMU_NO_OF_STUD</td>
</tr>
<tr class="tableroweven">
<td class="tableheading">$NO_OF_STUD</td>
<td>6(20%)</td>
<td>4(13%)</td>
<td>8(27%)</td>
<td>9(30%)</td>
<td>3(10%)</td>
<td>30</td>
</tr>
</table>
_HTML_;
*/
// insert previous, next button
$quesno="SELECT MAX(QUESTION_NO) AS QNO FROM PAPER_QUESTION WHERE PAPER_UID=$anal_paper_uid";
$result_quesno=mysql_query($quesno);
if (mysql_errno() != 0)
header("location:qerror.php?qerr_type=1&qerr_mess=DB_ERR&qerr_messx=".mysql_error());
$row_quesno=mysql_fetch_array($result_quesno);
if($row_quesno[QNO]>$anal_ques_no)
$next_ques = 1;
if($anal_ques_no!=1) // find the previous question
{
$pre_no=$anal_ques_no-1;
$pre_quid=find_quid($anal_paper_uid,$pre_no);
$pre_qtype=find_qtype($pre_quid);
}
if($next_ques==1) // find the next question
{
$next_no=$anal_ques_no+1;
$next_quid=find_quid($anal_paper_uid,$next_no);
$next_qtype=find_qtype($next_quid);
}
if($anal_ques_no==1&& $next_ques==0) //no previous button and next,
{
$a = array ('BACK_TO_REPORT_LIST' => "report.php"
,'BACK' => "javascript:window.history.back();");
$content.=link_line($a,"");
}
if($anal_ques_no==1&& $next_ques!=0) //no previous button,but have next,
{
$a = array ('BACK_TO_REPORT_LIST' => "report.php"
,'NEXT_QUES' => "javascript:question_type_anal($next_no,$next_quid,$anal_course_uid,$anal_paper_uid,$next_qtype)"
,'BACK' => "javascript:window.history.back();");
$content.=link_line($a,"");
}
if($anal_ques_no!=1&& $next_ques!=0)//have both previous and next button
{
$a = array ('BACK_TO_REPORT_LIST' => "report.php"
,'PREVIOUS_QUES' => "javascript:question_type_anal($pre_no,$pre_quid,$anal_course_uid,$anal_paper_uid,$pre_qtype)"
,'NEXT_QUES' => "javascript:question_type_anal($next_no,$next_quid,$anal_course_uid,$anal_paper_uid,$next_qtype)"
,'BACK' => "javascript:window.history.back();");
$content.=link_line($a,"");
}
if($anal_ques_no!=1&& $next_ques==0)//have previous but no next
{
$a = array ('BACK_TO_REPORT_LIST' => "report.php"
,'PREVIOUS_QUES' => "javascript:question_type_anal($pre_no,$pre_quid,$anal_course_uid,$anal_paper_uid,$pre_qtype)"
,'BACK' => "javascript:window.history.back();");
$content.=link_line($a,"");
}
//$content.= "<p class=\"message\">$REPT_CLASS_SELECT_TITLE</p>";
$java = get_file("javascript/rept.js");
//$java.=get_file("javascript/report_redirect.js");
$java = ereg_replace("<BEGIN>SELECT_PAPER_FIRST<END>",$SELECT_PAPER_FIRST,$java);
$html = get_template($template,$template_dir);
$html=ereg_replace("<BEGIN>JAVASCRIPT<END>",$java,$html);
$html=ereg_replace("<BEGIN>TITLE<END>",$QUESTION_MARK_ANALYSIS,$html);
$html=ereg_replace("<BEGIN>CURRENTLOCATION<END>",$currentlocation,$html);
$html=ereg_replace("<BEGIN>CONTENT<END>",$content,$html);
$html=ereg_replace("<BEGIN>COPYRIGHT<END>",$COPYRIGHT,$html);
print $html;
?>