Viewing file: 2552-05-19-1.0.02-processDefineStd.php (2.18 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/clsHoldStudent.php";
include_once "../link/function.php";
$oC = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB_EASS'], $GLOBALS['USER_EASS'], $GLOBALS['PASSWORD_EASS']);
$oDA = new DefineAssessment($oC);
$HStd = new HoldStudent($oC);
$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();
for($i=1;$i<=4;$i++){
if($stdYearAss[$i] != ""){
$HStd->AddNew();
$HStd->HStdid=$HStdid;
$HStd->defineid=$oDA->defineid;
$HStd->stdYearAss=$stdYearAss[$i];
$HStd->Save();
}
}
}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();
$HStd->SearchByDefineid($defineid);
while($HStd->GetRecord()){
$HStd->DeleteByDefineid();
}
for($i=1;$i<=4;$i++){
if($stdYearAssEdit[$i] != ""){
$HStd->AddNew();
$HStd->HStdid=$HStdid;
$HStd->defineid=$oDA->defineid;
$HStd->stdYearAss=$stdYearAssEdit[$i];
$HStd->Save();
}
}
}else if($method=="delete"){
$oDA->SearchByKey($defineid, $acadYear, $semester, $noAss);
$oDA->GetRecord();
$oDA->Delete();
$HStd->SearchByDefineid($defineid);
while($HStd->GetRecord()){
$HStd->DeleteByDefineid();
}
}
echo "<meta http-equiv='refresh' content='0; URL=addDefineStd.php'>";
//$HStd->Close();
//$oC->Disconnect();
?>
|