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); } } } ?>