Viewing file: assessFormHCourse_OLD.php (18.66 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "template.php";
showHeader();
sendRequest();
?>
<script language="javascript">
function checkalredy (fref) {
// fref is form reference
var fact=0;
var fact2=0;
var sumfact=0;
var sumfact2=0;
var ischecked = false;
if(fref){
f = document.FormAss;
sumrq = eval("f.SumRQ.value");
// Check ส่วนที่เป็น radio
for (i=1;i<=sumrq;i++){
msgRQ = eval("f.msgRQ"+i+".value");
fact=0;
tmp = eval('f.selectMRQ'+i);
for (j=0;j<tmp.length;j++){
if (tmp[j].checked== true) { // ถ้าเลือก fact จะเป็น 1
fact=1;
++sumfact;
break;
}
}
if(fact == 0) {
alert(msgRQ);
//break;
return false;
}
}
// Check ส่วนที่เป็น text
sumtq = eval("f.SumTQ.value");
for (x=1;x<=sumtq; x++){
msgTQ = eval("f.msgTQ"+x+".value");
fact2=0;
tmp2 = eval('f.textTQ'+x+'.value');
tmp3 = eval('f.textTQ'+x);
//alert(tmp2);
if (tmp2 != "") {
fact2 = 1;
++sumfact2;
}
if (fact2 == 0){
alert(msgTQ);
tmp3.focus();
return false;
//break;
}
}
if((sumfact == sumrq)&&(sumfact2 == sumtq)){
var agree=confirm("คุณต้องการบันทึกข้อมูลแน่นอนใช่หรือไม่?");
if (agree)
f.submit();
//return true ;
else
return false ;
}
}
return fact;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620">
<link href="../source/style.css" rel="stylesheet" type="text/css">
<br>
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="724">
<fieldset>
<form name="FormAss" method="post" action = "processAssFormHCourse.php">
<legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="startPageAss.php">เริ่มการประเมิน
</a><img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle"><a href="showFormByCourse.php?studentId=<? echo $studentId ?>&classId=<? echo $classId ?>&courseId=<? echo $courseId ?>&ttId=<? echo $ttId ?>&flag7_mustDo=<?=$flag7_mustDo;?>&flag6_mustDo=<?=$flag6_mustDo;?>&flag8_mustDo=<?=$flag8_mustDo;?>&flag0_mustDo=<?=$flag0_mustDo;?>&flag1_mustDo=<?=$flag1_mustDo;?>&flag5_mustDo=<?=$flag5_mustDo;?>" onclick="return sendRequest(this);" onmouseover="window.status=''; return true;">
ประเมินรายวิชาที่ลงทะเบียนเรียน</a><img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle">
ทำแบบประเมิน </font> </legend>
<br>
<?
include_once "../link/function.php";
include_once "../class/clsReg_EregisConfig.php";
include_once "../class/clsCourseAssess.php";
include_once "../class/clsClassInStructorAssess.php";
include_once "../class/clsOfficerAssess.php";
include_once "../class/clsTable.php";
include_once "../class/clsAssessForm.php";
include_once "../class/clsSectionAll.php";
include_once "../class/clsSectionRQ.php";
include_once "../class/clsSectionTQ.php";
include_once "../class/clsRadioQuestion.php";
include_once "../class/clsTextQuestion.php";
include_once "../class/clsHeaderQuestion.php";
include_once "../class/clsHeaderScore.php";
include_once "../class/clsDetailScore.php";
include_once "../class/clsDefineAssessment.php";
$oCR = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB_REG'], $GLOBALS['USER_REG'], $GLOBALS['PASSWORD_REG']);
$oCA = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB_EASS'], $GLOBALS['USER_EASS'], $GLOBALS['PASSWORD_EASS']);
$oCourse = new CourseAssess($oCA);
$oCourse->SearchByKey($courseId);
$oCourse->GetRecord();
$oCIS = new ClassInStructorAssess($oCA);
$oOFA = new OfficerAssess($oCA);
$oECon = new EregisConfig($oCR);
$oECon->RSEregisConfig();
$oECon->GetRecord();
$oAF = new AssessForm($oCA);
$oAF->RSAssessFormByAssid($assid);
$oAF->GetRecord();
$oDA = new DefineAssessment($oCA);
$oDA->SearchByDefineid($defineid);
$oDA->GetRecord();
?>
<table width="93%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="<?php echo $GLOBALS['COLOR_BG_TD_6'];?>">
<tr><td height="10"></td></tr>
<tr>
<td align="center"><span class = "fontMark5"><? echo $oAF->nameAss; ?>
</span></td>
</tr>
<tr>
<td height="23" align="center"><span class = "fontMark6"><? echo $oECon->collegeName ?></span></td>
</tr>
</table>
<table width="655" border="0" align="center">
<tr>
<td width="649" align="center"><hr></td>
</tr>
</table>
<table width="653" border="0" align="center" cellpadding="0" cellspacing="1" >
<tr>
<td> </td>
</tr>
<tr>
<td height="22"><font size="2"><b><img src="../picture/bullet.gif"></b></font>
<font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><strong>รหัสวิชา
: </strong> <?php echo $oCourse->courseCode?> (<?php echo $oCourse->courseCodeEng?>)</font>
<img src="../picture/bullet.gif"> <strong>กลุ่ม : </strong><?php echo $section?></td>
</tr>
<tr>
<td height="22"><font size="2"><b><img src="../picture/bullet.gif"></b></font>
<font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><strong>ชื่อรายวิชา
: </strong><?php echo $oCourse->courseName?></font><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>">
(<?php echo $oCourse->courseNameEng?>)</font></td>
</tr>
<tr>
<td height="22">
<font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>">
<?
if($oDA->flag == 0 || $oDA->flag == 1){ // รายอาจารย์ผู้สอน
echo "<img src=\"../picture/user.gif\" border =\"0\" width=\"13\" height=\"13\"> <strong>ประเมินอาจารย์ผู้สอน :</strong> ";
$oOFA->SearchByKey($officerId);
$oOFA->GetRecord();
echo " อ.".$oOFA->officerName." ".$oOFA->officerSurname;
}else if($oDA->flag == 5 || $oDA->flag == 6){ //ภาพรวมรายวิชา
$t=0;
$oCIS->SearchByClassIdGroupOfficerId($classId);
while($oCIS->GetRecord()){
$oOFA->SearchByKey($oCIS->officerId);
$oOFA->GetRecord();
$Teachers[$t] = "อ.".$oOFA->officerName." ".$oOFA->officerSurname;
$t++;
}
echo "<img src=\"../picture/users.gif\" border =\"0\"> <strong>ประเมินภาพรวมรายวิชาโดยมีอาจารย์ผู้สอน :</strong> ";
for($s=0;$s<$t;$s++){
echo $Teachers[$s];
if($s<$t-1){
echo ", ";
}
}
} else if($oDA->flag == 7 || $oDA->flag == 8){
if($oDA->flag == 7)
echo "<img src=\"../picture/user.gif\" border =\"0\" width=\"13\" height=\"13\"> <strong>ประเมินรายสัปดาห์ :</strong> ";
else
echo "<img src=\"../picture/user.gif\" border =\"0\" width=\"13\" height=\"13\"> <strong>ประเมินรายอาจารย์ผู้สอน :</strong> ";
$oOFA->SearchByKey($officerId);
$oOFA->GetRecord();
echo " อ.".$oOFA->officerName." ".$oOFA->officerSurname;
}
?>
</font></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><span class="fontMarkTD2">
คำชี้แจง</span></font></td>
</tr>
<tr>
<td> <? echo $oAF->explains;?></td>
</tr>
</table>
<?
$oTD = new clsTable(array(""));
$oTD->width="654";
$oTD->align="center";
$oTD->bgColor = ""; //#DADADA
$oTD->headerBgColor = ""; //#B7B7B7
$RowRQ = 0;
$RowTQ = 0;
$indexSection = 1;
$indexSectionRQ = 1;
$indexSectionTQ = 1;
$oSA = new SectionAll($oCA);
$oSA->RSByKeyAss($assid);
while ($oSA->GetRecord()){
/*---------------- กรณีที่เลือกเป็นคำถามชนิดปลายปิด------------------*/
if($oSA->sectionRQid != '0'){
//เก็บค่า SectionRQid ใน array เพื่อนำไปใช้ในหน้า process
$sectionRQid[$indexSectionRQ] = $oSA->sectionRQid;
//สร้าง oSRQ แสดงหัวข้อของส่วนการประเมิน
$oSRQ = new SectionRQ($oCA);
$oSRQ->RSSectionRQAll($assid,$oSA->sectionRQid);
while($oSRQ->GetRecord()){
$oHQ = new HeaderQuestion($oCA);
$oHQ->RSHeaderAllBySection($assid,$oSA->sectionRQid);
$oHQ->GetRecord();
$oHS = new HeaderScore($oCA);
$oHS->RSHeadSAll($oHQ->HSid);
$oHS->GetRecord();
//echo "HSid = ".$oHQ->HSid;
//echo "<br>amount_score = ".$oHS->score_amount;
//echo"<br> HQtext = ".$oHQ->HQtext;
//echo"<br> HStext = ".$oHS->HStext;
//ใส่รูปว่าง
$oTD->rowStart();
$oTD->addCell("<img src=\"../picture/blank1.gif\"border=\"0\">","","","","","","22");
$oTD->rowEnd();
$oTD->rowStart();
//---------->แสดงส่วนของแบบประเมิน
$merges = $oHS->score_amount+2;
$oTD->rowStart();
$oTD->addCell("<span class=\"fontMarkTD1\">ส่วนที่ $indexSection</span> : $oSRQ->topicSectionRQ","","","$merges","","","22");
$oTD->rowEnd();
//---------->แสดงข้อความส่วนหัวของคำถาม และข้อความส่วนหัวของระดับคะแนน
$oTD->rowStart();
$oTD->addCell("<span class=\"TDradioQuestion\">$oHQ->HQtext</span>","center","#3366cc","2","2","","22");
$oTD->addCell("<span class=\"TDradioQuestion\">$oHS->HStext</span>","center","#3366cc","$oHS->score_amount","","","22");
$oTD->rowEnd();
//---------->แสดงข้อความส่วนหัวย่อยของระดับคะแนน
$oDS = new DetailScore($oCA);
$oDS->RSDetailSAll($oHS->HSid);
$oTD->rowStart();
while($oDS->GetRecord()){
$oTD->addCell("<span class=\"TDradioQuestion\">$oDS->DStext</span>","center","#3366cc","","","47","22");
}
$oTD->rowEnd();
$oRQ = new RadioQuestion($oCA);
$oRQ->RSRadioQByKey($assid,$oSA->sectionRQid,1);
$index1 = 1;
$index2 = 1;
$index_color1 = 0;
$index_color2 = 0;
//---------->แสดงคำถามชนิดปลายปิด
while($oRQ->GetRecord()){
$omRQ = new RadioQuestion($oCA);
$numParrentMQ = $omRQ->RSCountParrentRQid($oRQ->RQid);
//แสดงคำถามข้อหลัก
if($index_color2%2 == 0){//EEF2FB
if($index_color1%2 == 0){
$oTD->rowStart();
}else{
$oTD->rowStart("","#E3EBF9"); //#D1DCF3
}
}else{
if($index_color1%2 == 0){
$oTD->rowStart("","#E3EBF9");
}else{
$oTD->rowStart();
}
}
$oTD->addCell("$index1","right","","","","");
$oTD->addCell("$oRQ->nameRQ","left","","","","");
//เก็บค่าของคะแนนที่จะให้เลือกใส่ array
$x = 1;
// กรณีคำถามข้อหลัีกเป็นคำถามเชิงลบ
if($oRQ->subtract == '-1'){
$oDS->RSDetailSAllDESC($oHS->HSid);
while($oDS->GetRecord()){
$scoreMRQ[$x] = $oDS->score;
$x++;
}
}else{ // กรณีคำถามข้อหลัีกเป็นคำถามเชิงลบ
$oDS->RSDetailSAll($oHS->HSid);
while($oDS->GetRecord()){
$scoreMRQ[$x] = $oDS->score;
//echo "scoreMRQ[$x] = ".$scoreMRQ[$x];
$x++;
}
}
$run1=0;
//แสดง radio หรือเป็นช่องว่าง
if($numParrentMQ == '0'){
$round = 1;
if($round == 1) {
++$RowRQ;
//echo " = ".$oRQ->RQid;
echo "<input type=\"hidden\" name=\"sectionRQid$RowRQ\" value=\"$oSA->sectionRQid\">";
echo "<input type=\"hidden\" name=\"MRQid$RowRQ\" value=\"$oRQ->RQid\">";
echo "<input type = \"hidden\" name = \"msgRQ$RowRQ\" value = \"กรุณาเลือก ส่วนที่ $indexSection ข้อ $index1 !\" size=5>";
}
while($run1!=$oHS->score_amount){
$checked = ($scoreMRQ[$round]==rand(4,5)||$scoreMRQ[$round]==5)?"checked":""; //กำหนดค่าเพื่อเลือก radio box เอง
$oTD->addCell("<input type=\"radio\" name=\"selectMRQ$RowRQ\" value=\"$scoreMRQ[$round]\" align = \"bottom\" $checked>","middle","","","","","22");
$run1++;
$round++;
}
}else{
while($run1!=$oHS->score_amount){
$oTD->addCell("","middle","","","","","22");
$run1++;
}
}
$oTD->rowEnd();
//แสดงคำถามข้อย่อย
$ocRQ = new RadioQuestion($oCA);
$ocRQ->RSCheckLevel($assid,$oRQ->RQid);
while($ocRQ->GetRecord()){
if($index_color1%2 == 0){//EEF2FB
if($index_color2%2 == 0){
$oTD->rowStart("","#E3EBF9");
}else{
$oTD->rowStart();
}
}else{
if($index_color2%2 == 0){
$oTD->rowStart();
}else{
$oTD->rowStart("","#E3EBF9");
}
}
$oTD->addCell("","left","","","","","22");
$oTD->addCell("$index1.$index2 $ocRQ->nameRQ","left","","","","","22");
//เก็บค่าของคะแนนที่จะให้เลือกใส่ array
$y = 1;
// กรณีคำถามข้อหลัีกเป็นคำถามเชิงลบ
if($ocRQ->subtract == '-1'){
$oDS->RSDetailSAllDESC($oHS->HSid);
while($oDS->GetRecord()){
$scoreSubRQ[$y] = $oDS->score;
//* echo "scoreSubRQ[$y] = ".$scoreSubRQ[$y];
$y++;
}
}else{ // กรณีคำถามข้อหลัีกเป็นคำถามเชิงลบ
$oDS->RSDetailSAll($oHS->HSid);
while($oDS->GetRecord()){
$scoreSubRQ[$y] = $oDS->score;
//echo "scoreSubRQ[$y] = ".$scoreSubRQ[$y];
$y++;
}
}
$run2=0;
//แสดง radio
$round = 1;
while($run2!=$oHS->score_amount){
if($round == 1) {
++$RowRQ;
//echo " = ".$ocRQ->RQid;
echo "<input type=\"hidden\" name=\"sectionRQid$RowRQ\" value=\"$oSA->sectionRQid\">";
echo "<input type=\"hidden\" name=\"MRQid$RowRQ\" value=\"$ocRQ->RQid\">";
echo "<input type = \"hidden\" name = \"msgRQ$RowRQ\" value = \"กรุณาเลือก ส่วนที่ $indexSection ข้อ $index1.$index2 !\" size=5>";
}
$checked = ($scoreMRQ[$round]==rand(4,5)||$scoreMRQ[$round]==5)?"checked":""; //กำหนดค่าเพื่อเลือก radio box เอง
$oTD->addCell("<input type=\"radio\" name=\"selectMRQ$RowRQ\" value=\"$scoreSubRQ[$round]\" align = \"bottom\">","middle","","","","","22");
$run2++;
$round++;
}
$oTD->rowEnd();
$index2++;
$index_color2++;
} //end while ocRQ
$index1++;
$index2 = 1;
$index_color1++;
} //end while oRQ
} //end while oSRQ
$indexSectionRQ++;
} //end if oSA->sectionRQid
/*---------------- กรณีที่เลือกเป็นคำถามชนิดปลายเปิด------------------*/
else if($oSA->sectionTQid != '0'){
$index = 1;
$oSTQ = new SectionTQ($oCA);
$oSTQ->RSSectionTQAll($assid,$oSA->sectionTQid);
while($oSTQ->GetRecord()){
$oTD->rowStart();
$oTD->addCell("<img src=\"../picture/blank1.gif\"border=\"0\">","","","7","","","22");
$oTD->rowEnd();
$oTD->rowStart();
//---------->แสดงส่วนของแบบประเมิน
$oTD->rowStart();
$oTD->addCell("<span class=\"fontMarkTD1\">ส่วนที่ $indexSection</span> : $oSTQ->topicSectionTQ","","","7","","","22");
$oTD->rowEnd();
$oTQ = new TextQuestion($oCA);
$oTQ->RSTextQByKey($assid,$oSA->sectionTQid);
while($oTQ->GetRecord()){
//-----------------------> ส่งค่า hidden ไปที่ javascript และหน้า process
++$RowTQ;
echo "<input type=\"hidden\" name=\"sectionTQid$RowTQ\" value=\"$oSA->sectionTQid\">";
echo "<input type=\"hidden\" name=\"TQid$RowTQ\" value=\"$oTQ->TQid\">";
echo "<input type = \"hidden\" name = \"msgTQ$RowTQ\" value = \"กรุณากรอกข้อมูล ส่วนที่ $indexSection ข้อ $index !\" size=5>";
$oTD->rowStart();
$oTD->addCell("$index.$oTQ->nameTQ","","","7","","","22");
$oTD->rowEnd();
$oTD->rowStart();
$oTD->addCell("<textarea name=\"textTQ$RowTQ\" cols=\"80\" rows=\"4\">-</textarea>","","","7","","","22");
$oTD->rowEnd();
$index++;
}// end while oTQ
}//end while oSTQ
} //end if oSA->sectionTQid
$indexSection++;
} // end while oSA
echo "<input type=\"hidden\" name=\"SumRQ\" value=\"$RowRQ\">";
echo "<input type=\"hidden\" name=\"SumTQ\" value=\"$RowTQ\">";
echo "<input type=\"hidden\" name=\"method\" value=\"add\">";
echo "<input type=\"hidden\" name=\"assid\" value=\"$assid\">";
echo "<input type=\"hidden\" name=\"defineid\" value=\"$defineid\">";
echo "<input type=\"hidden\" name=\"studentId\" value=\"$studentId\">";
echo "<input type=\"hidden\" name=\"courseId\" value=\"$courseId \">";
echo "<input type=\"hidden\" name=\"classId\" value=\"$classId \">";
echo "<input type=\"hidden\" name=\"section\" value=\"$section\">";
echo "<input type=\"hidden\" name=\"officerId\" value=\"$officerId\">";
echo "<input type=\"hidden\" name=\"ttId\" value=\"$ttId\">";
echo "<input type=\"hidden\" name=\"mepId\" value=\"$mepId\">";
echo "<input type=\"hidden\" name=\"sepId\" value=\"$sepId\">";
echo "<input type=\"hidden\" name=\"flag7_mustDo\" value=\"$flag7_mustDo\">";
echo "<input type=\"hidden\" name=\"flag6_mustDo\" value=\"$flag6_mustDo\">";
echo "<input type=\"hidden\" name=\"flag8_mustDo\" value=\"$flag8_mustDo\">";
echo "<input type=\"hidden\" name=\"flag0_mustDo\" value=\"$flag0_mustDo\">";
echo "<input type=\"hidden\" name=\"flag1_mustDo\" value=\"$flag1_mustDo\">";
echo "<input type=\"hidden\" name=\"flag5_mustDo\" value=\"$flag5_mustDo\">";
echo "<input type=\"hidden\" name=\"flag9_mustDo\" value=\"$flag9_mustDo\">";
echo $oTD->output();
?>
<table width="75%" border="0" align="center">
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><input type="button" name="add" value="บันทึก" onclick = "return checkalredy(this)" />
<input type="reset" name="clear" value="เคลียร์ข้อมูล">
<input type="button" name="cancel" value="ยกเลิก" onClick=" location.href = 'showFormByCourse.php?studentId=<? echo $studentId ?>&classId=<? echo $classId ?>&courseId=<? echo $courseId ?>&ttId=<? echo $ttId ?>&flag7_mustDo=<?=$flag7_mustDo;?>&flag6_mustDo=<?=$flag6_mustDo;?>&flag8_mustDo=<?=$flag8_mustDo;?>&flag0_mustDo=<?=$flag0_mustDo;?>&flag1_mustDo=<?=$flag1_mustDo;?>&flag5_mustDo=<?=$flag5_mustDo;?>&flag9_mustDo=<?=$flag9_mustDo;?>'"></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<p> </p>
</form>
</fieldset>
</td>
</tr>
</table>
<form name="silent" id="silent" style="margin:0px; padding: 0px;" method="post"></form>
<?php
showFooter();
?>
|