Viewing file: v_add_attribute_old.php (6.63 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 = $("#atb_seq").attr('value');
if (seq =='') {
var number = parseInt($("#table_show tr:last").children("td:first-child").text())+1 ;
if(isNaN(number)){ number=1; }
$("#atb_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();
}
function do_delete_atb(id,type){
var answer = confirm("ต้องการลบใช่หรือไม่");
alert(answer);
if (answer){
alert(document.myform.action);
alert('answer='+answer);
document.myform.action = 'esa/base_data/del_atb';
document.myform.atb_id.value = id;
document.myform.atb_type.value = type;
document.myform.submit();
}
return false;
}
</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'"
);//
//$atb = $atb_->row();
?>
<?php echo form_open('esa/base_data/add_attribute');?>
<table id="table_input" class='tb_1' width="60%" border="0">
<tr class='light'>
<td width="25%" align="right">คุณลักษณะโครงการ : </td>
<td width="75%" >
<?
if($add){
$a_id = 0;
$a_pid = getval('atb_id', $atb);
$a_name = '';
echo getval('atb_name', $atb).'<br>';
}else{
$a_id = getval('atb_id', $atb);
$a_pid = getval('atb_parentId', $atb);
$a_name = getval('atb_name', $atb);
}
?>
<input type="hidden" name="atb_id" value="<?php echo $a_id;?>" />
<input type="hidden" name="atb_parentId" value="<?php echo $a_pid;?>" />
<input type="text" name="atb_name" id="atb_name" value="<?php echo $a_name;?>" size="50" /><font color='red'>*</font>
<input type="submit" name="add" value="เพิ่ม" /><?php echo form_error('atb_name'); ?></td>
</td>
</tr>
<tr >
<td colspan="2" align="center">
</tr>
<tr >
<td colspan="2" height=22></td>
</tr>
</table>
<table id="table_show" class='tb_1' width="60%" border="0">
<tr>
<th align="center" >คุณลักษณะโครงการ</th>
<th align="center" width="10%">แก้ไข</th>
<th align="center" width="5%">ลบ</th>
</tr>
<?php
if ($qu_atb->num_rows > 0) {
$index=1;
$p = 1;
$p_index=0;
foreach ($qu_atb->result() as $row) {
if($index%2 == 0)
$class = "class='light3'";
else
$class = "class='light2'";
if($row->p_atb_id != $p_index){
$p_index = $row->p_atb_id ;
?>
<tr <?php echo $class; ?>>
<td align="left"> <?php if($row->p_atb_parentId!=0){echo nbs(2); }else{ echo anchor('esa/base_data/attribute/FALSE/'.$row->p_atb_id.'/TRUE',img($_image_add)); } ?> <font size="2"><?php echo $row->p_atb_name;?></b></font></td>
<td align="center"><font size="2"><?php echo anchor('esa/base_data/attribute/FALSE/'.$row->p_atb_id,img($_image_reply));//img($_image_reply); ?></b></font></td>
<td align="center"><font size="2">
<?php echo anchor('/esa/base_data/del_atb/'.$row->p_atb_id.'/1',img($_image_del),array('onclick'=>"return confirm('ต้องการลบตำแหน่งนี้ใช่หรือไม่');")); ?></b></font></td>
</tr>
<?
if($row->atb_id !=NULL){
$index++;
if($index%2 == 0)
$class = "class='light3'";
else
$class = "class='light2'";
?>
<tr <?php echo $class; ?>>
<td align="left"> <?php if($row->atb_parentId!=0){echo nbs(2); }else{ echo anchor('esa/base_data/attribute/FALSE/'.$row->atb_id.'/TRUE',img($_image_add)); } ?> <font size="2"><?php echo $row->atb_name;?></b></font></td>
<td align="center"><font size="2"><?php echo anchor('esa/base_data/attribute/FALSE/'.$row->atb_id,img($_image_reply));//img($_image_reply); ?></b></font></td>
<td align="center"><font size="2">
<?php echo anchor('/esa/base_data/del_atb/'.$row->atb_id.'/1',img($_image_del),array('onclick'=>"return confirm('ต้องการลบตำแหน่งนี้ใช่หรือไม่');")); ?></b></font></td>
</tr>
<?
}
}else{
?>
<tr <?php echo $class; ?>>
<td align="left"> <?php if($row->atb_parentId!=0){echo nbs(2); }else{ echo anchor('esa/base_data/attribute/FALSE/'.$row->atb_id.'/TRUE',img($_image_add)); } ?> <font size="2"><?php echo $row->atb_name;?></b></font></td>
<td align="center"><font size="2"><?php echo anchor('esa/base_data/attribute/FALSE/'.$row->atb_id,img($_image_reply));//img($_image_reply); ?></b></font></td>
<td align="center"><font size="2">
<?php echo anchor('/esa/base_data/del_atb/'.$row->atb_id.'/1',img($_image_del),array('onclick'=>"return confirm('ต้องการลบตำแหน่งนี้ใช่หรือไม่');")); ?></b></font></td>
</tr><!-- img($_image_del,array('onClick'=>"do_delete($row->atb_id,1);")); -->
<?php
}
$index++;
}
} else {
?>
<tr>
<td colspan="3" height="22" align="center" bgcolor="#D1DCF3">ไม่พบคุณลักษณะโครงการ</td>
</tr>
<?php
}
?>
</table>
<?php echo form_close();?>
<br>
|