| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- // +----------------------------------------------------------------------
- // | Fanwe 方维p2p借贷系统
- // +----------------------------------------------------------------------
- // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Author: 云淡风轻(1956838968@qq.com)
- // +----------------------------------------------------------------------
- class ArticleTrashAction extends CommonAction{
- public function trash()
- {
- $condition['is_delete'] = 1;
- $this->assign("default_map",$condition);
- $map = $this->_search ();
- //追加默认参数
- if($this->get("default_map"))
- $map = array_merge($map,$this->get("default_map"));
- if (method_exists ( $this, '_filter' )) {
- $this->_filter ( $map );
- }
- $name='Article';
- $model = D ($name);
- if (! empty ( $model )) {
- $this->_list ( $model, $map );
- }
- $this->display ();
- return;
- }
- public function restore() {
- //删除指定记录
- $ajax = intval($_REQUEST['ajax']);
- $id = $_REQUEST ['id'];
- if (isset ( $id )) {
- $condition = array ('id' => array ('in', explode ( ',', $id ) ) );
- $rel_data = M("Article")->where($condition)->findAll();
- foreach($rel_data as $data)
- {
- $info[] = $data['title'];
- }
- if($info) $info = implode(",",$info);
- $list = M("Article")->where ( $condition )->setField ( 'is_delete', 0 );
- if ($list!==false) {
- save_log($info.l("RESTORE_SUCCESS"),1);
- clear_auto_cache("get_help_cache");
- $this->success (l("RESTORE_SUCCESS"),$ajax);
- } else {
- save_log($info.l("RESTORE_FAILED"),0);
- $this->error (l("RESTORE_FAILED"),$ajax);
- }
- } else {
- $this->error (l("INVALID_OPERATION"),$ajax);
- }
- }
-
- public function foreverdelete() {
- //彻底删除指定记录
- $ajax = intval($_REQUEST['ajax']);
- $id = $_REQUEST ['id'];
- if (isset ( $id )) {
- $condition = array ('id' => array ('in', explode ( ',', $id ) ) );
- $rel_data = M("Article")->where($condition)->findAll();
- foreach($rel_data as $data)
- {
- $info[] = $data['title'];
- }
- if($info) $info = implode(",",$info);
- $list = M("Article")->where ( $condition )->delete();
- //删除相关预览图
- // foreach($rel_data as $data)
- // {
- // @unlink(get_real_path().$data['preview']);
- // }
- if ($list!==false) {
- save_log($info.l("FOREVER_DELETE_SUCCESS"),1);
- clear_auto_cache("get_help_cache");
- $this->success (l("FOREVER_DELETE_SUCCESS"),$ajax);
- } else {
- save_log($info.l("FOREVER_DELETE_FAILED"),0);
- $this->error (l("FOREVER_DELETE_FAILED"),$ajax);
- }
- } else {
- $this->error (l("INVALID_OPERATION"),$ajax);
- }
- }
- }
- ?>
|