/** * 设置一条或者多条数据的状态 * @author jry <*****@*****.**> */ public function setStatus($model = CONTROLLER_NAME) { $ids = I('request.ids'); $status = I('request.status'); if (empty($ids)) { $this->error('请选择要操作的数据'); } switch ($status) { case 'delete': // 删除条目 if (!is_array($ids)) { $id_list[0] = $ids; } else { $id_list = $ids; } foreach ($id_list as $id) { $upload_info = D('Upload')->find($id); if ($upload_info) { $realpath = realpath('.' . $upload_info['path']); if ($realpath) { array_map("unlink", glob($realpath)); if (count(glob($realpath))) { $this->error('删除失败!'); } else { $resut = D('Upload')->delete($id); $this->success('删除成功!'); } } else { $resut = D('Upload')->delete($id); $this->success('删除成功!'); } } } break; default: parent::setStatus($model); break; } }
/** * 设置一条或者多条数据的状态 * @author huajie <*****@*****.**> */ public function setStatus($model = 'Document') { return parent::setStatus('Document'); }
/** * 设置一条或者多条数据的状态 * @author jry <*****@*****.**> */ public function setStatus($model = CONTROLLER_NAME) { $ids = I('request.ids'); $status = I('request.status'); if (empty($ids)) { $this->error('请选择要操作的数据'); } $map['id'] = array('in', $ids); switch ($status) { case 'delete': // 删除条目 $category_object = D('Category'); $con['cid'] = array('in', $ids); $count = D('Article')->where($con)->count(); if ($count == 0) { $result = $category_object->where($map)->delete(); if ($result) { $this->success('删除分类成功'); } } else { $this->error('请先删除或移动该分类下文档'); } break; default: parent::setStatus($model); break; } }
/** * 设置一条或者多条数据的状态 * @author huajie <*****@*****.**> */ public function setStatus($model = 'Document') { return \Admin\Controller\AdminController::setStatus('Document'); }
/** * 设置一条或者多条数据的状态 * @author jry <*****@*****.**> */ public function setStatus($model = CONTROLLER_NAME) { $ids = I('request.ids'); $status = I('request.status'); if (empty($ids)) { $this->error('请选择要操作的数据'); } $map['id'] = array('in', $ids); switch ($status) { case 'delete': //删除条目 //获取当前文档模型信息 $document_type_object = D('DocumentType'); $document_type = $document_type_object->where($map)->find(); //系统模型无需操作 if ($document_type['system'] === '1') { $this->error('系统模型无需操作'); } else { $con['doc_type'] = $ids; $count = D('category')->where($con)->count(); if ($count > 0) { $this->error('存在该文档模型的分类,无法删除!'); } else { $result = $document_type_object->where($map)->delete(); if ($result) { $this->success('删除成功,不可恢复!'); } else { $this->error('删除失败'); } } } break; default: parent::setStatus($model); break; } }
/** * 设置一条或者多条数据的状态 * @author huajie <*****@*****.**> */ public function setStatus($model = 'Document') { if ($_GET["status"] == 1) { $id = (int) $_GET['ids']; $Document_indo = M("Document")->where(array("id" => $id))->find(); if ($Document_indo['bianji_status'] != 1) { $s = json_encode(array('status' => 1, "info" => "")); $this->error("编辑还未校验"); } } return parent::setStatus('Document'); }
/** * 设置一条或者多条数据的状态 * @author jry <*****@*****.**> */ public function setStatus($model = CONTROLLER_NAME) { $ids = I('request.ids'); if (is_array($ids)) { if (in_array('1', $ids)) { $this->error('超级管理员组不允许操作'); } } else { if ($ids === '1') { $this->error('超级管理员组不允许操作'); } } parent::setStatus($model); }
/** * 设置一条或者多条数据的状态 * @author jry <*****@*****.**> */ public function setStatus($model = CONTROLLER_NAME) { $ids = I('request.ids'); $status = I('request.status'); if (empty($ids)) { $this->error('请选择要操作的数据'); } switch ($status) { case 'delete': //删除条目 $attribute_object = D('Attribute'); $field = $attribute_object->find($ids); $result1 = $attribute_object->delete($ids); $result2 = $attribute_object->deleteField($field); if ($result1 && $result2) { $this->success('删除成功,不可恢复!'); } else { $this->error('删除失败' . $attribute_object->getError()); } break; default: parent::setStatus($model); break; } }
/** * 设置一条或者多条数据的状态 * @author huajie <*****@*****.**> */ public function setStatus($model = 'FeedBack') { return parent::setStatus('FeedBack'); }
/** * 设置一条或者多条数据的状态 * @author jry <*****@*****.**> */ public function setStatus($model = CONTROLLER_NAME) { $ids = I('request.ids'); $status = I('request.status'); if (empty($ids)) { $this->error('请选择要操作的数据'); } $map['id'] = array('eq', $ids); switch ($status) { case 'uninstall': //卸载 $name = D($model)->where($map)->getField('name'); $result = D($model)->where($map)->delete(); if ($result) { $sql_status = execute_sql_from_file(realpath(APP_PATH . $name) . '/Sql/uninstall.sql'); if ($sql_status) { $this->success('卸载成功!'); } } else { $this->error('卸载失败'); } break; default: parent::setStatus($model); break; } }
/** * 设置一条或者多条数据的状态 * @author jry <*****@*****.**> */ public function setStatus($model = CONTROLLER_NAME) { $ids = I('request.ids'); if (is_array($ids)) { foreach ($ids as $id) { $is_system = D($model)->getFieldById($id, 'is_system'); if ($is_system) { $this->error('系统模块不允许操作'); } } } else { $is_system = D($model)->getFieldById($ids, 'is_system'); if ($is_system) { $this->error('系统模块不允许操作'); } } parent::setStatus($model); }
/** * 设置一条或者多条数据的状态 * @author jry <*****@*****.**> */ public function setStatus($model = CONTROLLER_NAME) { $ids = I('request.ids'); $status = I('request.status'); if (empty($ids)) { $this->error('请选择要操作的数据'); } $map['id'] = array('in', $ids); switch ($status) { case 'delete': // 删除条目 $map['status'] = -1; $info = D('Index')->detail($ids, $map); $extend_table_object = D(strtolower(D('Index')->moduleName . '_' . $info['doc_type_info']['name'])); $exist = $extend_table_object->find($ids); if ($exist) { $result = $extend_table_object->delete($ids); } else { $result = true; } if ($result) { $result2 = D('Index')->delete($ids); if ($result2) { $this->success('彻底删除成功'); } else { $this->error('删除失败'); } } else { $this->error('删除失败'); } break; default: parent::setStatus($model); break; } }
/** * 设置一条或者多条数据的状态 * @author jry <*****@*****.**> */ public function setStatus($model = CONTROLLER_NAME) { $ids = I('request.ids'); $status = I('request.status'); if (empty($ids)) { $this->error('请选择要操作的数据'); } $map['id'] = array('eq', $ids); switch ($status) { case 'uninstall': //卸载 //当前主题禁止卸载 $theme_info = D($model)->where($map)->find(); if ($theme_info['current'] === '1') { $this->error('我是当前主题禁止被卸载'); } //只剩一个主题禁止卸载 $count = D($model)->count(); if ($count > 1) { $result = D($model)->where($map)->delete(); if ($result) { $this->success('卸载成功!'); } else { $this->error('卸载失败'); } } else { $this->error('只剩一个主题禁止卸载'); } break; case 'current': //设为当前主题 $theme_info = D($model)->where($map)->find(); if ($theme_info) { //当前主题current字段置为1 $result1 = D($model)->where($map)->setField('current', 1); if ($result1) { //其它主题current字段置为0 $con['id'] = array('neq', $ids); $result2 = D($model)->where($con)->setField('current', 0); if ($result2) { $this->success('前台主题设置成功!'); } else { $this->error('设置当前主题失败'); } } else { $this->error('设置当前主题失败'); } } else { $this->error('主题不存在'); } break; default: parent::setStatus($model); break; } }