如果拒绝或批准状态,如何禁用按钮编辑和删除?因此,只有当状态仍然被发送以供审批时,用户才能编辑项目请求。
这是我的视图:
<tbody>
<?php
$counter=1+intval($this->uri->segment(3));
foreach($requisition_list as $l){
?>
<tr>
<td>
<label class="checkbox-inline"><input type="checkbox" class="form-control grey" name="ID_REQUISITION[]" value="<?= $l->ID_REQUISITION ?>"></label>
</td>
<td><?= $counter ?></td>
<td><?= $l->KD_REQUISITION ?></td>
<td><?= $l->STATUS_NAME ?></td>
<td class="center">
<div class="visible-md visible-lg hidden-sm hidden-xs">
<a href="<?= base_url('item_requisition/edit').'?id='.$l->ID_REQUISITION ?>" class="btn btn-info btn-mini tooltips" data-placement="top" data-original-title="Edit"><i class="icon-edit"></i></a>
<a href="javascript:void(0)" data-confirm-modal="<?= base_url('item_requisition/delete').'?ID_REQUISITION='.$l->ID_REQUISITION ?>" class="btn btn-danger btn-mini tooltips" data-placement="top" data-original-title="Delete"><i class="icon-remove"></i></a>
</div>
</td>
</tr>
<?php
$counter++;
}
?>
</tbody>
控制器:
$perpage = 20;
$params = array(0, 0, 0);
$pagination = array(
'base_url' => base_url("item_requisition/index"),
'total_rows' => sizeof($this->call_sp("view_item_requisition", $params)),
'per_page' => $perpage,
'num_links' => 3,
'uri_segment' => 3
);
$params = array($perpage, $offset, 0);
$this->data['requisition_list'] = $this->call_sp("view_item_requisition", $params);
$this->data['pagination'] = $this->paging($pagination);
$this->render($this->data, "index");
答案 0 :(得分:0)
我认为您可以在用户表中创建一个$_SESSION['aprouved']
和à数据库值,例如approuved。这是你真正想要的东西。使用此会话配置也是安全的。
ini_set('session.use_trans_sid', 0);
ini_set('session.use_strict_mode', 1);
ini_set('session.use_cookie', 1);
ini_set('session.use_only_cookie', 1);
ini_set('session.use_only_cookie', 0);
答案 1 :(得分:0)
感谢答案。我将此代码用于我的条件:
<tbody>
<?php
$counter=1+intval($this->uri->segment(3));
foreach($requisition_list as $l){
?>
<tr>
<td>
<label class="checkbox-inline"><input type="checkbox" class="form-control grey" name="ID_REQUISITION[]" value="<?= $l->ID_REQUISITION ?>"></label>
</td>
<td><?= $counter ?></td>
<td><?= $l->KD_REQUISITION ?></td>
<td><?= $l->NAMA_UNIT ?></td>
<td><?= $l->STATUS_NAME ?></td>
<td class="center">
<div class="visible-md visible-lg hidden-sm hidden-xs">
<?php if ($l->STATUS_NAME == 'Sent for Approval'): ?>
<a href="<?= base_url('item_requisition/edit').'?id='.$l->ID_REQUISITION ?>" class="btn btn-info btn-mini tooltips" data-placement="top" data-original-title="Edit"><i class="icon-edit"></i></a>
<a href="javascript:void(0)" data-confirm-modal="<?= base_url('item_requisition/delete').'?ID_REQUISITION='.$l->ID_REQUISITION ?>" class="btn btn-danger btn-mini tooltips" data-placement="top" data-original-title="Delete"><i class="icon-remove"></i></a>
<?php endif;?>
</div>
</td>
</tr>
<?php
$counter++;
}
?>
</tbody>
虽然用户仍然可以通过ID进行编辑,但至少我需要在我的控制器中为已批准/拒绝状态设置条件是不可编辑的。