Viewing file: 2553-06-29-1.1.04-processDefineProgram.php (2.59 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "../global1.php";
include_once "../../class/clsConnection.php";
include_once "../../class/clsDB.php";
include_once "../class/clsDefineAssessment.php";
include_once "../class/clsHoldProgramTmp.php";
include_once "../class/clsHoldProgram.php";
include_once "../link/function.php";
$oC = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB_EASS'], $GLOBALS['USER_EASS'], $GLOBALS['PASSWORD_EASS']);
$oDA = new DefineAssessment($oC);
$oHPTmp = new HoldProgramTmp($oC);
$oHP = new HoldProgram($oC);
if($link==main){
//ลบข้อมูลในตาราง HoldCourseTmp ทั้งหมด
$oHPTmp->DeleteAll();
if($menu == 'linkBackMenu'){
echo "<meta http-equiv='refresh' content='0; URL=index.php?mm=1'>";
}else{
//$menu == 'linkSubMenu'
//processDefineSomeCourse.php?flag=1&menu='linkSubMenu'
echo "<meta http-equiv='refresh' content='0; URL=addDefineProgram.php'>";
}
}else{
//$maxNoAss = $oDA->getMaxNoAss($acadYear,$flag);
$maxNoAss = $oDA->getMaxNoAssByAcadSemFlag($acadYear,$semester,$flag);
if($method=="add"){
$oDA->AddNew();
$oDA->defineid=$defineid;
$oDA->assid=$assid;
$oDA->startDate=splitDateForm($startDate,"/");
$oDA->endDate=splitDateForm($endDate,"/");
$oDA->acadYear=$acadYear;
$oDA->semester=$semester;
$oDA->noAss=$maxNoAss + 1;
$oDA->flag=$flag;
$oDA->closeDate=splitDateForm($closeDate,"/");
$oDA->isPreAssess=0;
$oDA->Save();
//echo "Defineid =".$oDA->defineid;
//ดึงข้อมูลจากตาราง HoldCourseTmp มาเก็บใส่ใน HoldCourse
$oHPTmp->RSHoldProgramTmpOrderByProgramId();
while($oHPTmp->GetRecord()){
$oHP->AddNew();
$oHP->defineid=$oDA->defineid;
$oHP->programId=$oHPTmp->programId;
$oHP->stdYearAss=$oHPTmp->stdYearAss;
$oHP->Save();
}
//ลบข้อมูลในตาราง HoldCourseTmp ทั้งหมด
$oHPTmp->DeleteAll();
}else if($method=="edit"){
$oDA->SearchByKey($defineid, $acadYear, $semester, $noAss);
$oDA->GetRecord();
$oDA->Edit();
$oDA->defineid=$defineid;
$oDA->assid=$assid;
$oDA->startDate=splitDateForm($startDate,"/");
$oDA->endDate=splitDateForm($endDate,"/");
$oDA->acadYear=$acadYear;
$oDA->semester=$semester;
$oDA->noAss=$noAss;
$oDA->flag=$flag;
$oDA->closeDate=splitDateForm($closeDate,"/");
$oDA->isPreAssess=0;
$oDA->Save();
}else if($method=="delete"){
$oDA->SearchByKey($defineid, $acadYear, $semester, $noAss);
$oDA->GetRecord();
$oDA->Delete();
$oHP->SearchByDefineid($defineid);
while($oHP->GetRecord()){
$oHP->DeleteByDefineid();
}
}
echo "<meta http-equiv='refresh' content='0; URL=addDefineProgram.php'>";
}
//$oDA->Close();
//$oC->Disconnect();
|