本文整理汇总了PHP中Admin\Controller\AdminController::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminController::setStatus方法的具体用法?PHP AdminController::setStatus怎么用?PHP AdminController::setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin\Controller\AdminController
的用法示例。
在下文中一共展示了AdminController::setStatus方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setStatus
/**
* 设置一条或者多条数据的状态
* @author jry <598821125@qq.com>
*/
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;
}
}
示例2: setStatus
/**
* 设置一条或者多条数据的状态
* @author huajie <banhuajie@163.com>
*/
public function setStatus($model = 'Document')
{
return parent::setStatus('Document');
}
示例3: setStatus
/**
* 设置一条或者多条数据的状态
* @author jry <598821125@qq.com>
*/
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;
}
}
示例4: setStatus
/**
* 设置一条或者多条数据的状态
* @author huajie <banhuajie@163.com>
*/
public function setStatus($model = 'Document')
{
return \Admin\Controller\AdminController::setStatus('Document');
}
示例5: setStatus
/**
* 设置一条或者多条数据的状态
* @author jry <598821125@qq.com>
*/
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;
}
}
示例6: setStatus
/**
* 设置一条或者多条数据的状态
* @author huajie <banhuajie@163.com>
*/
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');
}
示例7: setStatus
/**
* 设置一条或者多条数据的状态
* @author jry <598821125@qq.com>
*/
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);
}
示例8: setStatus
/**
* 设置一条或者多条数据的状态
* @author jry <598821125@qq.com>
*/
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;
}
}
示例9: setStatus
/**
* 设置一条或者多条数据的状态
* @author jry <598821125@qq.com>
*/
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;
}
}
示例10: setStatus
/**
* 设置一条或者多条数据的状态
* @author jry <598821125@qq.com>
*/
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);
}
示例11: setStatus
/**
* 设置一条或者多条数据的状态
* @author jry <598821125@qq.com>
*/
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;
}
}
示例12: setStatus
/**
* 设置一条或者多条数据的状态
* @author jry <598821125@qq.com>
*/
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;
}
}