Viewing file: 2551-11-11-1.0.02-courseInProgramTable.php (18.06 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/clsHoldCourse.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);
$oHC= new HoldCourse($oCA);
$oHCT= new HoldCourseTmp($oCA);
//doCheckAll();
?>
<script language="javascript1.2">
function doSubmitAll(){
window.opener.location.href="editDefineSomeCourse.php?defineid=<?php echo $defineid ?>&assid=<?php echo $assid;?>&acadYear=<?php echo $acadYear;?>&semester=<?php echo $semester;?>&startDate=<?php echo $startDate;?>&endDate=<?php echo $endDate;?>&closeDate=<?php echo $closeDate;?>&noAss=<?=$noAss;?>&back=1&fe=0";
window.self.close();
}
</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="" 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="12%" 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="46%" 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 = $oHC->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()) {
//ค้นหาจากตาราง HoldCourseถ้าซ้ำไม่นำมาแสดง
//$oHC->SearchByClassId($oClassA->classId);
$oHCT->SearchByClassId($oClassA->classId);
if($oHCT->GetRecord() == '0'){
//$oCourse->SearchByKey($oClassA->courseId);
//$oCourse->GetRecord();
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><img src="../picture/new.gif" align="absmiddle" border="0" onClick="sendValue(document.forms['pc'],<?php echo $oClassA->classId;?>,<?php echo $defineid;?>)"></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 oHC
//$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/editnew.gif" align="absmiddle" border="0" onClick="sendValue(document.forms['pc'],<?php echo $oClassA->classId;?>,<?php echo $defineid;?>)"></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 = $oHC->CountClassId();
//$numRow = $countClass-$countTmp;
$numRow = $countClass;
//$page_size = 15 + $countTmp;
$page_size = 10;
$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()) {
$oHCT->SearchByClassId($oClassA->classId);
if($oHCT->GetRecord() == '0'){
$oCourse->SearchByKey($oClassA->courseId);
$oCourse->GetRecord();
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><img src="../picture/new.gif" align="absmiddle" border="0" onClick="sendValue(document.forms['pc'],<?php echo $oClassA->classId;?>,<?php echo $defineid;?>)"></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 oHC
$oCourse->SearchByKey($oClassA->courseId);
$oCourse->GetRecord();
?>
<tr>
<td height="22" align="center" bgcolor ="<?php echo $GLOBALS["COLOR_BG_TD_5"];?>">
<img src="../picture/editnew.gif" align="absmiddle" border="0" onClick="sendValue(document.forms['pc'],<?php echo $oClassA->classId;?>,<?php echo $defineid;?>)"></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="3" 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="courseInProgramTable.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>
<td colspan="3" align="right" bgcolor="#FFFFFF"> <font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>">
เลือกแล้ว <?php echo $countTmp ?>
รายการ <br>
จากทั้งหมด <?php echo $countClass; ?> รายการ</font>
</td>
</tr>
</table>
<table width="97%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="silver">
<tr>
<td width="76%"><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;?>">
<input type="hidden" name="defineid" value="<?php echo $defineid;?>">
<input type="hidden" name="noAss" value="<?php echo $noAss;?>">
</td>
<td width="24%" align="right"></td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#FFFFFF"><input type="button" name="back" value="กลับหน้าหลัก" onClick="doSubmitAll()" >
</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>
<tr>
<td width="65"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>"></font></td>
<td width="418"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>"><img src="../picture/new.gif" align="left" border="0" > หมายถึง ยังไม่ระบุสัปดาห์</font></td>
</tr>
<tr>
<td width="65"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>"></font></td>
<td width="418"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>"><img src="../picture/editnew.gif" align="left" border="0" > หมายถึง ระบุสัปดาห์แล้ว และทำการแก้ไขได้ </font></td>
</tr>
<tr>
<td width="65"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>"></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>
<script>
function sendValue(f,cl,de){
window.open('./timetableInCourse.php?acadYear='+f.acadYear.value+'&semester='+f.semester.value+'&assid='+f.assid.value+'&startDate='+f.startDate.value+'&endDate='+f.endDate.value+'&closeDate='+f.closeDate.value+'&selectFlag='+f.selectFlag.value+'&classId='+cl+'&defineid='+de+'&noAss='+f.noAss.value,'PopUp2','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=640,height=550,left = 240,top = 10') ;
//window.close();
}
</script>
|