Viewing file: 2554-11-04-2.0.02-editDefineStd.php (17.95 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "template.php";
showHeader();
?>
<script language="javascript">
function ChkDate(txtStart, txtEnd){
f = document.FormDefineStd;
var date1 = f.startDate.value.split("/");
var date2 = f.endDate.value.split("/");
//Set the two dates
date1 = new Date(eval(date1[2]), eval(date1[1]-1), eval(date1[0]));
date2 = new Date(eval(date2[2]), eval(date2[1]-1), eval(date2[0])); //Month is 0-11 in JavaScript
//Set 1 day in milliseconds
var one_day = 1000*60*60*24;
//Calculate difference btw the two dates, and convert to days
var diff = Math.ceil((date2.getTime()-date1.getTime())/(one_day));
if(diff < 0){
alert("กรุณาตรวจสอบ 'วันที่เริ่มต้น' ควรน้อยกว่า 'วันที่สิ้นสุด' !");
return false;
}
if (txtStart && txtEnd) {
var oblen = txtStart.length;
for (var i = 0; i < oblen; i++) {
if (!isvaliddate(txtStart[i], txtEnd[i])) {
return false;
}
}
}
return true;
}
function isvaliddate (txtStart, txtEnd)
{
var retval = true;
var ArrayStartDay = txtStart.split("/");
var ArrayStopDay = txtEnd.split("/");
var StartDay = ArrayStartDay[2] + ArrayStartDay[1] + ArrayStartDay[0];
var StopDay = ArrayStopDay[2] + ArrayStopDay[1] + ArrayStopDay[0];
if (StartDay > StopDay) {
alert("กรุณาตรวจสอบ 'วันที่สิ้นสุด' ควรน้อยกว่า 'วันที่ปิดการประเมิน' !");
retval = false;
}
return retval;
}
</script>
<?
include_once "../class/clsAssessForm.php";
include_once "../class/clsDefineAssessment.php";
include_once "../class/clsDoAssessmentHStd.php";
include_once "../class/clsHoldStudent.php";
include_once "../link/function.php";
include_once "../class/clsReg_SysSemesterDes.php";
confirmSubmit();
checkFormat();
ver3();
OpenWindow1();
$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']);
$oAF = new AssessForm($oCA);
$oDA = new DefineAssessment($oCA);
$oDoHStd = new DoAssessmentHStd($oCA);
$oSse = new SysSemesterDes($oCR);
$oHStd = new HoldStudent($oCA);
$oDA ->SearchByKey($defineid,$acadYear,$semester,$noAss);
$oDA->GetRecord();
$oAF->SearchByKey($oDA->assid);
$oAF->GetRecord();
$oSse->SearchByKey($oDA->semester);
$oSse->GetRecord();
if($acadYearList == "")
$acadYearList = $GLOBALS["ACADYEAR"];
if(!$semesterList)
$semesterList = $GLOBALS["SEMESTER"];
?>
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620">
<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="index.php?mm=1">กำหนดช่วงเวลาประเมิน</a>
<img src="../picture/ico3.gif" align="absmiddle" border="0"><a href="addDefineStd.php">
กำหนดช่วงเวลานักศึกษาประเมินโดยขึ้นกับชั้นปีนักศึกษา </a><img src="../picture/ico3.gif" align="absmiddle" border="0">
แก้ไข</font></legend>
<div align="center"><br>
<form name="FormDefineStd" method="post" action="processDefineStd.php">
<input type="hidden" name="method" value="edit">
<input type="hidden" name="assid" value="<?php echo $oAF->assid;?>">
<input type="hidden" name="defineid" value="<?php echo $oDA->defineid;?>">
<input type="hidden" name="acadYear" value="<?php echo $oDA->acadYear;?>">
<input type="hidden" name="semester" value="<?php echo $oDA->semester;?>">
<input type="hidden" name="noAss" value="<?php echo $oDA->noAss;?>">
<input type="hidden" name="flag" value="<?php echo $oDA->flag;?>">
<table width="698" align="center" border="0" cellpadding="0" cellspacing="1">
<tr>
<td align="center" colspan="2"><font size="3" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>"><strong>แก้ไขช่วงเวลาประเมินที่ขึ้นกับชั้นปีนักศึกษา</strong></font></td>
</tr>
<tr><td width="336"> </td></tr>
<tr>
<td colspan="2">
<table width="700" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="<?php echo $GLOBALS["COLOR_BORDER_TABLE_1"];?>">
<tr>
<td colspan="8" align="center">
<table width="652" align="center" border="0">
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_4"];?>">
<td width="183" height="22" valign="top"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b> แบบประเมินที่สร้าง</b></font></td>
<td colspan="3" height="22"> <font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><? if($oAF->maintopic == ""){ echo $oAF->nameAss." <img src = \"../picture/warn.png\" border = \"0\">"; }else{ echo $oAF->maintopic; } ?></font></td>
</tr>
<tr>
<td height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b> ปีการศึกษา</b></font></td>
<td height="22" colspan="3">
<font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo $oDA->acadYear;?></font></td>
</tr>
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_4"];?>">
<td height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b> ภาคการศึกษา</b></font></td>
<td height="22" colspan="3"> <font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo $oSse->semesterName;?>
(ลำดับที่ <?php echo $oDA->noAss;?>)</font></td>
</tr>
<tr>
<td height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b> ชั้นปีนักศึกษา</b></font></td>
<td height="22" colspan="3"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_5'];?>">
<? $x=1;
$oHStd->SearchByDefineid($defineid);
while($oHStd->GetRecord()){
$stdYearAssTmp[$oHStd->stdYearAss] = $oHStd->stdYearAss;
//echo "<br> stdYearAssTmp[$oHStd->stdYearAss] = ".$stdYearAssTmp[$oHStd->stdYearAss];
}
for($i=1;$i<=4;$i++){ ?>
<input type="checkbox" name="stdYearAssEdit[<? echo $i ?>]" value="<? echo $i ?>" <? if($stdYearAssTmp[$i] == $i) echo " checked"; ?> disabled>
<input type="hidden" name="stdYearAssEdit[<? echo $i ?>]" value="<? if($stdYearAssTmp[$i] == $i){ echo $i; }else{ echo ""; }?>">
ปี<? echo $i ?>
<? } ?></font>
</td>
</tr>
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TD_4"];?>">
<td height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b> ช่วงเวลาประเมิน</b></font></td>
<td width="36" height="22"> <script>DateInput('startDate', true, 'DD/MM/YYYY','<?php echo splitDateDb($oDA->startDate,"/");?>');</script>
</td>
<td width="23" height="22"><div align="center"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>ถึง</b></font></div></td>
<td width="390"> <script>DateInput('endDate', true, 'DD/MM/YYYY','<?php echo splitDateDb($oDA->endDate,"/");?>');</script>
</td>
</tr>
<tr>
<td height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b> วันที่ปิดการประเมิน</b></font></td>
<td colspan="3"><script>DateInput('closeDate', true, 'DD/MM/YYYY','<?php echo splitDateDb($oDA->closeDate,"/");?>');</script></td>
</tr>
<tr>
<td colspan="4" align="center"><br>
<input type="submit" name="add" value="แก้ไข" onClick="return ChkDate(new Array(this.form.endDate.value), new Array(this.form.closeDate.value));">
<input type="reset" name="clear" value="เคลียร์ข้อมูล">
<input type="button" name="cancel" value="ยกเลิก" onClick="location.href = 'addDefineStd.php'">
</td>
</tr>
</table>
<br> <br>
<table width="343" border="0" align="right">
<tr>
<td height="35" align="center" background="../picture/coverBG2.gif"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"> <b>ปีการศึกษา</b></font>
<font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>
<select name="select2" onChange="location.href = '<?php echo $PHP_SELF;?>?acadYearList='+encodeURI(options[selectedIndex].value)+'&semesterList=<?php echo $semesterList;?>'+'&defineid='+defineid.value+'&acadYear='+acadYear.value+'&semester='+semester.value+'&noAss='+noAss.value">
<?php
$oAy->RSAcadYearConfigGroupAcY();
while($oAy->GetRecord()) {
?>
<option value="<?php echo $oAy->acadYear;?>" <? if($acadYearList == $oAy->acadYear) echo "selected"; ?>><?php echo $oAy->acadYear;?></option>
<?php
}
?>
</select>
</b></font> <font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"> <b>ภาคการศึกษา
<select name="select" onChange="location.href ='<?php echo $PHP_SELF;?>?semesterList='+encodeURI(options[selectedIndex].value)+'&acadYearList=<?php echo $acadYearList;?>'+'&defineid='+defineid.value+'&acadYear='+acadYear.value+'&semester='+semester.value+'&noAss='+noAss.value">
<?php
$oSse->RSSysSemesterDes();
while($oSse->GetRecord()) {
?>
<option value="<?php echo $oSse->semester;?>" <? if($semesterList == $oSse->semester) echo "selected"?>><?php echo $oSse->semesterName;?></option>
<?php
}
?>
</select>
</b></font></td>
</tr>
</table></td>
</tr>
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
<td width="80" height="22" align="center"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_1"];?>"><strong>ภาคการศึกษาที่</strong></font></td>
<td width="33" align="center"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_1"];?>"><strong>ลำดับ</strong></font></td>
<td width="269" height="22" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><strong>รายการแบบประเมิน</strong></font></td>
<td width="42" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><strong>ชั้นปี</strong></font></td>
<td width="198" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><strong>ช่วงเวลาในการประเมิน</strong></font></td>
<td width="37" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><strong>แก้ไข</strong></font></td>
<td width="25" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><strong>ลบ</strong></font></td>
</tr>
<?php
$oDA->SearchByFlag('2');
//$numRow = $oDA->NumRow();
$numRow = $oDA->CountDefineidByFlagAcadSem('2',$acadYearList,$semesterList);
$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;
}
$i = 0;
$j = 0;
//$oDA->RSAssessLimitByFlag('2',$start, $page_size);
$oDA->RSAssessLimitByAcadSemFlag($acadYearList,$semesterList,'2',$start, $page_size);
while($oDA->GetRecord()){
//นับจำนวนการประเมินว่ามีการประเมินหลังจากที่กำหนดแบบประเมินและช่วงเวลาไปแล้วหรือไม่ ถ้ามีจะไม่สามารถลบการกำหนดช่วงเวลาในการประเมินไปแล้วได้
$numDoAss=$oDoHStd->CountDoidByDefineid($oDA->defineid);
//echo "<br> numDoAss = ".$numDoAss;
$oAF->SearchByKey($oDA->assid);
$oAF->GetRecord();
//หาความยาวของชื่อแบบประเมิน
$strNameAss = strlen($oAF->nameAss);
for($i=1;$i<=4;$i++){
$stdYearAssTmp1[$i] = "";
}
$x=1;
$oHStd->SearchByDefineid($oDA->defineid);
while($oHStd->GetRecord()){
$stdYearAssTmp1[$x] = $oHStd->stdYearAss;
$x++;
}
if(($j%2) == 0)
echo "<tr>";
else
echo "<tr bgcolor=\"".$GLOBALS["COLOR_BG_TD_4"]."\">";
?>
<td align="center"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_4"];?>"><?php echo $oDA->semester;?>/<?php echo $oDA->acadYear; ?></font></td>
<td align="center"><?php echo $oDA->noAss;?></td>
<td><a href="#" class='box' border="0" align="absmiddle" id=IMG3 style="CURSOR: hand" onClick='OpenWindow1("detailHoldStd.php?defineid=<?php echo $oDA->defineid;?>&acadYear=<?php echo $oDA->acadYear;?>&semester=<?php echo $oDA->semester;?>&noAss=<?php echo $oDA->noAss;?>",540,260,280,210)' title="วันที่ปิดการประเมิน <?php echo abbreDate2($oDA->closeDate,'/');?>"><img src="../picture/search.gif" width="13" height="16" border="0">
<?php if($oAF->maintopic == ""){ echo substr($oAF->nameAss,0,40)."<img src = \"../picture/warn.png\" border = \"0\">"; $strNameAss = strlen($oAF->nameAss); if($strNameAss >= 40) echo "..."; }else{ echo substr($oAF->maintopic,0,40); $strNameAss = strlen($oAF->maintopic); if($strNameAss >= 40) echo "..."; } ?></a></td>
<td align="center">
<?
$round = 0;
for($i=1;$i<=4;$i++){
if($stdYearAssTmp1[$i] != ""){
$round ++;
}
}
for($i=1;$i<=4;$i++){
echo $stdYearAssTmp1[$i];
if($i<=$round-1){
echo ",";
}
}
?>
</td>
<td align="center">
<?php echo abbreDate2($oDA->startDate,'/');?>
(ถึง)
<?php echo abbreDate2($oDA->endDate,'/');?>
</td>
<td align="center"><a href="editDefineStd.php?defineid=<?php echo $oDA->defineid ?>&acadYear=<?php echo $oDA->acadYear ?>&semester=<?php echo $oDA->semester ?>&noAss=<?php echo $oDA->noAss ?>"><img src="../picture/editnew.gif" width="23" height="19" align="absmiddle" border="0"></a></td>
<td align="center">
<? if($numDoAss == '0') { ?>
<a href="processDefineStd.php?method=delete&defineid=<?php echo $oDA->defineid;?>&acadYear=<?php echo $oDA->acadYear;?>&semester=<?php echo $oDA->semester;?>&noAss=<?php echo $oDA->noAss;?>" onClick='return confirmSubmit("คุณต้องการลบข้อมูลแน่นอนใช่หรือไม่ ?")'><img src="../picture/deletenew.gif" width="16" height="19" align="absmiddle" border="0"></a>
<? } else { ?>
<img src="../picture/deleted.gif" width="16" height="19" align="absmiddle" border="0">
<? } ?>
</td>
</tr>
<?php
$j++;
} //end while oDA
if($j == 0){
?>
<tr>
<td colspan="7" height="22" align="center"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">**
ไม่ปรากฏรายการในฐานข้อมูล **</font></td>
</tr>
<?php
}
?>
</table></td>
</tr>
<tr>
<td><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="editDefineStd.php?defineid=<?php echo $defineid;?>&acadYear=<?php echo $acadYear;?>&semester=<?php echo $semester;?>&noAss=<?php echo $noAss;?>&page_id=<?php echo $num;?>&semesterList=<? echo $semesterList ?>&acadYearList=<? echo $acadYearList ?>"><?php echo '[ '.$num.' ]';?></a>
<?php
}
}
?>
</font></td>
<td width="359" align="right"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_4"];?>">รวม <?php echo $numRow;?> รายการ</font></td>
</tr>
<tr>
<td colspan="2"><input type="button" name="back2" value="กลับเมนูหลัก" onClick="location.href = 'index.php?mm=1'">
<input type="button" name="back" value="ย้อนกลับ" onClick="location.href = 'addDefineStd.php'"></td>
</tr>
</table></form></div>
</fieldset><br>
<table width="102%" border="0" align="center">
<tr>
<td width="9%"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>"><b>หมายเหตุ
:</b></font></td>
<td width="91%"><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>">*
หมายถึง ต้องกรอกข้อมูลให้สมบูรณ์,</font></td>
</tr>
<tr>
<td height="22"> </td>
<td><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>"> <a href="processDefineAllCourse.php?method=delete&defineid=<?php echo $oDA->defineid;?>&acadYear=<?php echo $oDA->acadYear;?>&semester=<?php echo $oDA->semester;?>&noAss=<?php echo $oDA->noAss;?>" onClick='return confirmSubmit("คุณต้องการลบข้อมูลแน่นอนใช่หรือไม่ ?")'><img src="../picture/deleted.gif" width="16" height="19" align="absmiddle" border="0"></a>
หมายถึง ไม่สามารถลบรายการที่กำหนดนั้นๆ ได้ เนื่องจากได้มีนักศึกษาเข้ามาประเมินแล้ว</font></td>
</tr>
</table>
<font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"];?>">์</font></td>
</tr>
</table>
<?php
$oCA->Disconnect();
$oCR->Disconnect();
showFooter();
?>
|