Viewing file: clsForceAssess.php (8.93 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
class ForceAssess {
function GetDoAssessByStCodeAndAcYAndSe($studentCode, $acadYear, $semester, $programId){
include_once "link/function.php";
include_once "class/clsReg_Period.php";
include_once "class/clsStudentAssess.php";
include_once "class/clsRegistration.php";
include_once "class/clsClassAssess.php";
include_once "class/clsClassInStructorAssess.php";
include_once "class/clsDefineAssessment.php";
include_once "class/clsHoldCourse.php";
include_once "class/clsDoAssessment.php";
include_once "class/clsCourseAssess.php";
include_once "class/clsHoldStudent.php";
include_once "class/clsDoAssessmentHStd.php";
include_once "class/clsAssessForm.php";
include_once "class/clsHoldProgram.php";
include_once "class/clsTimeTableAssess.php";
include_once "class/clsOfficerAssess.php";
include_once "class/clsWeekDateAssess.php";
sendRequest();
$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']);
$orPr = new Period($oCR);
$oStd = new StudentAssess($oCA);
$oReg = new Registration($oCA);
$oClass = new ClassAssess($oCA);
$oCIS = new ClassInStructorAssess($oCA);
$oDA = new DefineAssessment($oCA);
$oDo = new DoAssessment($oCA);
$oHC = new HoldCourse($oCA);
$oCourse = new CourseAssess($oCA);
$oHStd = new HoldStudent($oCA);
$oDoHStd = new DoAssessmentHStd($oCA);
$oAF = new AssessForm($oCA);
$oHP = new HoldProgram($oCA);
$oTTA = new TimeTableAssess($oCA);
$oTTA2 = new TimeTableAssess($oCA);
$oOFA = new OfficerAssess($oCA);
$oDA2 = new DefineAssessment($oCA);
$oWDA = new WeekDateAssess($oCA);
$nowDate = getNowDateTh();
$now = GetNowDate();
list($y, $m, $d) = split('[-]', $now);
$now2=$d."-".$m."-".$y;
//$oAc->RSAcad();
//$oAc->GetRecord();
$oStd->SearchByStCodeAndStudying($studentCode);
//return $oStd->lastSql;
$oStd->GetRecord();
//$oPg->RSProgramByName($oStd->programName);
//$oPg->GetRecord();
$showFlag = 0;
$noAssFlag = 1; //ไม่มีแบบประเมินค้าง
$oReg->RSClassIdByStdId($oStd->studentId);
while($oReg->GetRecord()) {
$doAssFlag = 1;
$oClass->SearchByKey($oReg->classId);
$oClass->GetRecord();
// case 0 & case 1
$flag0_mustDo = 0;
$flag1_mustDo = 0;
$oCIS->SearchByClassIdGroupClassIdOfficerId($oReg->classId);
while($oCIS->GetRecord()) {
$oDA->RSByFlagAndBetweenSCDate(0, $nowDate);
while($oDA->GetRecord()) {
if($oDA->acadYear==$oClass->acadYear && $oDA->semester==$oClass->semester ){
$chAssHold = $oDo->CountCheckAssessment($oDA->defineid, $oStd->studentId,$oCIS->officerId,$oReg->classId,$oClass->section);
if($chAssHold == 0) {
$doAssFlag = 0;
$noAssFlag = 0;
$flag0_mustDo =$flag0_mustDo+1;
}
}
} // end while $oDA
$oDA->RSDefineidByFlagBetweenSCDateClId(1,$nowDate,$oReg->classId);
while($oDA->GetRecord()) {
$oDA2->SearchByDefineid($oDA->defineid);
$oDA2->GetRecord();
if($oDA2->acadYear==$oClass->acadYear && $oDA2->semester==$oClass->semester ){
$chAssHold = $oDo->CountCheckAssessment($oDA2->defineid, $oStd->studentId,$oCIS->officerId,$oReg->classId,$oClass->section);
if($chAssHold == 0) {
$doAssFlag = 0;
$noAssFlag = 0;
$flag1_mustDo =$flag1_mustDo+1;
}
}
} // end while $oDA
} // end while $oCIS
// case 5
$flag5_mustDo = 0;
$oDA->RSByFlagAndBetweenSCDate(5, $nowDate);
while($oDA->GetRecord()) {
if($oDA->acadYear==$oClass->acadYear && $oDA->semester==$oClass->semester ){
$chAssHold = $oDo->CountCheckAssessment3($oDA->defineid, $oStd->studentId,$oReg->classId,$oClass->section);
if($chAssHold == 0) {
$doAssFlag = 0;
$noAssFlag = 0;
$flag5_mustDo =$flag5_mustDo+1;
}
}
} // end while $oDA
// case 6
$flag6_all = 0;
$flag6_mustDo =0;
$oDA->RSDefineidByFlagBetweenSCDateClId(6,$nowDate,$oReg->classId);
while($oDA->GetRecord()){
$flag6_all =$flag6_all+1;
$oDA2->SearchByDefineid($oDA->defineid);
$oDA2->GetRecord();
$oAF->SearchByKey($oDA2->assid);
$oAF->GetRecord();
if($oDA2->acadYear==$oClass->acadYear && $oDA2->semester==$oClass->semester ){
$chAssHold = $oDo->CountCheckAssessment3($oDA2->defineid, $oStd->studentId,$oReg->classId,$oClass->section);
if($chAssHold ==0){
$doAssFlag = 0;
$noAssFlag = 0;
$flag6_mustDo =$flag6_mustDo+1;
}
}
}
//case 7
$flag7_Do = 0;
$flag7_mustDo = 0;
$oDA->RSAssidByFlagBetweenSCDateClId(7,$nowDate,$oReg->classId);
while($oDA->GetRecord()){
$oAF->SearchByKey($oDA->assid);
$oAF->GetRecord();
$oHC->RSAssessFlag7ByAssid($oDA->assid,$nowDate,$oReg->classId);
$i =1;
while($oHC->GetRecord()){
$oDA2->SearchByDefineid($oHC->defineid);
$oDA2->GetRecord();
$oTTA->SearchTimeTableByttId($oHC->ttId);
$oTTA->GetRecord();
$oOFA->SearchByKey($oTTA->ttOfId);
$oOFA->GetRecord();
if($oDA2->acadYear==$oClass->acadYear && $oDA2->semester==$oClass->semester ){
$chAssHold = $oDo->CountCheckAssessment2($oDA2->defineid,$oStd->studentId,$oTTA->ttOfId,$oTTA->ttId,$oClass->section);
$show=1;
$today=getWeekDay($now2);
$oWDA->searchWeekByScDate($now);
$oWDA->GetRecord();
if($chAssHold != 0){
$show=0;
// $flag7_Do = $flag7_Do+1;
}elseif($oDA2->isPreAssess==0 && $acadYear <= $oDA2->acadYear){
$curTime = date("H:i:s");
$orPr->SearchBetweenTime($curTime);
$orPr->GetRecord();
if(($oWDA->wdAcYWeekNo < $oTTA->ttWdAcYWeekNo ) || ($oWDA->wdAcYWeekNo==$oTTA->ttWdAcYWeekNo && $today <= $oTTA->ttDyId && $orPr->period <= $oTTA->ttToPr ) )
$show=0;
}
if($show){
$flag7_mustDo = $flag7_mustDo+1;
}// end if show
}// end if oDA2
}// loop oHC
}// loop oDA
if($flag7_mustDo!=0){
$doAssFlag = 0;
$noAssFlag = 0;
}
//End case 7
//case 8
$flag8_all = 0;
$flag8_mustDo =0;
$oDA->RSAssidByFlagBetweenSCDateClId(8,$nowDate,$oReg->classId);
while($oDA->GetRecord()){
$oHC->RSAssessFlag8ByAssidSCDateClId($oDA->assid,$nowDate,$oReg->classId);
while($oHC->GetRecord()){
$oDA2->SearchByDefineid($oHC->defineid);
$oDA2->GetRecord();
$oOFA->SearchByKey($oHC->officerId);
$oOFA->GetRecord();
if($oDA2->acadYear==$oClass->acadYear && $oDA2->semester==$oClass->semester ){
$show=1;
$chAssHold = $oDo->CountCheckAssessment($oHC->defineid,$oStd->studentId,$oHC->officerId,$oReg->classId,$oClass->section);
if($chAssHold != 0){
$show=0;
}elseif($oDA2->isPreAssess==0 && $acadYear <= $oDA2->acadYear){
$oTTA->SearchMaxWeekByClIdOfId($oReg->classId,$oHC->officerId);
$oTTA->GetRecord();
$oTTA2->SearchByClassIdWeekNoOrderMaxDyId($oReg->classId,$oTTA->ttWdAcYWeekNo);
$oTTA2->GetRecord();
$today=getWeekDay($now2);
$oWDA->searchWeekByScDate($now);
$oWDA->GetRecord();
$curTime = date("H:i:s");
$orPr->SearchBetweenTime($curTime);
$orPr->GetRecord();
if(($oWDA->wdAcYWeekNo < $oTTA->ttWdAcYWeekNo ) || ($oWDA->wdAcYWeekNo==$oTTA->ttWdAcYWeekNo && $today <= $oTTA2->ttDyId && $orPr->period <= $oTTA2->ttToPr ) )
$show=0;
}
if($show){
$flag8_mustDo = $flag8_mustDo+1;
}
}
} //while oHC
} //while oDA
if($flag8_mustDo!=0){
$doAssFlag = 0;
$noAssFlag = 0;
}
} // end while $oReg
// case 2
$showGFlag2 = 0;
$oDA->RSByFlagAndBetweenSCDate(2, $nowDate);
while($oDA->GetRecord()) {
$doAssFlag = 1;
$oHStd->RSHoldStudentByDfIdAndStY($oDA->defineid, $oStd->studentYear);
if($oHStd->GetRecord()) {
if(!$oDoHStd->CountCheckAssessment($oDA->defineid, $oStd->studentId)) {
$doAssFlag = 0;
$noAssFlag = 0;
}
} // end if $oHStd
} // end while $oDA
// case 3
$showGFlag3 = 0;
$oDA->RSByFlagAndBetweenSCDate(3, $nowDate);
while($oDA->GetRecord()) {
$doAssFlag = 1;
$oHP->SearchByDefineIdProgramIdStdYearAss($oDA->defineid, $programId, $oStd->studentYear);
if($oHP->GetRecord()) {
if(!$oDoHStd->CountCheckAssessment($oDA->defineid, $oStd->studentId)) {
$doAssFlag = 0;
$noAssFlag = 0;
}
} // end if $oHStd
} // end while $oDA
return $noAssFlag;
} // end function
} // end class
?>
|