添加了文档删除功能
This commit is contained in:
parent
7f484e9ee6
commit
4ebfaaa335
|
@ -139,6 +139,18 @@ class ArticleController extends AbstractActionController
|
|||
}
|
||||
}
|
||||
|
||||
public function delAction()
|
||||
{
|
||||
$id = $this->params()->fromRoute('id');
|
||||
|
||||
$record = new \Sookon\Article\Article;
|
||||
|
||||
if($record->del($id) === true)
|
||||
return view::Post($this,'删除成功',-1);
|
||||
else
|
||||
return view::Post($this,"删除失败",-1);
|
||||
}
|
||||
|
||||
public function searchAction()
|
||||
{
|
||||
|
||||
|
|
|
@ -53,15 +53,17 @@ var _this = {};
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div class="form-group">
|
||||
<label class="col-lg-1 col-md-2 col-sm-2 control-label">图片</label>
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<button type="button" class="btn btn-default">选择图片</button>
|
||||
<input type="hidden" class="form-control" name="image" value="<?= $this->data['image'] ?>" />
|
||||
</div><!-- input-group -->
|
||||
</div><!-- col-sm-6 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputPhone" class="col-lg-1 col-md-2 col-sm-2 control-label">标签</label>
|
||||
|
@ -106,7 +108,6 @@ var _this = {};
|
|||
<label for="inputSource" class="col-lg-1 col-md-2 col-sm-2 control-label">发布</label>
|
||||
<div class="col-lg-7 col-md-10 col-sm-10">
|
||||
<div class="btn-group" data-toggle="buttons">
|
||||
<?= var_dump($this->data['is_pub']) ?>
|
||||
<label class="btn btn-default <?= isset($this->data['is_pub']) && $this->data['is_pub'] == TRUE ? 'active':'' ?>
|
||||
<?= !isset($this->data['is_pub']) ? 'active':'' ?>">
|
||||
<input type="radio" name="pub" <?= isset($this->data['is_pub']) && $this->data['is_pub'] == TRUE ? 'checked="checked"':'' ?>
|
||||
|
|
|
@ -51,8 +51,12 @@
|
|||
<td><?= date("Y-m-d H:i",strtotime($v['ts_created'])) ?></td>
|
||||
<td><?= $v['username'] ?></td>
|
||||
<td>
|
||||
<a href="" onclick="return confirm('是否确定删除?')"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
<a href="<?= $this->url('admin',array('controller'=>'article','action'=>'edit','ac'=>'content','id'=>$v['id'])) ?>"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
<a href="<?= $this->url('admin',array('controller'=>'article','action'=>'del','ac'=>'one','id'=>$v['id'])) ?>" onclick="return confirm('是否确定删除?')">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
<a href="<?= $this->url('admin',array('controller'=>'article','action'=>'edit','ac'=>'content','id'=>$v['id'])) ?>">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
|
|
@ -180,4 +180,18 @@ class Article
|
|||
|
||||
}// add()
|
||||
|
||||
public function del($id)
|
||||
{
|
||||
if(!is_numeric($id) || $id<1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = $this->db->exec("DELETE FROM {$this->table->arc_article} WHERE id=$id");
|
||||
$sql2 = $this->db->exec("DELETE FROM {$this->table->arc_catelog} WHERE aid=$id");
|
||||
$sql3 = $this->db->exec("DELETE FROM {$this->table->arc_tag} WHERE id=$id");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue