Viewing file: 2551-03-10-1.0.01-courseInProgramTableTmp.php (16.44 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "../../class/clsDB.php";
include_once "../../class/clsConnection.php";
include_once "../global.php";
include_once "../link/function.php";
include_once "../class/clsReg_SysSemesterDes.php";
include_once "../class/clsReg_Program.php";
include_once "../class/clsClassAssess.php";
include_once "../class/clsClassOpenForAssess.php";
include_once "../class/clsCourseAssess.php";
include_once "../class/clsHoldCourseTmp.php";
$oCR = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB_REG'], $GLOBALS['USER_REG'], $GLOBALS['PASSWORD_REG']);
$oCA = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB_EASS'], $GLOBALS['USER_EASS'], $GLOBALS['PASSWORD_EASS']);
$oProg = new Program($oCR);
$oClassA = new ClassAssess($oCA);
$oClsOpen = new ClassOpenForAssess($oCA);
$oCourse = new CourseAssess($oCA);
$oCourse_in = new CourseAssess($oCA);
$oHCT = new HoldCourseTmp($oCA);
doCheckAll();
?>
<script language="javascript1.2">
function doSubmitAll(){
document.pc.action = "./processCourseTableTmp.php?method=add&assid=<?php echo $assid;?>&acadYear=<?php echo $acadYear;?>&semester=<?php echo $semester;?>&startDate=<?php echo $startDate;?>&endDate=<?php echo $endDate;?>&closeDate=<?php echo $closeDate;?>&selectFlag=<?php echo $selectFlag;?>";
document.pc.submit();
}
</script>
<html>
<head>
<title>ตารางรายวิชาในหลักสูตร</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="../source/style.css" rel="stylesheet" type="text/css">
<style>
<!--
A:link {text-decoration: none }
A:visited {text-decoration: none}
A:hover {text-decoration: none; font-weight: underline}
-->
</style>
<?
$acadYear_1 = $GLOBALS["ACADYEAR"];
$semester_1 = $GLOBALS["SEMESTER"];
$oSse = new SysSemesterDes($oCR);
$oSse->SearchByKey($semester_1);
$oSse->GetRecord();
?>
</head>
<body bgcolor="#FFFFFF">
<form name="pc" action="<?php echo $PHP_SELF;?>" method="post"><br>
<table width="97%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="silver">
<tr bgcolor="#FFFFFF">
<td colspan="6" align = "center"><font face="Microsoft Sans Serif" size="2"><br><b>ค้นหาจาก</b>
<select name="selectSearch">
<option value="1" <? if(($selectSearch == 1) || ($selectSearch == "")){ echo "selected"; } ?>>รหัสรายวิชา</option>
<option value="2" <? if($selectSearch == 2){ echo "selected"; } ?>>ชื่อรายวิชา</option>
</select>
<input type="text" name="inputSearch" size="30" maxlength="100">
</font> <input type="submit" name="search" value="ค้นหา"> <div align="right"><? echo $oSse->semesterName."/".$acadYear_1; ?></div></td>
</tr>
<tr bgcolor="#0066CC">
<td width="7%" align="center"><font face="Microsoft Sans Serif" size="2" color="#FFFFFF"><b>เลือก</b></font></td>
<td width="14%" align="center"><font face="Microsoft Sans Serif" size="2" color="#FFFFFF"><b>ชื่อย่อ<br>หลักสูตร</b></font></td>
<td width="53%" align="center"><font face="Microsoft Sans Serif" size="2" color="#FFFFFF"><b>รายวิชา</b></font><font face="Microsoft Sans Serif" size="2" color="#FFFFFF"> </font></td>
<td width="7%" align="center"><font face="Microsoft Sans Serif" size="2" color="#FFFFFF"><b>ชั้นปี</b></font></td>
<td width="12%" align="center"><font face="Microsoft Sans Serif" size="2" color="#FFFFFF"><b>หน่วยกิต</b></font></td>
<td width="7%" align="center"><font face="Microsoft Sans Serif" size="2" color="#FFFFFF"><b>กลุ่ม</b></font></td>
</tr>
<?php
$i = 0;
$ck=0;
$countClass = $oClassA->CountClassIdAtAcadSem($acadYear_1,$semester_1);
$countTmp = $oHCT->CountClassId();
//ค้นหารายวิชาเฉพาะที่เปิดในปีการศึกษาและภาคการศึกษาปัจจุบัน
//ถ้ากรณีที่ค้นหาจากรหัสรายวิชา
if($inputSearch != ""){
if($selectSearch == 1){
$oCourse->SearchByCourseCode($inputSearch);
}else if($selectSearch == 2){
$oCourse->SearchByCourseName($inputSearch);
}
while($oCourse->GetRecord()){
$oClassA->SearchByCourseIdAcadSem($oCourse->courseId,$acadYear_1,$semester_1);
while($oClassA->GetRecord()) {
//ค้นหาจากตาราง HoldCourseTmp ถ้าซ้ำไม่นำมาแสดง
$oHCT->SearchByClassId($oClassA->classId);
if($oHCT->GetRecord() == '0'){
//$oCourse->SearchByKey($oClassA->courseId);
//$oCourse->GetRecord();
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input type="checkbox" name="classId[<?php echo $i;?>]" value="<?php echo $oClassA->classId;?>"></td>
<td align="center" bgcolor="#FFFFFF">
<?
if(($oClassA->programId == 0) || ($oClassA->programId == "")){
$z = 0;
$oClsOpen->SearchByClassId($oClassA->classId);
while($oClsOpen->GetRecord()){
$oProg->SearchByKey($oClsOpen->programId);
$oProg->GetRecord();
if($oProg->programAbbr != ""){
$arrCls[$z] = $oProg->programAbbr;
}else{
$arrCls[$z] = "<img src = \"../picture/warn.png\" border = \"0\">";
}
//$arrCls[$z] = $oClsOpen->programId;
$z++;
} // end while oClsOpen
for($a=0;$a<=$z;$a++){
echo $arrCls[$a];
if($a < $z-1) echo ",<br>";
}
}else{
$oProg->SearchByKey($oClassA->programId);
if($oProg->GetRecord()){
if($oProg->programAbbr != ""){
echo $oProg->programAbbr;
}else{
echo "<img src = \"../picture/warn.png\" border = \"0\">";
}
}
//echo $oClassA->programId;
}
?>
</td>
<td bgcolor="#FFFFFF"><font size="2" face="Microsoft Sans Serif"><?php echo $oCourse->courseCode.' '.$oCourse->courseName;?></font>
</td>
<td bgcolor="#FFFFFF" align="center"><? echo $oClassA->studentYear ?></td>
<td align="center" bgcolor="#FFFFFF"><font size="2" face="Microsoft Sans Serif"><?php echo $oCourse->courseUnit;?></font></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $oClassA->section ?></td>
</tr>
<?
$ck=1;
} else{ //end if oHCT
//$oCourse_in->SearchByKey($oClassA->courseId);
//$oCourse_in->GetRecord();
?>
<tr>
<td height="22" align="center" bgcolor ="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>">
<img src="../picture/checked.gif" align="absmiddle" border="0"></td>
<td height="22" align="center" bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>">
<? if(($oClassA->programId == 0) || ($oClassA->programId == "")){
$z = 0;
$oClsOpen->SearchByClassId($oClassA->classId);
while($oClsOpen->GetRecord()){
$oProg->SearchByKey($oClsOpen->programId);
$oProg->GetRecord();
if($oProg->programAbbr != ""){
$arrCls[$z] = $oProg->programAbbr;
}else{
$arrCls[$z] = "<img src = \"../picture/warn.png\" border = \"0\">";
}
//$arrCls[$z] = $oClsOpen->programId;
$z++;
} // end while oClsOpen
for($a=0;$a<=$z;$a++){
echo $arrCls[$a];
if($a < $z-1) echo ",<br>";
}
}else{
$oProg->SearchByKey($oClassA->programId);
if($oProg->GetRecord()){
if($oProg->programAbbr != ""){
echo $oProg->programAbbr;
}else{
echo "<img src = \"../picture/warn.png\" border = \"0\">";
}
}
//echo $oClassA->programId;
}
?>
</td>
<td height="22" bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>"><font size="2" ><?php echo $oCourse->courseCode.' '.$oCourse->courseName;?></font>
</td>
<td height="22" bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>" align="center"><font size="2"><? echo $oClassA->studentYear ?></font></td>
<td height="22" align="center" bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>"><font size="2"><?php echo $oCourse->courseUnit;?></font></td>
<td height="22" align="center" bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>"><font size="2"><?php echo $oClassA->section ?></font></td>
</tr>
<? } // end else
$i++;
} //end while oClassA
} // end while oCouse
}else{
// $countClass = $oClassA->CountClassIdAtAcadSem($acadYear_1,$semester_1);
// $countTmp = $oHCT->CountClassId();
//$numRow = $countClass-$countTmp;
$numRow = $countClass;
//$page_size = 15 + $countTmp;
$page_size = 12;
$total_page = (int)($numRow/$page_size);
if(($numRow%$page_size) != 0)
$total_page++;
if(isset($page_id))
$start = $page_size*($page_id-1);
else {
$page_id = 1;
$start = 0;
}
//$oClassA->SearchByAcadSem($acadYear_1,$semester_1);
$oClassA->SearchLimitPageByAcadSem($acadYear_1,$semester_1,$start, $page_size);
while($oClassA->GetRecord()) {
//echo "<br> class = ".$oClassA->classId;
//ค้นหาจากตาราง HoldCourseTmp ถ้าซ้ำไม่นำมาแสดง
$oHCT->SearchByClassId($oClassA->classId);
if($oHCT->GetRecord() == '0'){
$oCourse->SearchByKey($oClassA->courseId);
$oCourse->GetRecord();
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input type="checkbox" name="classId[<?php echo $i;?>]" value="<?php echo $oClassA->classId;?>"></td>
<td align="center" bgcolor="#FFFFFF">
<? if(($oClassA->programId == 0) || ($oClassA->programId == "")){
$z = 0;
$oClsOpen->SearchByClassId($oClassA->classId);
while($oClsOpen->GetRecord()){
$oProg->SearchByKey($oClsOpen->programId);
$oProg->GetRecord();
if($oProg->programAbbr != ""){
$arrCls[$z] = $oProg->programAbbr;
}else{
$arrCls[$z] = "<img src = \"../picture/warn.png\" border = \"0\">";
}
//$arrCls[$z] = $oClsOpen->programId;
$z++;
} // end while oClsOpen
for($a=0;$a<=$z;$a++){
echo $arrCls[$a];
if($a < $z-1) echo ",<br>";
}
}else{
$oProg->SearchByKey($oClassA->programId);
if($oProg->GetRecord()){
if($oProg->programAbbr != ""){
echo $oProg->programAbbr;
}else{
echo "<img src = \"../picture/warn.png\" border = \"0\">";
}
}
//echo $oClassA->programId;
}
?>
</td>
<td bgcolor="#FFFFFF"><font size="2" face="Microsoft Sans Serif"><?php echo $oCourse->courseCode.' '.$oCourse->courseName;?></font>
</td>
<td bgcolor="#FFFFFF" align="center"><? echo $oClassA->studentYear ?></td>
<td align="center" bgcolor="#FFFFFF"><font size="2" face="Microsoft Sans Serif"><?php echo $oCourse->courseUnit;?></font></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $oClassA->section ?></td>
</tr>
<?php
$ck=1;
}else{ //end if oHCT
$oCourse->SearchByKey($oClassA->courseId);
$oCourse->GetRecord();
?>
<tr>
<td height="22" align="center" bgcolor ="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>">
<img src="../picture/checked.gif" align="absmiddle" border="0"></td>
<td align="center" height="22" bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>">
<? if(($oClassA->programId == 0) || ($oClassA->programId == "")){
$z = 0;
$oClsOpen->SearchByClassId($oClassA->classId);
while($oClsOpen->GetRecord()){
$oProg->SearchByKey($oClsOpen->programId);
$oProg->GetRecord();
if($oProg->programAbbr != ""){
$arrCls[$z] = $oProg->programAbbr;
}else{
$arrCls[$z] = "<img src = \"../picture/warn.png\" border = \"0\">";
}
//$arrCls[$z] = $oClsOpen->programId;
$z++;
} // end while oClsOpen
for($a=0;$a<=$z;$a++){
echo $arrCls[$a];
if($a < $z-1) echo ",<br>";
}
}else{
$oProg->SearchByKey($oClassA->programId);
if($oProg->GetRecord()){
if($oProg->programAbbr != ""){
echo $oProg->programAbbr;
}else{
echo "<img src = \"../picture/warn.png\" border = \"0\">";
}
}
//echo $oClassA->programId;
}
?>
</td>
<td height="22" bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>"><font size="2" ><?php echo $oCourse->courseCode.' '.$oCourse->courseName;?></font>
</td>
<td height="22" bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>" align="center"><font size="2"><? echo $oClassA->studentYear ?></font></td>
<td height="22" align="center" bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>"><font size="2"><?php echo $oCourse->courseUnit;?></font></td>
<td height="22" align="center" bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>"><font size="2"><?php echo $oClassA->section ?></font></td>
</tr>
<? }
//echo $i;
$i++;
} //end while oClassA
} //end if courseCode
if($i == 0) {
?>
<tr>
<td colspan="6" align="center" bgcolor="#FFFFFF"><font size="2" color="#FF0000" face="Microsoft Sans Serif">**
ไม่ปรากฏรายวิชา
<?
if($inputSearch != ""){
if($selectSearch == 1){
echo "รหัสวิชา '".$inputSearch,"' ";
}else if($selectSearch == 2){
echo "ชื่อรายวิชา '".$inputSearch,"' ";
}
}else {
echo "รายการ";
}?>
ดังกล่าวในฐานข้อมูล **</font></td>
</tr>
<?php
}
?>
<tr>
<td colspan="6" bgcolor="#FFFFFF"> <font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>">หน้า->
<?php
for ($num=1; $num<=$total_page; $num++) {
if($num == $page_id)
echo $num." ";
else {
?>
<a href="courseInProgramTableTmp.php?assid=<?php echo $assid;?>&acadYear=<?php echo $acadYear;?>&semester=<?php echo $semester;?>&startDate=<?php echo $startDate;?>&endDate=<?php echo $endDate;?>&closeDate=<?php echo $closeDate;?>&selectFlag=<?php echo $selectFlag;?>&page_id=<?php echo $num;?>"><?php echo '[ '.$num.' ]';?></a>
<?php
}
}
?>
</font> </td>
</tr>
</table>
<table width="97%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="silver">
<tr>
<td width="76%"><input type="button" name="selectAll" value="เลือกทั้งหมด" onClick="doCheckAll(this.form, true);">
<input type="button" name="cancelAll" value="ยกเลิกทั้งหมด" onClick="doCheckAll(this.form, false);">
<input type="hidden" name="cnt" value="<?php echo $i;?>"> <input type="hidden" name="assid" value="<?php echo $assid;?>">
<input type="hidden" name="acadYear" value="<?php echo $acadYear;?>">
<input type="hidden" name="semester" value="<?php echo $semester;?>">
<input type="hidden" name="startDate" value="<?php echo $startDate;?>">
<input type="hidden" name="endDate" value="<?php echo $endDate;?>">
<input type="hidden" name="closeDate" value="<?php echo $closeDate;?>">
<input type="hidden" name="selectFlag" value="<?php echo $selectFlag;?>">
</td>
<td width="24%" align="right"><font size="2">เลือกแล้ว <?php echo $countTmp ?>
รายการ <br>
จากทั้งหมด <?php echo $countClass; ?> รายการ</font></td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#FFFFFF"><br> <input type="button" name="Submit" value="บันทึกข้อมูลที่เลือก" onclick = 'return doSubmitAll();'>
</td>
</tr>
<tr>
<td align="center" colspan="2" bgcolor="#FFFFFF"><a href="#" onClick="window.close()"><font size="2" face="Microsoft Sans Serif">[ปิดหน้าต่าง]</font></a></td>
</tr>
<tr>
<td align="center" colspan="2" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFFF">
<table width="483" border="0">
<tr>
<td width="65"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>"><b>หมายเหตุ
:</b></font></td>
<td width="418"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>"><u>ชื่อย่อหลักสูตรที่แสดงอยู่ในตาราง
หมายถึง </u></font></td>
</tr>
<? $oProg->SearchByProgramStatusY();
while($oProg->GetRecord()){
?>
<tr>
<td> </td>
<td><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>">
<? if($oProg->programAbbr != ""){
echo $oProg->programAbbr." = ".$oProg->programName;
}else{
echo "<img src = \"../picture/warn.png\" border = \"0\"> = ".$oProg->programName;
}
?>
<? //echo $oProg->programId." = ".$oProg->programName; ?></font></td>
</tr>
<? } ?>
</table></td>
</tr>
</table>
</form>
</body>
</html>
|