Commit 72271018 by 冷斌

add

parent a37b635f
<admintpl file="header" />
</head>
<body>
<div class="wrap">
<ul class="nav nav-tabs">
<li class="active"><a >列表</a></li>
<li><a href="{:U('Impression/add')}">添加</a></li>
</ul>
<form method="post" class="js-ajax-form" action="{:U('Impression/listorders')}">
<div class="table-actions">
<button class="btn btn-primary btn-small js-ajax-submit" type="submit">{:L('SORT')}</button>
</div>
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>排序</th>
<th align="center">ID</th>
<th>名称</th>
<th>颜色</th>
<th align="center">{:L('ACTIONS')}</th>
</tr>
</thead>
<tbody>
<foreach name="lists" item="vo">
<tr>
<td><input name="listorders[{$vo['id']}]" type="text" size="3" value="{$vo['orderno']}" class="input input-order"></td>
<td align="center">{$vo.id}</td>
<td>{$vo['name']}</td>
<td><input style="width:50px;height:20px;background:#{$vo['colour']};" disabled/></td>
<td align="center">
<a href="{:U('Impression/edit',array('id'=>$vo['id']))}" >编辑</a>
|
<a href="{:U('Impression/del',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn" data-msg="您确定要删除吗?">删除</a>
</td>
</tr>
</foreach>
</tbody>
</table>
<div class="pagination">{$page}</div>
<div class="table-actions">
<button class="btn btn-primary btn-small js-ajax-submit" type="submit">{:L('SORT')}</button>
</div>
</form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -7,7 +7,7 @@ namespace Admin\Controller;
use Common\Controller\AdminbaseController;
class ImpressionController extends AdminbaseController {
function index(){
$gift_model=M("impression_label");
$count=$gift_model->count();
$page = $this->page($count, 20);
......@@ -18,14 +18,14 @@ class ImpressionController extends AdminbaseController {
->select();
$this->assign('lists', $lists);
$this->assign("page", $page->show('Admin'));
$this->display();
}
function del(){
$id=intval($_GET['id']);
if($id){
$result=M("impression_label")->delete($id);
$result=M("impression_label")->delete($id);
if($result){
$action="删除印象标签:{$id}";
setAdminLog($action);
......@@ -33,21 +33,21 @@ class ImpressionController extends AdminbaseController {
$this->success('删除成功');
}else{
$this->error('删除失败');
}
}else{
}
}else{
$this->error('数据传入失败!');
}
$this->display();
}
}
$this->display();
}
//排序
public function listorders() {
public function listorders() {
$ids = $_POST['listorders'];
foreach ($ids as $key => $r) {
$data['orderno'] = $r;
M("impression_label")->where(array('id' => $key))->save($data);
}
$status = true;
if ($status) {
$action="更新印象标签排序";
......@@ -57,28 +57,28 @@ class ImpressionController extends AdminbaseController {
} else {
$this->error("排序更新失败!");
}
}
}
function add(){
$this->display();
}
function add(){
$this->display();
}
function add_post(){
if(IS_POST){
if(IS_POST){
$name=I("name");
if($name==''){
$this->error('请填写名称');
}
$colour=I("colour");
if($colour==''){
$this->error('请选择颜色');
}
$Live_class=M("impression_label");
$Live_class->create();
$result=$Live_class->add();
$result=$Live_class->add();
if($result){
$action="添加印象标签:{$result}";
setAdminLog($action);
......@@ -87,33 +87,33 @@ class ImpressionController extends AdminbaseController {
}else{
$this->error('添加失败');
}
}
}
}
}
function edit(){
$id=intval($_GET['id']);
if($id){
$data=M("impression_label")->where("id={$id}")->find();
$this->assign('data', $data);
}else{
$this->assign('data', $data);
}else{
$this->error('数据传入失败!');
}
$this->display();
}
$this->display();
}
function edit_post(){
if(IS_POST){
if(IS_POST){
$name=I("name");
if($name==''){
$this->error('请填写名称');
}
$colour=I("colour");
if($colour==''){
$this->error('请选择颜色');
}
$Live_class=M("impression_label");
$Live_class->create();
$result=$Live_class->save();
$result=$Live_class->save();
if($result!==false){
$action="修改印象标签:{$_POST['id']}";
setAdminLog($action);
......@@ -122,9 +122,9 @@ class ImpressionController extends AdminbaseController {
}else{
$this->error('修改失败');
}
}
}
}
function resetCache(){
$key='getImpressionLabel';
$rules= M("impression_label")
......@@ -136,4 +136,20 @@ class ImpressionController extends AdminbaseController {
setcaches($key,$rules);
return 1;
}
function index2(){
$gift_model=M("impression_label");
$count=$gift_model->count();
$page = $this->page($count, 20);
$lists = $gift_model
//->where()
->order("orderno asc, id desc")
->limit($page->firstRow . ',' . $page->listRows)
->select();
$this->assign('lists', $lists);
$this->assign("page", $page->show('Admin'));
$this->display();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment