Viewing file: editTimeTable.php (20.68 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "../global0.php";
include_once "../link/function.php";
include_once "../class/clsrg_TimeTable.php";
include_once "../class/clsClass.php";
include_once "../class/clsCourse.php";
include_once "../class/clsProgram.php";
include_once "../class/clsRoom.php";
include_once "../class/clsrg_MainExternalPlace.php";
include_once "../class/clsrg_SubExternalPlace.php";
include_once "../class/clsrg_WeekDate.php";
include_once "../class/clsDay.php";
include_once "../class/clsPeriod.php";
include_once "../class/clsOfficer.php";
include_once "../class/clsrg_SysStudyType.php";
include_once "../class/clsrg_TCInTT.php";
include_once "../class/clsrg_TeachingMethod.php";
include_once "../class/clsrg_OFSetTT.php";
include_once "../class/clsrg_NoStudyDate.php";
openWindow();
checkWeekDayJS();
isvaliddate();
futureDayJS();
doCheckAll();
$conn = new Connection();
$oTt1 = new rg_TimeTable();
$oTt2 = new rg_TimeTable();
$oCl = new Class1();
$oCo = new Course();
$oPg = new Program();
$oRm = new Room();
$oMep = new rg_MainExternalPlace();
$oSep = new rg_SubExternalPlace();
$oWd = new rg_WeekDate();
$oDy = new Day();
$oPr = new Period();
$oOf = new Officer();
$oSt = new rg_SysStudyType();
$oTit1 = new rg_TCInTT();
$oTit2 = new rg_TCInTT();
$oTc = new rg_TeachingMethod();
$oOst = new rg_OFSetTT();
$oNsd = new rg_NoStudyDate();
?>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="../source/style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../source/calendarDateInput.js"></script>
<script language="javascript">
function checkFormat() {
f = document.pc;
if(f.ttRmId.value=="") {
alert('กรุณาเลือก ห้อง');
f.ttRmId.focus();
return false;
}
if(f.ttEpMepId.disabled==false && f.ttEpMepId.value=="") {
alert('กรุณาเลือก สถานที่ฝึกงาน');
return false;
}
if(f.ttDyId.value=="") {
alert('กรุณาเลือก วัน');
f.ttDyId.focus();
return false;
}
if(f.ttFrPr.value=="") {
alert('กรุณาเลือก จากคาบ');
f.ttFrPr.focus();
return false;
}
if(f.ttToPr.value=="") {
alert('กรุณาเลือก ถึงคาบ');
f.ttToPr.focus();
return false;
}
if(parseInt(f.ttFrPr.value) > parseInt(f.ttToPr.value)) {
alert('จากคาบ ต้อง <= ถึงคาบ');
f.ttToPr.focus();
return false;
}
if(f.ttOfId.value=="") {
alert('กรุณาเลือก ชื่ออาจารย์ผู้สอน');
f.ttOfId.focus();
return false;
}
if(f.ttSstId.value=="") {
alert('กรุณาเลือก ประเภทการสอน');
f.ttSstId.focus();
return false;
}
return true;
}
function ChangeEp() {
f = document.pc;
s = document.getElementById("search");
if(f.ttRmId.value=="NULL") {
f.mepName.disabled = "";
f.sepName.disabled = "";
f.ttEpMepId.disabled = "";
f.ttEpSepId.disabled = "";
s.style.display = "";
}
else {
f.mepName.disabled = "none";
f.sepName.disabled = "none";
f.ttEpMepId.disabled = "none";
f.ttEpSepId.disabled = "none";
s.style.display = "none";
}
}
function doPopup() {
f = document.pc;
var tcIds = f.tcIds.value;
OpenWindow("tcTable.php?tcIds="+tcIds,500,400);
}
function ChangeMethodEdit() {
f = document.pc;
f.method.value = "edit";
f.submit();
}
function ChangeMethodDelete() {
f = document.pc;
f.method.value = "delete";
f.submit();
}
</script>
<form name="pc" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<input type="hidden" name="view" value="<?=$view?>">
<input type="hidden" name="officerCode" value="<?=$officerCode?>">
<input type="hidden" name="ttId" value="<?php echo $ttId;?>">
<table width="100%" align="center" cellpadding="3" cellspacing="0" border="1">
<tr>
<td colspan="3" align="center"><font size="3" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><b>แก้ไขตารางสอน</b></font></td>
</tr>
<tr bgcolor="#ABCDEF">
<td width="18%" align="center"><font size="2"><b>#</b></font></td>
<td width="41%" align="center"><font size="2"><b>เดิม</b></font></td>
<td width="41%" align="center"><font size="2"><b>เปลี่ยนเป็น</b></font></td>
</tr>
<?php
$oTt1->SearchByKey($ttId);
$oTt1->GetRecord();
$oCl->SearchByKey($oTt1->ttClId);
$oCl->GetRecord();
$oCo->SearchByKey($oCl->courseId);
$oCo->GetRecord();
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>รายวิชา</b></font></td>
<td><font size="2"><?php echo $oCo->courseCode.' '.$oCo->courseName;?></font></td>
<td><font size="2"><?php echo $oCo->courseCode.' '.$oCo->courseName;?></font>
<input type="hidden" name="coId" value="<?php echo $oCl->courseId;?>">
<input type="hidden" name="ttClId" value="<?php echo $oTt1->ttClId;?>"></td>
</tr>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>กลุ่ม</b></font></td>
<td><font size="2"><?php echo $oCl->section;?></font></td>
<td><font size="2"><?php echo $oCl->section;?></font></td>
</tr>
<?php
if(!is_null($oCl->programId)) {
$oPg->SearchByKey($oCl->programId);
$oPg->GetRecord();
}
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>หลักสูตร</b></font></td>
<td><font size="2"><?php echo is_null($oCl->programId) ? 'เรียนรวมหลายหลักสูตร' : $oPg->programName;?></font></td>
<td><font size="2"><?php echo is_null($oCl->programId) ? 'เรียนรวมหลายหลักสูตร' : $oPg->programName;?></font>
<input type="hidden" name="programId" value="<?php echo is_null($oCl->programId) ? 'NULL' : $oCl->programId;?>"></td>
</tr>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>ชั้นปี</b></font></td>
<td><font size="2"><?php echo $oCl->studentYear;?></font></td>
<td><font size="2"><?php echo $oCl->studentYear;?></font>
<input type="hidden" name="studentYear" value="<?php echo $oCl->studentYear;?>"></td>
</tr>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>ภาค/ปีการศึกษา</b></font></td>
<td><font size="2"><?php echo $oCl->semester.'/'.$oCl->acadYear;?></font></td>
<td><font size="2"><?php echo $oCl->semester.'/'.$oCl->acadYear;?></font>
<input type="hidden" name="semester" value="<?php echo $oCl->semester;?>">
<input type="hidden" name="acadYear" value="<?php echo $oCl->acadYear;?>"></td>
</tr>
<?php
if(!is_null($oTt1->ttRmId)) {
$oRm->SearchByKey($oTt1->ttRmId);
$oRm->GetRecord();
}
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>ห้อง</b></font></td>
<td><font size="2"><?php echo is_null($oTt1->ttRmId) ? 'สถานที่ฝึกงาน' : $oRm->roomNo;?></font></td>
<td><select name="ttRmId" onChange="ChangeEp()">
<option value="">--เลือก--</option>
<option value="NULL" <?php echo is_null($oTt1->ttRmId) ? 'selected' : '';?>>สถานที่ฝึกงาน</option>
<?php
$oRm->RSRoom();
while($oRm->GetRecord()) {
?>
<option value="<?php echo $oRm->roomId;?>" <?php echo ($oRm->roomId==$oTt1->ttRmId) ? 'selected' : '';?>><?php echo $oRm->roomNo;?></option>
<?php
}
?>
</select>
<font color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font></td>
</tr>
<?php
if(!is_null($oTt1->ttEpMepId) && !is_null($oTt1->ttEpSepId)) {
$oMep->SearchByKey($oTt1->ttEpMepId);
$oMep->GetRecord();
$oSep->SearchByKey($oTt1->ttEpSepId);
$oSep->GetRecord();
}
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>สถานที่ฝึกงาน</b></font></td>
<td><font size="2"><?php echo is_null($oTt1->ttEpMepId) ? '-' : $oMep->mepName.' : '.$oSep->sepName;?></font></td>
<td><input type="text" name="mepName" value="<?php echo is_null($oTt1->ttEpMepId) ? '' : $oMep->mepName;?>" size="18" class="input1" readonly>
:
<input type="text" name="sepName" value="<?php echo is_null($oTt1->ttEpSepId) ? '' : $oSep->sepName;?>" size="11" class="input1" readonly>
<img src="../picture/search.gif" width="15" height="19" border="0" align="absmiddle" id="search" style="CURSOR: hand; display: <?php echo is_null($oTt1->ttEpMepId) ? 'none' : '';?>;" onclick='OpenWindow("epTable.php",500,400)'>
<font color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font>
<input type="hidden" name="ttEpMepId" value="<?php echo is_null($oTt1->ttEpMepId) ? '' : $oTt1->ttEpMepId;?>" <?php echo is_null($oTt1->ttEpMepId) ? 'disabled' : '';?>>
<input type="hidden" name="ttEpSepId" value="<?php echo is_null($oTt1->ttEpSepId) ? '' : $oTt1->ttEpSepId;?>"></td>
</tr>
<?php
$oWd->SearchByKey($oCl->acadYear, $oTt1->ttWdAcYWeekNo);
$oWd->GetRecord();
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>สัปดาห์ที่</b></font></td>
<td><font size="2"><?php echo $oTt1->ttWdAcYWeekNo.': '.abbreDate(splitDateDb2($oWd->wdFrDate)).' - '.abbreDate(splitDateDb2($oWd->wdToDate));?></font></td>
<td><select name="ttWdAcYWeekNo">
<?php
$oWd->RSrg_WeekDateByAcY($oCl->acadYear);
while($oWd->GetRecord()) {
?>
<option value="<?php echo $oWd->wdAcYWeekNo;?>" <?php echo ($oWd->wdAcYWeekNo==$oTt1->ttWdAcYWeekNo) ? 'selected' : '';?>><?php echo $oWd->wdAcYWeekNo.': '.abbreDate(splitDateDb2($oWd->wdFrDate)).' - '.abbreDate(splitDateDb2($oWd->wdToDate));?></option>
<?php
}
?>
</select></td>
</tr>
<?php
$oDy->SearchByKey($oTt1->ttDyId);
$oDy->GetRecord();
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>วัน</b></font></td>
<td><font size="2"><?php echo $oDy->dayName;?></font></td>
<td><select name="ttDyId">
<option value="">--เลือก--</option>
<?php
$oDy->RSDay();
while($oDy->GetRecord()) {
?>
<option value="<?php echo $oDy->dayId;?>" <?php echo ($oDy->dayId==$oTt1->ttDyId) ? 'selected' : '';?>><?php echo $oDy->dayName;?></option>
<?php
}
?>
</select>
<font color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font></td>
</tr>
<?php
$oPr->SearchByKey($oTt1->ttFrPr);
$oPr->GetRecord();
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>จากคาบ</b></font></td>
<td><font size="2"><?php echo substr($oPr->startTime, 0, 5).'-'.substr($oPr->endTime, 0, 5);?></font></td>
<td><select name="ttFrPr">
<option value="">--เลือก--</option>
<?php
$oPr->RSPeriod();
while($oPr->GetRecord()) {
?>
<option value="<?php echo $oPr->period;?>" <?php echo ($oPr->period==$oTt1->ttFrPr) ? 'selected' : '';?>><?php echo substr($oPr->startTime, 0, 5).'-'.substr($oPr->endTime, 0, 5);?></option>
<?php
}
?>
</select>
<font color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font></td>
</tr>
<?php
$oPr->SearchByKey($oTt1->ttToPr);
$oPr->GetRecord();
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>ถึงคาบ</b></font></td>
<td><font size="2"><?php echo substr($oPr->startTime, 0, 5).'-'.substr($oPr->endTime, 0, 5);?></font></td>
<td><select name="ttToPr">
<option value="">--เลือก--</option>
<?php
$oPr->RSPeriod();
while($oPr->GetRecord()) {
?>
<option value="<?php echo $oPr->period;?>" <?php echo ($oPr->period==$oTt1->ttToPr) ? 'selected' : '';?>><?php echo substr($oPr->startTime, 0, 5).'-'.substr($oPr->endTime, 0, 5);?></option>
<?php
}
?>
</select>
<font color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font></td>
</tr>
<?php
$oOf->SearchByKey($oTt1->ttOfId);
$oOf->GetRecord();
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>ชื่ออาจารย์ผู้สอน</b></font></td>
<td><font size="2"><?php echo $oOf->officerName.' '.$oOf->officerSurname;?></font></td>
<td><select name="ttOfId">
<option value="">--เลือก--</option>
<?php
$oOf->RSOfficerOrderNmAndSn();
while($oOf->GetRecord()) {
?>
<option value="<?php echo $oOf->officerId;?>" <?php echo ($oOf->officerId==$oTt1->ttOfId) ? 'selected' : '';?>><?php echo $oOf->officerName.' '.$oOf->officerSurname;?></option>
<?php
}
?>
</select>
<font color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font></td>
</tr>
<?php
$oSt->SearchByKey($oTt1->ttSstId);
$oSt->GetRecord();
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>ประเภทการสอน</b></font></td>
<td><font size="2"><?php echo $oSt->sstName;?></font></td>
<td><select name="ttSstId">
<option value="">--เลือก--</option>
<?php
$oSt->RSrg_SysStudyType();
while($oSt->GetRecord()) {
?>
<option value="<?php echo $oSt->sstId;?>" <?php echo ($oSt->sstId==$oTt1->ttSstId) ? 'selected' : '';?>><?php echo $oSt->sstName;?></option>
<?php
}
?>
</select>
<font color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font></td>
</tr>
<?php
$i = 1;
$oTit1->RSrg_TCInTTByTtId($ttId);
while($oTit1->GetRecord()) {
$oTc->SearchByKey($oTit1->titTcId);
$oTc->GetRecord();
if($i > 1) {
$tmpTcIds .= ",";
$tmpTcNames .= ", ";
}
$tmpTcIds .= $oTit1->titTcId;
$tmpTcNames .= $oTc->tcName;
$i++;
}
?>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>วิธีการสอน</b></font></td>
<td><font size="2"><?php echo $tmpTcNames;?> </font></td>
<td><textarea name="tcNames" cols="30%" rows="<?php echo ($i==1) ? 1 : $i-1;?>" class="input1" readonly><?php echo ($tcNames) ? $tcNames : $tmpTcNames;?></textarea>
<img src="../picture/search.gif" width="15" height="19" border="0" align="absmiddle" style="CURSOR: hand;" onClick="doPopup()">
<input type="hidden" name="tcIds" value="<?php echo ($tcIds) ? $tcIds : $tmpTcIds;?>"></td>
</tr>
<tr>
<td bgcolor="#FEDCBA"><font size="2"><b>บท/เรื่อง/หัวข้อสอน</b></font></td>
<td><font size="2"><?php echo $oTt1->ttTitle;?> </font></td>
<td><input type="text" name="ttTitle" value="<?php echo $oTt1->ttTitle;?>" size="40"></td>
</tr>
<?php
$oOf->SearchByOfficerCode($officerCode);
$oOf->GetRecord();
$ostPgId = (is_null($oCl->programId)) ? 0 : $oCl->programId;
$oOst->SearchByKeyAndTTIsY($oOf->officerId, $oCl->acadYear, $oCl->semester, $ostPgId);
?>
<tr align=center>
<td colspan="3"><input type="button" name="edit" value="แก้ไข" onClick="if(checkFormat()) ChangeMethodEdit(); else return false;" <?php echo ($oOst->GetRecord()) ? '' : 'disabled';?>>
<input type="button" name="cancel" value="ย้อนกลับ" onClick="location.href = 'showTimeTable.php?programId=<?php echo $oCl->programId;?>&studentYear=<?php echo $oCl->studentYear;?>&acadYear=<?php echo $oCl->acadYear;?>&semester=<?php echo $oCl->semester;?>&coId=<?php echo $oCl->courseId;?>&ttClId=<?php echo $oTt1->ttClId;?>&ttRmId=<?php echo $oTt1->ttRmId;?>&ttEpMepId=<?php echo $oTt1->ttEpMepId;?>&ttEpSepId=<?php echo $oTt1->ttEpSepId;?>&ttWdAcYWeekNo=<?php echo $oTt1->ttWdAcYWeekNo;?>&ttDyId[<?php echo $oTt1->ttDyId;?>]=<?php echo $oTt1->ttDyId;?>&ttFrPr=<?php echo $oTt1->ttFrPr;?>&ttToPr=<?php echo $oTt1->ttToPr;?>&ttOfId=<?php echo $oTt1->ttOfId;?>&ttSstId=<?php echo $oTt1->ttSstId;?>&tcIds=<?php echo $tmpTcIds;?>&tcNames=<?php echo $tmpTcNames;?>&view=<?php echo $view;?>&officerCode=<?php echo $officerCode;?>'">
<input type="hidden" name="method" value="edit"></td>
</tr>
</table>
<?php
if($method=="delete") {
for($i=0; $i<count($ttIdDel); $i++) {
$oTit1->RSrg_TCInTTByTtId($ttIdDel[$i]);
while($oTit1->GetRecord()) {
$oTit2->SearchByKey($ttIdDel[$i], $oTit1->titTcId);
$oTit2->GetRecord();
$oTit2->Delete();
}
$oTt2->SearchByKey($ttIdDel[$i]);
$oTt2->GetRecord();
$oTt2->Delete();
}
}
?>
<table width="100%" align="center">
<tr>
<td colspan="5" align="center"><br><br><font size="3" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><b>ลบตารางสอน</b></font></td>
</tr>
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
<td width="5%" height="22" align="center"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_1"];?>"><b>เลือก</b></font></td>
<td width="25%" align="center"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_1"];?>"><b>สัปดาห์ที่</b></font></td>
<td width="20%" align="center"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_1"];?>"><b>วัน เวลา</b></font></td>
<td width="30%" align="center"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_1"];?>"><b>ห้อง/สถานที่ฝึกงาน</b></font></td>
<td width="20%" align="center"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_1"];?>"><b>ชื่ออาจารย์ผู้สอน</b></font></td>
</tr>
<?php
$i = 0;
$oTt2->RSrg_TimeTableByClIdOrderAcYWeekNoDyIdFrPr($oCl->classId);
while($oTt2->GetRecord()) {
$oWd->SearchByKey($oCl->acadYear, $oTt2->ttWdAcYWeekNo);
$oWd->GetRecord();
$oDy->SearchByKey($oTt2->ttDyId);
$oDy->GetRecord();
$oPr->SearchByKey($oTt2->ttFrPr);
$oPr->GetRecord();
$prStr = substr($oPr->startTime, 0, 5).'-';
$oPr->SearchByKey($oTt2->ttToPr);
$oPr->GetRecord();
$prStr .= substr($oPr->endTime, 0, 5);
$oSt->SearchByKey($oTt2->ttSstId);
$oSt->GetRecord();
$oRm->SearchByKey($oTt2->ttRmId);
$oRm->GetRecord();
$oMep->SearchByKey($oTt2->ttEpMepId);
$oMep->GetRecord();
$oSep->SearchByKey($oTt2->ttEpSepId);
$oSep->GetRecord();
$oOf->SearchByKey($oTt2->ttOfId);
$oOf->GetRecord();
if(($i%2) == 0)
echo "<tr title=\"".$oTt2->ttTitle."\">";
else
echo "<tr title=\"".$oTt2->ttTitle."\" bgcolor=\"".$GLOBALS["COLOR_BG_TABLE_3"]."\">";
?>
<td align="center"><input type="checkbox" name="ttIdDel[]" value="<?php echo $oTt2->ttId;?>"></td>
<td><font size="2"><?php echo $oTt2->ttWdAcYWeekNo.' : '.abbreDate(splitDateDb2($oWd->wdFrDate)).' - '.abbreDate(splitDateDb2($oWd->wdToDate));?></font></td>
<td><font size="2"><?php echo $oDy->dayAbbrEng.' '.$prStr.' ('.$oSt->sstAbbrEng.')';?></font></td>
<td><font size="2"><?php echo is_null($oTt2->ttRmId) ? $oMep->mepName.' : '.$oSep->sepName : $oRm->roomNo;?></font></td>
<td><font size="2"><?php echo $oOf->officerName.' '.$oOf->officerSurname;?></font></td>
</tr>
<?php
$i++;
}
?>
<tr>
<td colspan="5"><input type="button" name="chkAll" value="เลือกทั้งหมด" onClick="doCheckAll(this.form, true)" <?php echo ($i==0) ? 'disabled' : '';?>>
<input type="button" name="cancelAll" value="ยกเลิกทั้งหมด" onClick="doCheckAll(this.form, false)" <?php echo ($i==0) ? 'disabled' : '';?>></td>
</tr>
<?php
$oOf->SearchByOfficerCode($officerCode);
$oOf->GetRecord();
$ostPgId = (is_null($oCl->programId)) ? 0 : $oCl->programId;
$oOst->SearchByKeyAndTTIsY($oOf->officerId, $oCl->acadYear, $oCl->semester, $ostPgId);
?>
<tr>
<td colspan="5" align="center"><input type="button" name="delete" value="บันทึก" onClick="ChangeMethodDelete()" <?php echo ($oOst->GetRecord() && $i>0) ? '' : 'disabled';?>>
<input type="button" name="cancelDel" value="ย้อนกลับ" onClick="location.href = 'showTimeTable.php?programId=<?php echo $oCl->programId;?>&studentYear=<?php echo $oCl->studentYear;?>&acadYear=<?php echo $oCl->acadYear;?>&semester=<?php echo $oCl->semester;?>&coId=<?php echo $oCl->courseId;?>&ttClId=<?php echo $oTt1->ttClId;?>&ttRmId=<?php echo $oTt1->ttRmId;?>&ttEpMepId=<?php echo $oTt1->ttEpMepId;?>&ttEpSepId=<?php echo $oTt1->ttEpSepId;?>&ttWdAcYWeekNo=<?php echo $oTt1->ttWdAcYWeekNo;?>&ttDyId[<?php echo $oTt1->ttDyId;?>]=<?php echo $oTt1->ttDyId;?>&ttFrPr=<?php echo $oTt1->ttFrPr;?>&ttToPr=<?php echo $oTt1->ttToPr;?>&ttOfId=<?php echo $oTt1->ttOfId;?>&ttSstId=<?php echo $oTt1->ttSstId;?>&tcIds=<?php echo $tmpTcIds;?>&tcNames=<?php echo $tmpTcNames;?>&view=<?php echo $view;?>&officerCode=<?php echo $officerCode;?>'"></td>
</tr>
</table>
</form>
<?php
if($method=="edit") {
$oWd->SearchByKey($acadYear, $ttWdAcYWeekNo);
$oWd->GetRecord();
$oNsd->RSrg_NoStudyDateByDateAndFrPrAndToPr(futureDay($oWd->wdFrDate, $ttDyId-1), $ttFrPr, $ttToPr);
if(!$oNsd->GetRecord()) {
$oTt1->SearchByAllAndNotId($ttClId, $ttRmId, $ttEpMepId, $ttEpSepId, $ttWdAcYWeekNo, $ttDyId, $ttFrPr, $ttToPr, $ttOfId, $ttSstId, $ttId);
if(!$oTt1->GetRecord()) {
$oTt1->SearchByKey($ttId);
$oTt1->GetRecord();
$oTt1->Edit();
$oTt1->ttRmId = ($ttRmId=='NULL') ? 'NULL' : $ttRmId;
$oTt1->ttEpMepId = ($ttEpMepId=='') ? 'NULL' : $ttEpMepId;
$oTt1->ttEpSepId = ($ttEpSepId=='') ? 'NULL' : $ttEpSepId;
$oTt1->ttWdAcYWeekNo = $ttWdAcYWeekNo;
$oTt1->ttDyId = $ttDyId;
$oTt1->ttFrPr = $ttFrPr;
$oTt1->ttToPr = $ttToPr;
$oTt1->ttOfId = $ttOfId;
$oTt1->ttSstId = $ttSstId;
$oTt1->ttTitle = $ttTitle;
$oTt1->Save();
$oTit1->RSrg_TCInTTByTtId($ttId);
while($oTit1->GetRecord()) {
$oTit2->SearchByKey($ttId, $oTit1->titTcId);
$oTit2->GetRecord();
$oTit2->Delete();
}
if($tcIds) {
$tcIdArr = explode(",", $tcIds);
for($i=0; $i<count($tcIdArr); $i++) {
$oTit1->AddNew();
$oTit1->titTtId = $ttId;
$oTit1->titTcId = $tcIdArr[$i];
$oTit1->Save();
}
}
}
}
echo "<meta http-equiv=\"refresh\" content=\"0;url=showTimeTable.php?programId=$programId&studentYear=$studentYear&acadYear=$acadYear&semester=$semester&coId=$coId&ttClId=$ttClId&ttRmId=$ttRmId&mepName=$mepName&sepName=$sepName&ttEpMepId=$ttEpMepId&ttEpSepId=$ttEpSepId&ttWdAcYWeekNo=$ttWdAcYWeekNo&numWeek=$numWeek&ttDyId[".$ttDyId."]=$ttDyId&ttFrPr=$ttFrPr&ttToPr=$ttToPr&ttOfId=$ttOfId&ttSstId=$ttSstId&tcIds=$tcIds&tcNames=$tcNames&ttTitle=$ttTitle&view=$view&officerCode=$officerCode\">" ;
}
?>
|