Viewing file: v_addExamSchedule.php (12.86 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<script language="javascript">
var auto_num =0;
function addRow () {
var target = jQuery("#prsId");
var childObj = target.clone();
var text = target.parents("td:first").prev().text();
var no = jQuery(":input[name='prsId\[\]']").length +1;
var color = target.parents("tr:first").prev().attr("bgcolor");
text = text.replace(/[0-9]/,"");
var html = "<tr bgcolor=\""+color+"\">";
html += "<td class=\"coltd_szone\">"+text+" "+no+"</td>";
html += "<td colspan=\"3\"><select name=\"prsId[]\" class=\"prsId\" id=\"prsId_"+no+"\">";
html += childObj.html();
html += "</td>"
html += "</tr>";
jQuery(html).insertAfter(jQuery(":input[name='prsId\[\]']:last").parents("tr:first"));
jQuery(":input[id='prsId_"+no+"']").val("");
}
function checkFormat () {
var esStId = jQuery("#esStId");
var esRmId = jQuery("#esRmId");
var esPrdFrTime = jQuery("#esPrdFrTime");
var esPrdToTime = jQuery("#esPrdToTime");
var esDate = jQuery(":input[name='esDate']");
var MFExamSDate = jQuery("#MFExamSDate");
var MFExamEDate = jQuery("#MFExamEDate");
var msg = "";
var flg = true;
if (esStId.val() =="") {
msg = "กรุณาเลือกประเภทวิชา !!";
flg = false;
esStId.focus();
} else if (esRmId.val() == "") {
msg = "กรุณาเลือกห้อง !!";
flg = false;
esRmId.focus();
} else if (esPrdFrTime.val() == "") {
msg = "กรุณาเลือกเวลาสอบจาก !!";
flg = false ;
esPrdFrTime.focus();
} else if (esPrdToTime.val() == "") {
msg = "กรุณาเลือกเวลาสอบถึง !!";
flg = false;
esPrdToTime.focus();
} else if (parseInt(esPrdFrTime.val(), 10) > parseInt(esPrdToTime.val(), 10)) {
msg = "กรุณาเลือกเวลาสอบถึงใหม่ เนื่องจากเวลาสอบไม่ถูกต้อง !!";
flg = false;
esPrdToTime.focus();
} else if (!isvaliddate(MFExamSDate.val(), esDate.val())) {
flg = false;
} else if (!isvaliddate(esDate.val(), MFExamEDate.val())) {
flg = false;
}
if (msg) {
alert(msg);
}
return flg;
}
</script>
<?php
$row_cur = isset($qu_cur) ? $qu_cur->row() : NULL;
$row_sy = isset($qu_sy) ? $qu_sy->row() : NULL;
$row_tm = isset($qu_tm) ? $qu_tm->row() : NULL;
$row_ex = isset($qu_ex) ? $qu_ex->row() : NULL;
$row_es = isset($rs_es) ? $rs_es->row() : NULL;
$row_co = isset($qu_co) ? $qu_co->row() : NULL;
$row_sd = isset($qu_sd) ? $qu_sd->row() : NULL;
?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center">
<?php echo form_open($this->config->item("rg_folder")."preregis/es_insert", array("name" => "myform", "id" => "myform"));?>
<table width="100%" align="center" cellpadding="0" cellspacing="0" boder="0">
<tr>
<td align="center"><span class="h" style="color:<?php echo $font_color_err;?>">บันทึกการจัดตารางสอบ</span></td>
</tr>
<tr>
<td><br /></td>
</tr>
<tr>
<td><table class="szone">
<tr bgcolor="<?php echo $tr_color_even;?>">
<td class="coltd_szone"><span>หลักสูตร</span></td>
<td colspan="3"><font size="2" color="<?php //echo $GLOBALS["COLOR_FONT_4"];?>"><?php echo getval('curName', $row_cur, 'เรียนรวมหลายหลักสูตร');?></font>
<input type="hidden" name="curId" value="<?php echo getval('curId', $row_cur);?>" /></td>
</tr>
<tr bgcolor="<?php echo $tr_color_even;?>">
<td class="coltd_szone"><span>ชั้นปีที่</span></td>
<td colspan="3"><span><?php echo getval('syCode', $row_sy);?></span>
<input type="hidden" name="syId" value="<?php echo getval('syId', $row_sy);?>" /></td>
</tr>
<tr bgcolor="<?php echo $tr_color_even;?>">
<td class="coltd_szone"><span>ภาค/ปีการศึกษา</span></td>
<td colspan="3"><span><?php echo getval('tmCode', $row_tm).'/'.$acY;?></span>
<input type="hidden" name="acY" value="<?php echo $acY;?>" />
<input type="hidden" name="tmId" value="<?php echo getval('tmId', $row_tm);?>" /></td>
</tr>
<tr bgcolor="<?php echo $tr_color_even;?>">
<td class="coltd_szone"><span>สอบ</span></td>
<td colspan="3"><span><?php echo getval('exName', $row_ex);?></span>
<input type="hidden" name="exType" value="<?php echo getval('exType', $row_ex);?>" /></td>
</tr>
<?php
if (isset($coId) && $coId) {
?>
<tr bgcolor="<?php echo $tr_color_even;?>">
<td class="coltd_szone"><span>รายวิชาที่เปิดสอน</span></td>
<td><span><?php echo getval('crsCode', $row_co).' '.getval('crsName', $row_co);?></span></td>
<td class="coltd_szone"><span>กลุ่ม</span></td>
<td><span><?php echo getval('coSection', $row_co);?></span>
<input type="hidden" name="coId" value="<?php echo $coId;?>" />
<input type="hidden" id="MFExamSDate" name="MFExamSDate" value="<?php echo (getval('exType', $row_ex) == 'M') ? splitDateDb2(getval('sdMidExamSDate', $row_sd), '/') : splitDateDb2(getval('sdFinalExamSDate', $row_sd), '/');?>" />
<input type="hidden" id="MFExamEDate" name="MFExamEDate" value="<?php echo (getval('exType', $row_ex) == 'M') ? splitDateDb2(getval('sdMidExamEDate', $row_sd), '/') : splitDateDb2(getval('sdFinalExamEDate', $row_sd), '/');?>" /></td>
</tr>
<tr bgcolor="<?php echo $tr_color_even;?>">
<td class="coltd_szone"><span>ประเภทวิชา</span></td>
<td><span><?php echo form_dropdown('esStId', $rs_st, getval('esStId', $row_es), "id=\"esStId\"");?>
<?php echo form_error('esStId');?></span></td>
<td class="coltd_szone"><span>ห้อง</span></td>
<td><span><?php echo form_dropdown('esRmId', $rs_rm, getval('esRmId', $row_es), "id=\"esRmId\"");?>
<?php echo form_error('esRmId');?></span></td>
</tr>
<tr bgcolor="<?php echo $tr_color_even;?>">
<td class="coltd_szone"><span>เวลาสอบจาก</span></td>
<td><span><?php echo form_dropdown('esPrdFrTime', $rs_prd, getval('esPrdFrTime', $row_es), "id=\"esPrdFrTime\"");?>
<?php echo form_error('esPrdFrTime');?></span></td>
<td class="coltd_szone"><span>เวลาสอบถึง</span></td>
<td><span><?php echo form_dropdown('esPrdToTime', $rs_prd, getval('esPrdToTime', $row_es), "id=\"esPrdToTime\"");?>
<?php echo form_error('esPrdToTime');?></span></td>
</tr>
<tr bgcolor="<?php echo $tr_color_even;?>">
<td class="coltd_szone"><span>วันที่สอบ</span></td>
<td colspan="3"><script>DateInput('esDate', true, 'DD/MM/YYYY',"<?php echo set_value('esDate') ? set_value('esDate') : splitDateDb2(getval('esDate', $row_es, getNowDate()), '/');?>");</script></td>
</tr>
<?php
$index = 1;
if (isset($rs_es)) {
foreach ($rs_es->result() as $row_es) {
?>
<tr bgcolor="<?php echo $tr_color_even;?>">
<td class="coltd_szone">อาจารย์ผู้คุมสอบ <?php echo $index;?></td>
<td colspan="3"><span>
<?php echo form_dropdown('prsId[]', $rs_prs, $row_es->esPrsId, "id=\"prsId\"");?></span></td>
</tr>
<?php
$index++;
}
} else {
?>
<tr bgcolor="<?php echo $tr_color_even;?>">
<td class="coltd_szone">อาจารย์ผู้คุมสอบ <?php echo $index;?></td>
<td colspan="3"><span>
<?php echo form_dropdown('prsId[]', $rs_prs, set_value('prsId[]'), "id=\"prsId\"");?></span></td>
</tr>
<?php
}
?>
<tr bgcolor="<?php echo $tr_color_even;?>">
<td colspan="4" align="center">
<input type="submit" id="btnSubmit" name="btnSubmit" value="บันทึก" onclick="return checkFormat()" />
<input type="reset" id="btnClear" name="btnClear" value="เคลียร์ข้อมูล" />
<input type="button" id="btnAddRow" name="btnAddRow" onClick="addRow()" value="เพิ่มอาจารย์คุมสอบ" /></td>
</tr>
</table></td>
</tr>
<?php
} // end if coId
?>
</table><?php echo form_close();?>
<br>
<table class="headCol">
<tr>
<th class="seqCol"><span>ลำดับที่</span></th>
<th class="indent"><span>วิชา/กลุ่ม</span></th>
<th class="domCol"><span>วันที่/เวลาสอบ</span></th>
<th class="domAmtCol"><span>ห้องสอบ</span></th>
<th><span>อาจารย์ผู้คุมสอบ</span></th>
<th class="groupCol"><span>กำหนด</span></th>
</tr>
<?php
$num_rows = count($rs);
if ($num_rows) {
foreach ($rs as $key => $val) {
$row_co = isset($rs[$key]['qu_co']) ? $rs[$key]['qu_co']->row() : NULL;
$row_rm = isset($rs[$key]['qu_rm']) ? $rs[$key]['qu_rm']->row() : NULL;
$row_prd1 = isset($rs[$key]['qu_prd1']) ? $rs[$key]['qu_prd1']->row() : NULL;
$row_prd2 = isset($rs[$key]['qu_prd2']) ? $rs[$key]['qu_prd2']->row() : NULL;
$row_st = isset($rs[$key]['qu_st']) ? $rs[$key]['qu_st']->row() : NULL;
echo "<tr onmouseover=\"bgColor='".$tr_color_even."'\" onmouseout=\"bgColor='".$this->config->item("rg_mouseout")."'\">";
?>
<td align="center"><span><?php echo $key+1;?></span></td>
<td class="indent">
<span><?php echo getval('crsCode', $row_co).' '.getval('crsName', $row_co).' กลุ่ม '.getval('coSection', $row_co);?></span>
<span><?php echo (getval('curId', $row_cur) && is_null(getval('coCurId', $row_co))) ? '(เรียนรวมหลายหลักสูตร)' : '';?><br />
<?php echo '['.$rs[$key]['pgNames'].']';?></span></td>
<td align="center"><span><?php echo $rs[$key]['mtd'] ? (($rs[$key]['esDate']) ? abbreDate2($rs[$key]['esDate']) : '').'<br />'.getval('prdFrTime', $row_prd1).'-'.getval('prdToTime', $row_prd2) : '-';?></span></td>
<td align="center"><span><?php echo $rs[$key]['mtd'] ? getval('plRmNo', $row_rm).' ('.getval('stAbbrE', $row_st).')' : '-';?></span></td>
<td class="indent"><span><?php echo $rs[$key]['mtd'] ? $rs[$key]['prsNames'] : '-';?></span></td>
<td align="center">
<?php
if (getval('curId', $row_cur) && is_null(getval('coCurId', $row_co))) {
echo '-';
} else {
if ($rs[$key]['mtd']) {
$image = base_url().$this->config->item('rg_edit');
} else {
$image = base_url().$this->config->item('rg_add_addEs');
}
?>
<span class="hand" onClick="sendPost('hidform', {'coId':<?php echo getval('coId', $row_co);?>,'curId':'<?php echo getval('curId', $row_cur);?>','syId':<?php echo getval('syId', $row_sy);?>,'acY':<?php echo $acY;?>,'tmId':<?php echo getval('tmId', $row_tm);?>,'exType':'<?php echo getval('exType', $row_ex);?>'}, 'es_input')"><img src="<?php echo $image;?>" align="absmiddle" border="0" /></span>
<?php
}
?>
</td>
</tr>
<?php
} // end foreach
} else {
?>
<tr>
<td colspan="6" align="center"><span style="color:<?php echo $font_color_err;?>">** ไม่ปรากฏรายการตารางสอบในฐานข้อมูล **</span></td>
</tr>
<?php
}
?>
<tr>
<td colspan="6"><span style="color:<?php echo $font_color_err;?>">** ข้อความที่ปรากฏ
<?php
$i = 0;
foreach ($rs_st2->result() as $row_st2) {
echo '('.$row_st2->stAbbrE.') : '.$row_st2->stName;
echo ($i) ? ', ' : '';
$i++;
}
?>
</span></td>
</tr>
</table>
<tr>
<td colspan="6" align="right"><font size="2" color="<?php //echo $GLOBALS["COLOR_FONT_4"];?>">รวม <?php echo $num_rows;?> รายการ</font></td>
</tr>
</div><br></td>
</tr>
<tr>
<td><table width="100%">
<tr>
<td width="8%"><span style="color:<?php echo $font_color_err;?>"><b>หมายเหตุ : </b></span></td>
<td><img src="<?php echo base_url().$this->config->item('rg_add_addEs');?>" align="absmiddle" border="0">
<span style="color:<?php echo $font_color_err;?>">หมายถึง ยังไม่ได้กำหนดวัน เวลาและห้องสอบในรายวิชานั้น</span></td>
</tr>
<tr>
<td></td>
<td><img src="<?php echo base_url().$this->config->item('rg_edit');?>" align="absmiddle" border="0">
<span style="color:<?php echo $font_color_err;?>">หมายถึง ได้กำหนดวัน เวลาและห้องสอบในรายวิชานั้นแล้วและสามารถแก้ไขวัน เวลาและห้องสอบได้</span></td>
</tr>
</table></td>
</tr>
</table>
|