审核功能经过几个小时的奋战终于完成了,现在我就与广大网友分享我的成果
我定义未审核为-1,审核通过为1,审核不通过为0
下面请看HTML代码
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped tablesorter">
<thead>
<tr>
<th>学号 </th>
<th>姓名 </th>
<th>审核状态 </th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tbody>
<volist name="list" id="vo">
<tr>
<td>{$vo.id}</td>
<td>{$vo.name}</td>
<td><if condition="$vo['topic_state1'] eq 1">
审核通过
<elseif condition="$vo['topic_state1'] eq 0"/>审核未通过
<elseif condition="$vo['topic_state1'] eq -1"/>
未审核
</if>
<td><div class="button-group"> <a class="button border-main" href="__CONTROLLER__/edit/id/{$vo.id}"> 审核</a>
</div></td>
</tr>
</volist>
</tbody>
</tbody>
</table>
</div>
审核的HTML代码如下
<form method="post" class="form-horizontal" action="">
<input type="hidden" name="id" value="{$paper_student.id}">
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">学 号</label>
<div class="col-sm-5">
<p class="form-control-static">{$paper_student.id}</p>
<!-- <input type="id" class="form-control" id="id" name="id" value="{$paper_student.id}"> -->
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">姓 名</label>
<div class="col-sm-5">
<p class="form-control-static">{$paper_student.name}</p>
<!-- <input type="name" class="form-control" id="name" name="name" value="{$paper_student.name}"> -->
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">论 文 题 目</label>
<div class="col-sm-5">
<p class="form-control-static">{$paper_student.topic}</p>
<!-- <input type="name" class="form-control" id="name" name="name" value="{$paper_student.name}"> -->
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">审 查 状 态</label>
<div class="col-sm-5">
<label class="radio-inline">
<input type="radio" name="topic_state1" id="inlineRadio1" value="1"> 通过
</label>
<label class="radio-inline">
<input type="radio" name="topic_state1" id="inlineRadio2" value="0"> 未通过
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-5">
<button type="submit" class="btn btn-primary">
<i class="fa fa-gear"></i>
确定</button>
</div>
</div>
</form>
图片如下
Thinkphp后台代码如下
public function edit(){
$paper_student=D('paper_student');
if(IS_POST){
$data['topic_state1']=I('topic_state1');
session('aa',$data['topic_state1']);
if($paper_student->create()){
if($paper_student->save()){
$this->success('操作成功',U('lst'));
}else{
$this->error('操作失败!',U('lst'));
}
}else{
$this->error($paper_student->getError());
}
return;
}
$id=I('id');
$paper_students=$paper_student->find($id);
var_dump(session('aa'));
if((session('aa')==1)&&($paper_students[topic_state2]==1)){
$aaa=array(
'id' => $id,
'state' => 2, //把数据库中的state字段变为2
);
$paper_student->create($aaa);
$paper_student->save($aaa);
}else if((session('aa')==1)&&($paper_students[topic_state2]==0)){
$bbb=array(
'id' => $id,
'state' => 3,
);
$paper_student->create($bbb);
$paper_student->save($bbb);
}else if((session('aa')==0)&&($paper_students[topic_state2]==1)){
$ccc=array(
'id' => $id,
'state' => 3,
);
$paper_student->create($ccc);
$paper_student->save($ccc);
}else if((session('aa')==0)&&($paper_students[topic_state2]==0)){
$ddd=array(
'id' => $id,
'state' => 3,
);
$paper_student->create($ddd);
$paper_student->save($ddd);
}
$this->assign('paper_student',$paper_students);
$this->display();
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)