Viewing file: addLTInClass.php (9.99 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "template.php";
showHeader();
include_once "../class/clsClass.php";
include_once "../class/clsrg_HrPerUnit.php";
include_once "../class/clsrg_LoadType.php";
include_once "../class/clsrg_CopyTimeTable.php";
include_once "../class/clsCourse.php";
include_once "../class/clsrg_WeekDate.php";
include_once "../class/clsDay.php";
include_once "../class/clsPeriod.php";
include_once "../class/clsRoom.php";
include_once "../class/clsrg_MainExternalPlace.php";
include_once "../class/clsrg_SubExternalPlace.php";
include_once "../class/clsOfficer.php";
include_once "../class/clsrg_OFSetTT.php";
doCheckAll();
$acadYear = (! isset($_GET['acadYear'])? "" : $_GET['acadYear']);
$semester = (! isset($_GET['semester'])? "" : $_GET['semester']);
$ctLtId = (! isset($_GET['ctLtId'])? "" : $_GET['ctLtId']);
$conn = new Connection();
$oCl = new Class1();
$oHu = new rg_HrPerUnit();
$oLt = new rg_LoadType();
$oCt1 = new rg_CopyTimeTable();
$oCt2 = new rg_CopyTimeTable();
$oCo = new Course();
$oWd = new rg_WeekDate();
$oDy = new Day();
$oPr = new Period();
$oRm = new Room();
$oMep = new rg_MainExternalPlace();
$oSep = new rg_SubExternalPlace();
$oOf = new Officer();
$oOst = new rg_OFSetTT();
if(!$acadYear)
$acadYear = $GLOBALS["ACADYEAR"];
if(!$semester)
$semester = $GLOBALS["SEMESTER"];
?>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<script>
function checkFormat() {
f = document.pc;
if(f.semester.value == "") {
alert("กรุณาเลือกภาคการศึกษา !");
f.semester.focus();
return false;
}
if(f.acadYear.value == "") {
alert("กรุณาเลือกปีการศึกษา !");
f.acadYear.focus();
return false;
}
if(f.ctLtId.value == "") {
alert("กรุณาเลือกประเภทย่อยการสอน !");
f.ctLtId.focus();
return false;
}
}
function doChange(x) {
f = document.pc;
if(x == 1)
f.ctClId.value = "";
else if(x == 2) {
f.ctLtId.value = "";
f.ctClId.value = "";
}
window.location = "addLTInClass.php?semester="+f.semester.value+"&acadYear="+f.acadYear.value+"&ctLtId="+f.ctLtId.value+"&ctClId="+f.ctClId.value;
}
</script>
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><br><fieldset>
<legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="adminIndex.php?mm=1">ภาระงานสอน</a> <img src="../picture/ico3.gif" align="absmiddle" border="0"> จัดกลุ่มวิชาตามประเภทย่อยการสอน</font></legend>
<div align="center"><br><form name="pc" method="post" action="processLTInClass.php"><table width="100%" align="center">
<tr>
<td align="center" colspan="2"><font size="3" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>"><b>จัดกลุ่มวิชาตามประเภทย่อยการสอน</b></font><br><br></td>
</tr>
<tr>
<td width="35%"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>ภาค/ปีการศึกษา</b></font>
<select name="semester" onChange="doChange(2)">
<option value="">--เลือก--</option>
<?php
$oCl->RSClassByCTGroupSe();
while($oCl->GetRecord()) {
?>
<option value="<?php echo $oCl->semester;?>" <?php echo ($oCl->semester==$semester) ? 'selected' : '';?>><?php echo $oCl->semester;?></option>
<?php
}
?>
</select>
/
<select name="acadYear" onChange="doChange(2)">
<option value="">--เลือก--</option>
<?php
$oCl->RSClassByCTGroupAcY();
while($oCl->GetRecord()) {
?>
<option value="<?php echo $oCl->acadYear;?>" <?php echo ($oCl->acadYear==$acadYear) ? 'selected' : '';?>><?php echo $oCl->acadYear;?></option>
<?php
}
?>
</select>
<font size="2" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font></td>
<td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>ประเภทย่อยการสอน</b></font>
<select name="ctLtId" onChange="doChange(1)">
<option value="">--เลือก--</option>
<?php
$oHu->RSrg_HrPerUnitByAcYAndTmId($acadYear, $semester);
while($oHu->GetRecord()) {
$oLt->SearchByKey($oHu->huLtId);
$oLt->GetRecord();
?>
<option value="<?php echo $oHu->huLtId;?>" <?php echo ($oHu->huLtId==$ctLtId) ? 'selected' : '';?>><?php echo $oLt->ltName.' ('.$oHu->huHr.' ชม. = '.$oHu->huUnit.' หน่วยภาระงานสอน)';?></option>
<?php
}
?>
</select>
<font size="2" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">*</font></td>
</tr>
<tr>
<td colspan="2"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>รายวิชา</b></font>
<select name="ctClId" onChange="doChange(0)">
<option value="">--เลือก--</option>
<?php
$oLt->ltSstId = '';
$oLt->SearchByKey($ctLtId);
$oLt->GetRecord();
$oCt1->RSrg_CopyTimeTableByAcYAndSeAndSstIdGroupClId($acadYear, $semester, $oLt->ltSstId);
while($oCt1->GetRecord()) {
$oCl->SearchByKey($oCt1->ctClId);
$oCl->GetRecord();
$oCo->SearchByKey($oCl->courseId);
$oCo->GetRecord();
?>
<option value="<?php echo $oCt1->ctClId;?>" <?php echo ($oCt1->ctClId==$ctClId) ? 'selected' : '';?>><?php echo $oCo->courseCode.' '.$oCo->courseName.' กลุ่ม '.$oCl->section;?></option>
<?php
}
?>
</select></td>
</tr>
<tr>
<td colspan="2"><table width="100%">
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
<td height="22" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>เลือก</b></font></td>
<td align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>สัปดาห์ที่</b></font></td>
<td align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>วัน เวลา</b></font></td>
<td align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>ห้อง/สถานที่ฝึกงาน</b></font></td>
<td align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>ชื่ออาจารย์ผู้สอน</b></font></td>
<td align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>ประเภทย่อยการสอน</b></font></td>
</tr>
<?php
$i = 0;
if($ctClId)
$oCt1->RSrg_CopyTimeTableByClIdAndSstIdGroupClId($ctClId, $oLt->ltSstId);
else
$oCt1->RSrg_CopyTimeTableByAcYAndSeAndSstIdGroupClId($acadYear, $semester, $oLt->ltSstId);
while($oCt1->GetRecord()) {
$oCl->SearchByKey($oCt1->ctClId);
$oCl->GetRecord();
$oCo->SearchByKey($oCl->courseId);
$oCo->GetRecord();
?>
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_1"];?>">
<td colspan="6" height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo $oCo->courseCode.' '.$oCo->courseName.' '.$oCo->courseUnit;?>
กลุ่ม
<?php echo $oCl->section;?></b></font></td>
</tr>
<?php
$oCt2->RSrg_CopyTimeTableByClIdAndSstId($oCt1->ctClId, $oLt->ltSstId);
while($oCt2->GetRecord()) {
$oWd->SearchByKey($acadYear, $oCt2->ctWdAcYWeekNo);
$oWd->GetRecord();
$oDy->SearchByKey($oCt2->ctDyId);
$oDy->GetRecord();
$oPr->SearchByKey($oCt2->ctFrPr);
$oPr->GetRecord();
$prStr = substr($oPr->startTime, 0, 5).'-';
$oPr->SearchByKey($oCt2->ctToPr);
$oPr->GetRecord();
$prStr .= substr($oPr->endTime, 0, 5);
$oRm->SearchByKey($oCt2->ctRmId);
$oRm->GetRecord();
$oMep->SearchByKey($oCt2->ctEpMepId);
$oMep->GetRecord();
$oSep->SearchByKey($oCt2->ctEpSepId);
$oSep->GetRecord();
$oOf->SearchByKey($oCt2->ctOfId);
$oOf->GetRecord();
$oLt->SearchByKey($oCt2->ctLtId);
$oLt->GetRecord();
?>
<tr>
<td align="center"><input type="checkbox" name="ctId[]" value="<?php echo $oCt2->ctId;?>" <?php echo (!is_null($oCt2->ctLtId) && $oCt2->ctLtId==$ctLtId) ? 'checked' : '';?> <?php echo ($ctLtId && is_null($oCt2->ctLtId)) ? '' : (($ctLtId && $oCt2->ctLtId==$ctLtId) ? '' : 'disabled');?>></td>
<td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo $oCt2->ctWdAcYWeekNo.' : '.abbreDate(splitDateDb2($oWd->wdFrDate)).' - '.abbreDate(splitDateDb2($oWd->wdToDate));?></font></td>
<td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo $oDy->dayAbbrEng.' '.$prStr;?></font></td>
<td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo is_null($oCt2->ctRmId) ? $oMep->mepName.' : '.$oSep->sepName : $oRm->roomNo;?></font></td>
<td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo $oOf->officerName.' '.$oOf->officerSurname;?></font></td>
<td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo is_null($oCt2->ctLtId) ? '' : $oLt->ltName;?></font></td>
</tr>
<?php
$i++;
}
}
?>
</table></td>
</tr>
<tr>
<td><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>
<tr>
<td colspan="2" align="center"><br>
<?php
$oCt1->RSrg_CopyTimeTableByAcYAndSeAndConfirmIsY($acadYear, $semester);
$oOf->SearchByOfficerCode($oU->userPsCodeReg);
$oOf->GetRecord();
$oOst->RSrg_OFSetTTByOfIdAndAcYAndTmIdAndWLIsY($oOf->officerId, $acadYear, $semester);
$res = (!$oCt1->GetRecord() && $oOst->GetRecord()) ? '' : 'disabled';
$lnk = '<input type="submit" name="edit" value="บันทึก" onClick="return checkFormat()" '.$res.'>';
echo $oU->CRUD($lnk, 'U');
?>
<input type="button" name="back" value="กลับเมนูหลัก" onClick="location.href = 'adminIndex.php?mm=1'">
<input type="hidden" name="method" value="edit"></td>
</tr>
</table></form></div>
</fieldset><br><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>"><b>หมายเหตุ : </b>* หมายถึง ต้องกรอกข้อมูลให้สมบูรณ์</font></td>
</tr>
</table>
<?php
showFooter();
?>
|