Viewing file: reportDataRQCourseTep2_excel11111.php (14.31 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
header('Content-type: application/xls');
header('Content-Disposition: attachment; filename="testing1.xls"');
include_once "../../class/clsDB.php";
include_once "../../class/clsConnection.php";
include_once "../global.php";
include_once "../link/function.php";
include_once "../class/clsReg_SysSemesterDes.php";
include_once "../class/clsReg_Program.php";
include_once "../class/clsRegistration.php";
include_once "../class/clsCourseAssess.php";
include_once "../class/clsHoldCourse.php";
include_once "../class/clsClassAssess.php";
include_once "../class/clsClassOpenForAssess.php";
include_once "../class/clsClassInStructorAssess.php";
include_once "../class/clsOfficerAssess.php";
include_once "../class/clsDefineAssessment.php";
include_once "../class/clsAssessForm.php";
include_once "../class/clsDoAssessment.php";
include_once "../class/clsResultRQ.php";
include_once "../class/clsSectionAll.php";
include_once "../class/clsSectionRQ.php";
include_once "../class/clsHeaderQuestion.php";
include_once "../class/clsHeaderScore.php";
include_once "../class/clsDetailScore.php";
include_once "../class/clsRadioQuestion.php";
include_once "../class/clsSectionAll.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']);
$oReg = new Registration($oCA);
$oCourse = new CourseAssess($oCA);
$oClass = new ClassAssess($oCA);
$oClsOpen = new ClassOpenForAssess($oCA);
$oCIS = new ClassInStructorAssess($oCA);
$oOFA = new OfficerAssess($oCA);
$oHC = new HoldCourse($oCA);
$oAF = new AssessForm($oCA);
$oDo = new DoAssessment($oCA);
$oCourse->SearchByKey($courseId);
$oCourse->GetRecord();
$oClass->SearchByKey($classId);
$oClass->GetRecord();
$oProg = new Program($oCR);
$numAllCourseReg=0;
$oReg->SearchRegClassIdByClassId($classId);
while($oReg->GetRecord()){
if($officerId == 0){ // กรณีประเมินภาพรวมรายวิชา officer == 0
$numAllCourseReg++;
}else{
$oCIS->SearchByClassIdOfficerId($oReg->classId,$officerId);
if($oCIS->GetRecord()){
$numAllCourseReg++;
}
}
}
//echo "numAllCourseReg = ".$numAllCourseReg;
$numCourseDoAss = 0;
if($officerId == 0){
$oDo->SearchByDefineIdClassId($defineid,$classId);
while($oDo->GetRecord()){
$numCourseDoAss++;
}
}else{
$oDo->SearchByDefineIdClassIdOfficeridSection($defineid,$classId,$officerId,$oClass->section);
while($oDo->GetRecord()){
$numCourseDoAss++;
}
}
//echo "numCourseDoAss = ".$numCourseDoAss;
$oAF->RSAssessFormByAssid($assid);
$oAF->GetRecord();
$oSse = new SysSemesterDes($oCR);
$oSse->SearchByKey($semester);
$oSse->GetRecord();
$oDA = new DefineAssessment($oCA);
$oDA->SearchByDefineid($defineid);
$oDA->GetRecord();
//ค้นหาคำถามปลายเปิดในแบบประเมินนี้ sectionTQid = 1
$oSA = new SectionAll($oCA);
$CntSRQid = $oSA->RSCountSectionRQid($assid);
$oRRQ = new ResultRQ($oCA);
?>
<title>รายงานผลประเมินจำแนกตามหัวข้อการประเมิน (เฉพาะคำถามปลายปิด)</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<div id="tabmargin">
<form name="pc" method="post" action="<?php echo $PHP_SELF;?>" enctype="multipart/form-data">
<div align="center">
</div><br>
<table width="95%" align="center" border="0">
<tr>
<td>
<?
if($CntSRQid > 0){
$oSA = new SectionAll($oCA);
$numSection= $oSA->RSCountSectionAll($assid);
$oSA->RSByKeyAss($assid);
$i = 1;
$indexSection = 1;
while ($oSA->GetRecord()){
/*---------------- กรณีที่เลือกเป็นคำถามชนิดปลายปิด------------------*/
if($oSA->sectionRQid != '0'){
//สร้าง 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();
?>
<table width="100%">
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
<tr>
<td colspan="18" valign="top"><font size="2"><span class = "fontMarkTD1">
<? if($numSection == '1') { echo "คำอธิบาย"; } else { echo "ส่วนที่ ".$indexSection; }?>
</span> : </font><font size="2"><? echo $oSRQ->topicSectionRQ ?></font></td>
</tr>
</table>
<table width="100%" border="1">
<tr bgcolor="#CFCFCF">
<td width="68%" rowspan="3" align="center"><font size="2"><b>หัวข้อการประเมิน</b></font></td>
<td width="16%" colspan="<? echo $oHS->score_amount*2 ?>" align="center"><font size="2"><b> คะแนนการประเมิน </b></font></td>
<td width="6%" align="center" rowspan="3"><font size="2"><b>ค่าเฉลี่ย</b></font></td>
<td width="6%" align="center" rowspan="3"><font size="2"><b>S.D.</b></font></td>
</tr>
<tr>
<? $oDS = new DetailScore($oCA);
$oDS->RSDetailSAll($oHS->HSid);
while($oDS->GetRecord()){
?>
<td height="23" colspan="2" align="center" bgcolor="#CFCFCF"><font size="2"><b>
<? echo $oDS->score ?> </b></font></td>
<? }
?>
</tr>
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_7"];?>">
<? for($i=0;$i<$oHS->score_amount;$i++){ ?>
<td height="22" align="center" bgcolor="#CFCFCF"><font size="2"><font size="2"><b>จำนวน</b></font></font></td>
<td width="4%" height="22" align="center" bgcolor="#CFCFCF"><font size="2"> <b>%</b> </font></td>
<? } ?>
</tr>
<?
$index1 = 1; $index2 = 1;
$index_color1 = 1; $index_color2 = 1;
$CntSubQ = 0;
/*--------------------------------------------------------- คำนวนส่วนของคำถามข้อหลัก -------------------------------------------------------*/
$oRQ = new RadioQuestion($oCA);
$oRQ->RSRadioQByKey($assid,$oSA->sectionRQid,1);
while($oRQ->GetRecord()){
$oCntRQ = new RadioQuestion($oCA);
$CntSubQ = $oCntRQ->RSCountSubRQid($assid,$oRQ->RQid,'2');
if($index_color2%2 == 0){//EEF2FB
if($index_color1%2 == 0){
echo '<tr bgcolor="'.$GLOBALS["COLOR_BG_TD_5"].'">';
}else{
echo '<tr bgcolor="'.$GLOBALS["COLOR_BG_TD_4"].'">';
}
}else{
if($index_color1%2 == 0){
echo '<tr bgcolor="'.$GLOBALS["COLOR_BG_TD_4"].'">';
}else{
echo '<tr bgcolor="'.$GLOBALS["COLOR_BG_TD_5"].'">';
}
}
?>
<td><font size="2"><? echo $index1."." ?> <? echo $oRQ->nameRQ ?></font>
<? if($oRQ->subtract == -1) { ?><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_7"]; ?>"> * </font> <? } ?>
</td>
<?
if($oRQ->subtract == -1){
$oDS->RSDetailSAllDESC($oHS->HSid);
}else{
$oDS->RSDetailSAll($oHS->HSid);
}
while($oDS->GetRecord()){
$countPointRQ = $oRRQ->CountPointJoinByRQidDefineidOfficerIdClassIdPoint($oRQ->RQid,$defineid,$officerId,$classId,$oDS->score);
//echo "<br> score_amount = ".$oDS->score;
//echo "<br> countPointRQ = ".$countPointRQ;
$AvgCountPointRQ = ($countPointRQ/$numCourseDoAss)*100;
?>
<td align="center">
<? if(($CntSubQ == 0)&&($numCourseDoAss > '0')) echo $countPointRQ ?>
<? if(($CntSubQ == '0')&&($numCourseDoAss == '0')) echo "-"; ?>
</td>
<td align="center"><font size="2">
<? if(($CntSubQ == 0)&&($numCourseDoAss > '0')) printf ("%.2f",$AvgCountPointRQ); ?>
<? if(($CntSubQ == '0')&&($numCourseDoAss == '0')) echo "-"; ?>
</font></td>
<?
} // end while oDS
if($CntSubQ == 0){
//คิดค่าเฉลี่ยและค่า sd ของคำถามข้อหลัก
$oRRQ->SearchResultIXbarSDEachRQidByAcadSemDefineidOfficerIdClassIdSectionRQid($acadYear,$semester,$defineid,$officerId,$classId,$oSA->sectionRQid,$oRQ->RQid);
if($oRRQ->GetRecord()){
$xbar = $oRRQ->xbar;
$sd = $oRRQ->sd;
}
}
?>
<td align="center">
<?
if($xbar != 0) echo number_format($xbar,2);?>
<? if(($CntSubQ == 0)&&($numCourseDoAss == 0)) echo "-"; ?>
</td>
<td align="center">
<? if($xbar != 0) echo number_format($sd,2); ?>
<? if(($CntSubQ == 0)&&($numCourseDoAss == 0)) echo "-"; ?>
</td>
</tr>
<? /*--------------------------------------------------------- คำนวนส่วนของคำถามข้อย่อย-------------------------------------------------------*/
$sumPointSubRQ = 0;
$sumAvgPointSubRQ = 0;
$ocRQ = new RadioQuestion($oCA);
$ocRQ->RSCheckLevel($assid,$oRQ->RQid);
while($ocRQ->GetRecord()){
if($index_color1%2 == 0){//EEF2FB
if($index_color2%2 == 0){
echo '<tr bgcolor="'.$GLOBALS["COLOR_BG_TD_4"].'">';
}else{
echo '<tr bgcolor="'.$GLOBALS["COLOR_BG_TD_5"].'">';
}
}else{
if($index_color2%2 == 0){
echo '<tr bgcolor="'.$GLOBALS["COLOR_BG_TD_5"].'">';
}else{
echo '<tr bgcolor="'.$GLOBALS["COLOR_BG_TD_4"].'">';
}
}
?>
<td><? echo " ".$index1.".".$index2 ?>
<? echo $ocRQ->nameRQ ?>
<? if($ocRQ->subtract == -1) { ?><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_7"]; ?>"> * </font> <? } ?>
</td>
<?
if($ocRQ->subtract == -1){
$oDS->RSDetailSAllDESC($oHS->HSid);
}else{
$oDS->RSDetailSAll($oHS->HSid);
}
while($oDS->GetRecord()){
$countPointRQ = $oRRQ->CountPointJoinByRQidDefineidOfficerIdClassIdPoint($ocRQ->RQid,$defineid,$officerId,$classId,$oDS->score);
//echo "<br> score_amount = ".$oDS->score;
//echo "<br> countPointRQ = ".$countPointRQ;
$AvgCountPointRQ = ($countPointRQ/$numCourseDoAss)*100;
?>
<td align="center"><? if($numCourseDoAss > '0') echo $countPointRQ ?>
<? if($numCourseDoAss == '0') echo "-"; ?>
</td>
<td align="center"><font size="2"><? if($numCourseDoAss > '0') printf ("%.2f",$AvgCountPointRQ); ?>
<? if($numCourseDoAss == '0') echo "-"; ?>
</font></td>
<?
} // end while oDS
//คิดค่าเฉลี่ยและค่า sd ขอคำถามข้อย่อย
$oRRQ->SearchResultIXbarSDEachRQidByAcadSemDefineidOfficerIdClassIdSectionRQid($acadYear,$semester,$defineid,$officerId,$classId,$oSA->sectionRQid,$ocRQ->RQid);
if($oRRQ->GetRecord()){
$xbarSub = $oRRQ->xbar;
$sdSub = $oRRQ->sd;
}
?>
<td align="center">
<? if($xbarSub != 0) echo number_format($xbarSub,2); ?>
<? if($numCourseDoAss == '0') echo "-"; ?>
</td>
<td align="center">
<? if($xbarSub != 0) echo number_format($sdSub,2);?>
<? if($numCourseDoAss == '0') echo "-"; ?>
</td>
</tr>
<? $index2++;
$index_color2++;
} //end while ocRQ
$index1++;
$index2 = 1;
$index_color1++;
} //end while oRQ
if(($indexDoAss-1) == 0){ ?>
<tr bgcolor="<?php echo $GLOBALS['COLOR_BG_TD_5'];?>">
<td colspan="<? echo $mergeAll+1?>" align="center"> <font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>">**
ไม่พบข้อมูล **</font> </td>
</tr>
<? } ?>
</table><br>
<? } //end while oSRQ
} // end if oSA
$indexSection++;
} //end while oSA
?>
<table width="100%" border="0" align="center">
<tr>
<td colspan="17"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_5"];?>"><b>หมายเหตุ
:</b> * หมายถึงเป็นคำถามเชิงลบ โดยกรณีที่เป็นคำถามเชิงลบในข้อนั้นๆ
ค่าเฉลี่ยและค่า S.D. จะคำนวณโดยกลับค่าให้แล้ว </font><font size="2"> </font></td>
</tr>
<tr>
<td height="24"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<? } else { ?>
<table width="100%">
<tr bgcolor="<?php echo $GLOBALS['COLOR_BG_TD_5'];?>">
<td align="center"> <font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>">** ไม่พบข้อมูลเนื่องจากแบบประเมินที่สร้างไม่มีส่วนของคำถามปลายปิด **</font>
</td>
</tr>
</table>
<? } ?>
</td>
</tr>
</table>
</form><br>
</div>
</body>
|