Viewing file: processSectionAll.php (4.34 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "../global1.php";
include_once "../../class/clsDB.php";
include_once "../../class/clsConnection.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";
$oC = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB_EASS'], $GLOBALS['USER_EASS'], $GLOBALS['PASSWORD_EASS']);
//-------------------------For SectionAll----------------------
$obj = new SectionAll($oC);
if($method=="add"){
$obj->AddNew();
$obj->sectionid=$sectionid;
$obj->assid=$assid;
$obj->sectionRQid=$sectionRQid;
$obj->sectionTQid=$sectionTQid;
$obj->sequence=$sequence;
$obj->Save($typeQuestion);
echo "<meta http-equiv='refresh' content='0; URL=createForm.php?assid=$assid;'>";
}else if($method=="edit"){
$obj->SearchByKey();
$obj->GetRecord();
$obj->Edit();
$obj->sectionid=$sectionid;
$obj->assid=$assid;
$obj->sectionRQid=$sectionRQid;
$obj->sectionTQid=$sectionTQid;
$obj->sequence=$sequence;
$obj->Save();
}else if($method=="delete"){
if($typeQuestion == '1'){
$obj->SearchByKeySectionRQid($sectionRQid);
$obj->GetRecord();
$obj->DeleteSABySectionRQid();
}else if($typeQuestion == '2'){
$obj->SearchByKeySectionTQid($sectionTQid);
$obj->GetRecord();
$obj->DeleteSABySectionTQid();
}
}
//---------------------For SectionRQ --------------------------
if($typeQuestion == '1'){ //ทำเมื่อชนิดของแบบประเมินเป็นแบบปลายปิด
$obj = new SectionRQ($oC);
if($method=="add"){
$obj->AddNew();
$obj->sectionRQid=$sectionRQid;
$obj->assid=$assid;
$obj->topicSectionRQ=$topicSectionRQ;
$obj->sequenceRQ=$sequenceRQ;
$obj->Save();
echo "<meta http-equiv='refresh' content='0; URL=createForm.php?assid=$assid;'>";
}else if($method=="edit"){
$obj->SearchByKey($sectionRQid);
$obj->GetRecord();
$obj->Edit();
$obj->sectionRQid=$sectionRQid;
$obj->assid=$assid;
$obj->topicSectionRQ=$topicSectionRQ;
$obj->sequenceRQ=$sequenceRQ;
$obj->Save();
}else if($method=="delete"){
$obj->SearchByKey($sectionRQid);
$obj->GetRecord();
$obj->Delete();
//------------For RadioQuesiton-------------ลบคำถามชนิดปลายปิด
$oRQ = new RadioQuestion($oC);
$oRQ->SearchByKeySectionRQid($sectionRQid);
$oRQ->GetRecord();
$oRQ->DeleteRQBySectonRQid();
//------------For HeaderQuestion--------------ลบคำถามข้อความหัวตารางคำถาม
$oHQ = new HeaderQuestion($oC);
$oHQ->SearchByKeySectionRQid($sectionRQid);
$oHQ->GetRecord();
$oHQ->DeleteRQBySectonRQid();
//------------For HeaderScore--------------ลบคำถามข้อความหัวตารางระดับคะแนน
$oHS = new HeaderScore($oC);
$oHS->SearchByKey($oHQ->HSid);
$oHS->GetRecord();
$oHS->Delete();
//------------For DetailScore--------------ลบคำถามข้อความหัวตารางย่อยระดับคะแนน
$oDS = new DetailScore($oC);
for($i=0; $i<$oHS->score_amount; $i++){
$oDS->SearchByKeyHSid($oHQ->HSid);
$oDS->GetRecord();
$oDS->Delete();
}
}
echo "<meta http-equiv='refresh' content='0; URL=createForm.php?assid=$assid;'>";
//---------------------For SectionTQ--------------------------
}else if($typeQuestion == '2'){ //ทำเมื่อชนิดของแบบประเมินเป็นแบบปลายเปิด
$obj = new SectionTQ($oC);
if($method=="add"){
$obj->AddNew();
$obj->sectionTQid=$sectionTQid;
$obj->assid=$assid;
$obj->topicSectionTQ=$topicSectionTQ;
$obj->sequenceTQ=$sequenceTQ;
$obj->Save();
echo "<meta http-equiv='refresh' content='0; URL=createForm.php?assid=$assid;'>";
}else if($method=="edit"){
$obj->SearchByKey($sectionTQid);
$obj->GetRecord();
$obj->Edit();
$obj->sectionTQid=$sectionTQid;
$obj->assid=$assid;
$obj->topicSectionTQ=$topicSectionTQ;
$obj->sequenceTQ=$sequenceTQ;
$obj->Save();
}else if($method=="delete"){
$obj->SearchByKey($sectionTQid);
$obj->GetRecord();
$obj->Delete();
//------------For TextQuesiton-------------ลบคำถามชนิดปลายเปิด
$oTQ = new TextQuestion($oC);
$oTQ->SearchByKeySectionTQid($sectionTQid);
$oTQ->GetRecord();
$oTQ->DeleteTQBySectonTQid();
}
echo "<meta http-equiv='refresh' content='0; URL=createForm.php?assid=$assid;'>";
}
//$obj->Close();
//$oC->Disconnect();
?>
|