Viewing file:      v_showNews.php (8.3 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<script language="javascript">
 var auto_num =0;
 function addRow () {
     var target = jQuery("#doc");
     var text = target.parents("td:first").prev().text();
     var no = jQuery(":input[name='doc\[\]']").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\">";
         html += " <input type=\"text\" name=\"docName[]\" id=\"docName_"+no+"\" size=\"40\" value=\"เอกสารประกอบ "+no+"\"/>";
         html += " <input type=\"file\" name=\"doc[]\" class=\"doc\" id=\"doc_"+no+"\">";
         html += "</td>"
         html += "</tr>";
         jQuery(html).insertAfter(jQuery(":input[name='doc\[\]']:last").parents("tr:first"));
         jQuery(":input[id='doc_"+no+"']").val("");
 }
 </script>
 <?php
 $row_nw = (isset($qu_nw) && $qu_nw!=NULL) ? $qu_nw->row() : NULL;
 ?>
 <table width="100%" align="center">
     <tr>
         <td><div align="center"><table width="100%">
                 <tr>
                     <td align="center"><span class="h error">แจ้งข่าวประกาศ</span></td>
                 </tr>
                 <tr>
                     <td><br /></td>
                 </tr>
 <?php
                 echo form_open_multipart($this->config->item("rg_folder")."faq/nw_insert_update");
 ?>
                 <tr>
                     <td><table class="szone">
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone">หัวเรื่องข่าว</td>
                             <td><input type="text" id="nwTitle" name="nwTitle" size="30" value="<?php echo getval('nwTitle', $row_nw);?>">
                             <span class="error">* <?php echo form_error('nwTitle');?></span></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone">ระบบ</td>
                             <td>
 <?php
                             echo form_dropdown('nwSystem', $rs_sys, setValue('nwSystem',$row_nw));
 ?>
                             <span class="error">*<?php echo form_error('sys');?></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone">วันที่เริ่มการแสดงข่าว</td>
                             <td><script>DateInput('nwFrDate', true, 'DD/MM/YYYY', "<?php echo set_value('nwFrDate') ? set_value('nwFrDate') : splitDateDb2(getval('nwFrDate', $row_nw, getNowDate()), '/');?>");</script>
                             <span class="error"><?php echo form_error('nwFrDate');?></span></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone">วันที่สิ้นสุดการแสดงข่าว</td>
                             <td><script>DateInput('nwToDate', true, 'DD/MM/YYYY', "<?php echo set_value('nwToDate') ? set_value('nwToDate') : splitDateDb2(getval('nwToDate', $row_nw, getNowDate()), '/');?>");</script>
                             <span class="error"><?php echo form_error('nwToDate');?></span></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone">ประกาศโดย</td>
                             <td><input type="text" id="nwAnnoucedBy" name="nwAnnoucedBy" size="20" value="<?php echo getval('nwAnnoucedBy', $row_nw);?>">
                             <span class="error">* <?php echo form_error('nwAnnoucedBy');?></span></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone">ไฟล์รูปภาพ</td>
                             <td>
                             <input type="file" name="nwPicture" id="nwPicture" value="<?php echo set_value('nwPicture');?>" />
                             <span class="error"> (ขนาดรูปภาพควรมีขนาด 100x115 pixels เป็น .jpg เท่านั้น และขนาดไฟล์ไม่เกิน 2 MB)</span>
                             <span class="error"><?php echo form_error('nwPicture');?></span>
                             </td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone">รายละเอียด</td>
                             <td>
 <?php
                             $att = array('name'        => 'nwDetail',
                                          'id'        => 'nwDetail',
                                          'value'    => setValue('nwDetail',$row_nw),
                                          'rows'        => 5,
                                          'cols'        => 50);
                             echo form_textarea($att);
 ?>
                             <span class="error">* <?php echo form_error('nwDetail');?></span></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone">วันที่แจ้งข่าวประกาศ</td>
                             <td><?php echo fullDate(getNowDateFw());?>
                             <input type="hidden" name="nwCreateDate" id="nwCreateDate" value="<?php echo getNowDate();?>" /></td>
                         </tr>
                         <?php $index=1; ?>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td class="coltd_szone">แนบไฟล์ <?php echo $index;?></td>
                             <td colspan="3">
                             <input type="text" name="docName[]" id="docName" value="<?php echo set_value('docName[]')=="" ? "เอกสารประกอบ 1" : set_value('docName[]');?>" size="40" maxlength="70" />
                             <input type="file" name="doc[]" id="doc" value="<?php echo set_value('doc[]');?>" /></td>
                         </tr>
                         <tr bgcolor="<?php echo $tr_color_even;?>">
                             <td colspan="2" align="center">
                             <input type="button" id="btnAddRow" name="btnAddRow" onClick="addRow()" value="เพิ่มแนบไฟล์" />
                             <input type="submit" name="add" value="บันทึก" />
                             <input type="reset" name="clear" value="เคลียร์ข้อมูล">
                             <input type="hidden" id="nwId" name="nwId" value="<?php echo setValue('nwId', $row_nw);?>" /></td>
                         </tr>
                     </table></td>
                 </tr>
                 <?php echo form_close();?>
                 <tr>
                     <td><br /></td>
                 </tr>
                 <tr>
                     <td colspan="2"><table class="headCol">
                         <tr>
                             <th class="seqCol">ลำดับที่</th>
                             <th>หัวเรื่องข่าวประกาศ</th>
                             <th>ระบบ</th>
                             <th class="stdCodeCol">ประกาศโดย</th>
                             <th class="editCol">แก้ไข</th>
                             <th class="deleteCol">ลบ</th>
                         </tr>
 <?php
             $i = 0;
             if(isset($rs_nw) && count($rs_nw)) {
                 foreach ($rs_nw as $key => $row_nw) {
                     foreach($row_nw->result() as $row) {
                         echo "<tr onmouseover=\"bgColor='".$tr_color_even."'\" onmouseout=\"bgColor='".$this->config->item("rg_mouseout")."'\">";
 ?>
                             <td align="center"><?php echo $i+1;?></td>
                             <td class="indent">
                             <span class="hand" onClick="sendPost(
                             'hidform', 
                             {'nwId':<?php echo $row->nwId;?>},
                              '<?php echo site_url($this->config->item('rg_folder').'faq/nw_showDetail');?>',
                              {})"><?php echo $row->nwTitle;?></span></td>
                             <td class="indent"><?php echo $row->StNameT;?></td>
                             <td class="indent"><?php echo $row->nwAnnoucedBy;?></td>
                             <td align="center">
                             <img class="hand" src="<?php echo base_url().$this->config->item('rg_edit');?>" align="absmiddle" border="0" onClick="sendPost('hidform',
                             {'nwId':<?php echo$row->nwId;?>},
                             '<?php echo site_url($this->config->item('rg_folder').'faq/nw_show');?>')" /></td>
                             <td align="center">
                             <span onClick="confirmDel2({nwId:<?php echo $row->nwId;?>}, 'm_form1','<?php echo site_url($this->config->item('rg_folder').'faq/nw_delete');?>')" />
                             <img src="<?php echo base_url().$this->config->item('rg_delete');?>" align="absmiddle" border="0" width="16" height="19" class="hand"/></span></td>
                         </tr>
 <?php
                         $i++;
                     }
                 }
             } else {
 ?>
                         <tr>
                             <td align="center" height="22" colspan="5"><span class="error">** ไม่ปรากฏรายการข่าวในฐานข้อมูล **</span></td>
                         </tr>
 <?php    
             }
 ?>
                     </table></td>
                 </tr>
                 <tr>
                     <td colspan="2" align="right">รวม <?php echo $i;?> รายการ</td>
                 </tr>
             </table><?php echo form_close();?></div>
         <br /><table class="mark">
             <tr>
                 <td class="coltd_mark"><span class="error"><strong>หมายเหตุ : </strong></span></td>
                 <td><span class="error">* หมายถึง ต้องกรอกข้อมูลให้สมบูรณ์</span></td>
             </tr>
             <tr>
                 <td class="coltd_mark"></td>
                 <td><span class="error">นำเมาส์ไปคลิกที่หัวเรื่องข่าวประกาศ เพื่อดูรายละเอียดของข่าวประกาศ</span></td>
             </tr>
         </table></td>
     </tr>
 </table>
  |