Viewing file:      v_add_integration.php (6.75 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<script language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script>
 <script language="javascript" >
     $(document).ready(function(){
         var seq = $("#itg_seq").attr('value');
         if (seq =='') {
             var number = parseInt($("#table_show tr:last").children("td:first-child").text())+1 ;
             if(isNaN(number)){ number=1; }
             $("#itg_seq").attr('value',number);
         }
     });
 </script>
 <script language="javascript">
     function doSubmit(){
 
         for (var i=0; i < 2; i++)
         {
            if (document.myform.atb_status[i].checked)
            {
               var atb_status = document.myform.atb_status[i].value;
             }
         }
         document.myform.atb_status.value = atb_status;
         document.myform.submit();
     }
 </script>
 <?php
     $_image_reply = array(
                     'src' => 'images/edit.png',         
                     'width' => '15',
                     'height' => '15',
                     'border' => '0',
                     'title' => 'แก้ไขข้อมูล',
                     'onmouseover' => "this.style.cursor='pointer'"
     );
     $_image_del = array(
                     'src' => 'images/delete.png',         
                     'width' => '15',
                     'height' => '15',
                     'border' => '0',
                     'title' => 'ลบข้อมูล',
                     'onmouseover' => "this.style.cursor='pointer'"
     );//
     $_image_add = array(
                     'src' => 'images/esa/add.gif',         
                     'width' => '15',
                     'height' => '15',
                     'border' => '0',
                     'title' => 'เพิ่ม',
                     'align' => 'absmiddle',
                     'onmouseover' => "this.style.cursor='pointer'"
     );//
 $itg = ($qu_itg->num_rows() > 0 ) ? $qu_itg->row() : NULL;
 ?>
 
 <?php echo form_open('esa/base_data/add_integration');?>
 <table id="table_input" class='szone2' width="60%" border="0">
 
     <tr >
         <th width="25%" align="right">บูรณาการกับฝ่ายอื่นๆ</th>
         <td width="75%" >
 <?php
 
     //echo "id(".getval('atb_id', $itg).")   ";
     if($add == 'TRUE' || $add == 'เพิ่ม' ){
         $a_id = 0;
         $a_pid = set_value('itg_parentId',getval('itg_id', $itg));
         $a_name = '';
         //echo (getval('atb_name', $itg))?getval('atb_name', $itg).'<br> หัวข้อย่อย :':'';
         echo ($qu_itg->num_rows() > 0 )? $itg->itg_name.'<br> ฝ่ายย่อย :':'';
     }else{
         if (getval('itg_parentId',$itg) == 0) {
             $a_id = getval('itg_id', $itg);
             $a_pid = getval('itg_parentId', $itg);
             $a_name = getval('itg_name', $itg);
         } else {
             $a_id = getval('itg_id', $itg);
             $a_pid = getval('itg_parentId', $itg);
             $a_name = getval('itg_name', $itg);
             echo getval('p_name', $itg)?getval('p_name', $itg).'<br> แก้ไขฝ่ายย่อย :':'';
         }
         //echo (getval('atb_name', $itg))?getval('atb_name', $itg).'<br> แก้ไขหัวข้อย่อย :':'';
     }
 ?>
             <input type="hidden" name="itg_id" value="<?php echo $a_id;?>" />
             <input type="hidden" name="itg_parentId" value="<?php echo $a_pid;?>" />
             <input type="text" name="itg_name" id="itg_name" value="<?php echo $a_name;?>" size="50" /><font color='red'> *</font>
             <input type="submit" name="add" value="<?php echo ($add == 'TRUE'  || $add == 'เพิ่ม' )?'เพิ่ม':'แก้ไข';?>" />
             <?php echo form_error('itg_name'); ?>
             <?php echo isset($error_name)?$error_name:''; ?>
         </td>
     </tr>
 </table><br />
 <table id="table_show" class='tb_1' width="60%" border="0">
 
     <tr>
         <th >บูรณาการกับฝ่ายอื่นๆ</th>
         <th width="10%">แก้ไข</th>
         <th width="5%">ลบ</th>
     </tr>
 <?php 
 if ($rs_itg->num_rows > 0) {
     $index=1;
     $p = 1;
     $p_index=0;
     foreach ($rs_itg->result() as $row) {
 
         if($row->p_itg_id != $p_index){
             $p_index = $row->p_itg_id ;
 ?>
     <tr>
 
         <td align="left"> <?php if($row->p_itg_parentId!=0){echo nbs(2); }else{ ?>
         <span class="hand" onClick="sendPost('myform', {'itg_id':<?php echo $row->p_itg_id;?>,'add':'TRUE'}, 'integration')"><?php echo img($_image_add)?></span><b><?php }?> <font size="2"><?php echo $row->p_itg_name;?></b></font></td>
         <td align="center"><span class="hand" onClick="sendPost('myform', {'itg_id':<?php echo $row->p_itg_id;?>,'add':'FALSE'}, 'integration')"><?php echo img($this->config->item('sa_image_reply'));?></span></td>
         <td align="center"><span class="hand" onClick="if (confirm('ต้องการลบใช่หรือไม่')) { sendPost('hidform', {'itg_id':<?php echo $row->p_itg_id;?>,'add':'FALSE'}, 'del_integration'); }"><?php echo img($this->config->item('sa_image_del'));?></td>
     </tr>
 
 <?
             if($row->itg_id !=NULL){
                 $index++;
 ?>
     <tr >
 
         <td align="left"> <?php if($row->itg_parentId!=0){echo nbs(4); }else{ ?><span class="hand" onClick="sendPost('myform', {'atb_id':<?php echo $row->itg_id;?>,'add':'TRUE'}, 'integration')"><?php echo img($_image_add);?></span><?php } ?> <font size="2"><?php echo $row->itg_name;?></b></font></td>
         <td align="center"><span class="hand" onClick="sendPost('myform', {'itg_id':<?php echo $row->itg_id;?>,'add':'FALSE'}, 'integration')"><?php echo img($this->config->item('sa_image_reply'));?></span></td>
         <td align="center"><span class="hand" onClick="if (confirm('ต้องการลบใช่หรือไม่')) { sendPost('hidform', {'itg_id':<?php echo $row->itg_id;?>}, 'del_integration'); }"><?php echo img($this->config->item('sa_image_del'));?></span></td>
     </tr>
 <?
             }
         }else{
         
 ?>
         
     <tr >
 
         <td align="left"> 
         <?php  if($row->itg_parentId!=0){ echo nbs(2); 
             }else{ ?>
         <span class="hand" onClick="sendPost('myform', {'itg_id':<?php echo $row->itg_id;?>,'add':'TRUE'}, 'integration')"><?php echo img($_image_add);?></span>
         <?php }?> 
         <font size="2"><?php echo $row->itg_name;?></b></font></td>
         <td align="center"><span class="hand" onClick="sendPost('myform', {'itg_id':<?php echo $row->itg_id;?>,'add':'FALSE'}, 'integration')"><?php echo img($this->config->item('sa_image_reply'));?></span></td>
         <td align="center"><span class="hand" onClick="if (confirm('ต้องการลบใช่หรือไม่')) { sendPost('hidform', {'itg_id':<?php echo $row->itg_id;?>}, 'del_integration'); }"><?php echo img($this->config->item('sa_image_del'));?></span>
     </tr>
 <?php 
         }
         $index++;
     }
 } else {
 ?>
         <tr class='notfound'>
             <td colspan="12" align="center"><?php echo $this->config->item('sa_not_found');?></td>
         </tr>
 <?php 
 }
 ?>
 </table>
 <?php echo form_close();?>
  |