public function delete($id = 0) { //判断该试题已经被考试过 或 正在被考 $be_tested = QuestionModel::question_has_test_action($id); if ($be_tested) { message('该试题已经被考生考过 或者 正在被考, 无法操作'); } recycle_log_check($id); $back_url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'admin/question_external/index'; $this->examine_permission($id); $return = QuestionModel::delete($id); if ($return === true) { recycle_log(RECYCLE_QUESTION, $id); message('删除成功', $back_url, 'success'); } else { switch ($return) { case -1: $message = '试题不存在'; break; //case -2: $message = '该题组下还存在子题,不能删除。';break; //case -2: $message = '该题组下还存在子题,不能删除。';break; default: $message = '删除失败'; break; } message($message, $back_url); } }
/** * @description 删除学生信息 * @author * @final * @param int $uid 学生id */ public function delete($uid = 0) { if (!$this->check_power('student_delete')) { return; } $back_url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'admin/student/index'; $uid = intval($uid); $uid && ($row = StudentModel::get_student($uid)); if (empty($uid)) { message('学生信息不存在', $back_url); return; } recycle_log_check($uid); try { $this->db->update('student', array('is_delete' => 1), array('uid' => $uid)); admin_log('delete', 'student', $uid); recycle_log(RECYCLE_STUDENT, $uid); message('删除成功', $back_url, 'success'); } catch (Exception $e) { message('删除失败', $back_url); } }
/** * 禁用/回收站 * * @return void */ public function do_action() { if (!$this->check_power('teacher_download_manage')) { return; } $id = $this->input->get_post('id'); $back_url = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; $act = $this->input->get_post('act'); $res = TRUE; if ($act == '0') { //启用 $res = TeacherDownloadModel::update($id, array('flag' => '1')); } elseif ($act == '1') { //禁用 $res = TeacherDownloadModel::update($id, array('flag' => '0')); } elseif ($act == '2') { //回收站 recycle_log_check($id); $res = TeacherDownloadModel::delete($id); $log_ids = is_string($id) ? $id : implode(', ', $id); admin_log('delete', 'teacher_download', $id); recycle_log(RECYCLE_EXAM_INVIGILATOR, $id); } elseif ($act == '3') { //还原 $res = TeacherDownloadModel::update($id, array('flag' => '1')); $log_ids = is_string($id) ? $id : implode(', ', $id); admin_log('restore', 'teacher_download', $id); } if ($res) { message('操作成功', $back_url, 'success'); } else { message('操作失败', $back_url); } }
/** * 禁用/回收站 * * @return void */ public function do_action() { if (!$this->check_power('exam_manage')) { return; } $id = $this->input->get_post('id'); $place_id = intval($this->input->get_post('place_id')); $back_url = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; if (empty($back_url)) { $back_url = 'admin/exam_invigilator/index/?place_id=' . $place_id; } $act = $this->input->get_post('act'); $res = TRUE; if ($act == '0') { //启用 $res = ExamInvigilatorModel::update($id, array('invigilator_flag' => '1')); } elseif ($act == '1') { //禁用 $res = ExamInvigilatorModel::update($id, array('invigilator_flag' => '0')); } elseif ($act == '2') { //回收站 recycle_log_check($id); $res = ExamInvigilatorModel::delete($id); $log_ids = is_string($id) ? $id : implode(', ', $id); admin_log('delete', 'exam_invigilator', $id); recycle_log(RECYCLE_EXAM_INVIGILATOR, $id); } elseif ($act == '3') { //还原 $res = ExamInvigilatorModel::update($id, array('invigilator_flag' => '1')); $log_ids = is_string($id) ? $id : implode(', ', $id); admin_log('restore', 'exam_invigilator', $id); } if ($res) { message('操作成功', $back_url, 'success'); } else { message('操作失败', $back_url); } }