Viewing file: assessFormPj.php (14.39 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "template.php";
showHeader();
?>
<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="703" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="724">
<fieldset>
<form name="FormAss" method="post" action = "processAssFormPj.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">ทำแบบประเมินโครงการ</font></legend>
<br>
<?
include_once "../link/function.php";
include_once "../class/clsReg_EregisConfig.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";
/*
include_once "../class/clsStudentAssess.php";
include_once "../class/clsReg_StudentMaster.php";
include_once "../class/clsReg_StudentStatus.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']);
$oAF = new AssessForm($oCA);
$oAF->RSAssessFormByAssid($assid);
$oAF->GetRecord();
$oECon = new EregisConfig($oCR);
$oECon->RSEregisConfig();
$oECon->GetRecord();
$oDA = new DefineAssessment($oCA);
$oDA->SearchByDefineid($defineid);
$oDA->GetRecord();
$studentYear = $stdYear;
/*
$oStd = new StudentAssess($oCA);
$oStd->SearchByKey($studentId);
$oStd->GetRecord();
$oSm = new StudentMaster($oCR);
$oSm->SearchByKey($studentId);
$oSm->GetRecord();
//$oSs = new StudentStatus($oCR);
//$studentYear = $oSs->CalStYByStIdAndAcY($studentId,$oDA->acadYear,$oSm->admitAcadYear);
// echo '$oDA->acadYear : '.$oDA->acadYear.'<br>';
// echo '$oStd->studentYear : '.$oStd->studentYear.'<br>';
// echo '$studentYear : '.$studentYear.'<br>';
*/
?>
<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="655" border="0" align="center" cellpadding="0" cellspacing="1" >
<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\">","","","","","","18");
$oTD->rowEnd();
$oTD->rowStart();
//---------->แสดงส่วนของแบบประเมิน
$merges = $oHS->score_amount+2;
$oTD->rowStart();
$oTD->addCell("<span class=\"fontMarkTD1\">ส่วนที่ $indexSection</span> : $oSRQ->topicSectionRQ","","","$merges","","","18");
$oTD->rowEnd();
//---------->แสดงข้อความส่วนหัวของคำถาม และข้อความส่วนหัวของระดับคะแนน
$oTD->rowStart();
$oTD->addCell("<span class=\"TDradioQuestion\">$oHQ->HQtext</span>","center","#3366cc","2","2","","18");
$oTD->addCell("<span class=\"TDradioQuestion\">$oHS->HStext</span>","center","#3366cc","$oHS->score_amount","","","18");
$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","18");
}
$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){
$oTD->addCell("<input type=\"radio\" name=\"selectMRQ$RowRQ\" value=\"$scoreMRQ[$round]\" align = \"bottom\">","middle","","","","","18");
$run1++;
$round++;
}
}else{
while($run1!=$oHS->score_amount){
$oTD->addCell("","middle","","","","","18");
$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","","","","","18");
$oTD->addCell("$index1.$index2 $ocRQ->nameRQ","left","","","","","18");
//เก็บค่าของคะแนนที่จะให้เลือกใส่ 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>";
}
$oTD->addCell("<input type=\"radio\" name=\"selectMRQ$RowRQ\" value=\"$scoreSubRQ[$round]\" align = \"bottom\">","middle","","","","","18");
$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","","","18");
$oTD->rowEnd();
$oTD->rowStart();
//---------->แสดงส่วนของแบบประเมิน
$oTD->rowStart();
$oTD->addCell("<span class=\"fontMarkTD1\">ส่วนที่ $indexSection</span> : $oSTQ->topicSectionTQ","","","7","","","18");
$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","","","18");
$oTD->rowEnd();
$oTD->rowStart();
$oTD->addCell("<textarea name=\"textTQ$RowTQ\" cols=\"80\" rows=\"4\"></textarea>","","","7","","","18");
$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=\"pjid\" value=\"$pjid\">";
echo "<input type=\"hidden\" name=\"stdYearAss\" value=\"$stdYear\">";
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 = 'startPageAss.php'"></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<p> </p>
</form>
</fieldset>
</td>
</tr>
</table>
<?php
showFooter();
?>
|