public function out_student_save() { $exam_ticket = trim($this->input->post('account')); $password = $this->input->post('password'); $txt_student_tichu = $this->input->post('txt_student_tichu'); if (!strlen($exam_ticket)) { output_json(CODE_ERROR, '请输入正确的准考证号.'); } if (!strlen($password)) { output_json(CODE_ERROR, '理由不能为空.'); } if (!strlen($txt_student_tichu)) { output_json(CODE_ERROR, '状态不能为空.'); } //检查帐号密码是否正确 $this->load->model('exam/student_model'); $student = $this->student_model->is_valid_student($exam_ticket); if (!$student) { output_json(CODE_ERROR, '该考生不存在.'); } //判断该考生是否在当前考场中 $this->load->model('exam/exam_place_model'); $exam_place_model = $this->exam_place_model; $place_id = $this->session->userdata('exam_i_place_id'); $exam_id = $this->session->userdata('exam_i_exam_id'); $user_id = $student['uid']; if (!$exam_place_model->check_exam_place_student($place_id, $user_id)) { output_json(CODE_ERROR, '很抱歉,该考生不在本场考试中,有问题请联系系统管理员.'); } //重置考生密码 try { if ($txt_student_tichu == 1) { $action = 'out_student'; } else { $action = 'in_student'; } if ($action && ($log_type = Log_type_desc::get_log_alia($action))) { $log_content = $password; exam_log_1($log_type, $log_content, $user_id, $place_id, $exam_id); } $session_data = array('exam_ticket_out' => $exam_ticket, 'password_out' => $password, 'txt_student_tichu' => $txt_student_tichu); $this->session->set_userdata($session_data); $exam_place_model->out_exam_place_student($place_id, $user_id, $password, $txt_student_tichu); if ($txt_student_tichu == 1) { output_json(CODE_SUCCESS, '踢出成功, 该考生考试信息为:<p><strong>准考证号:</strong>' . $exam_ticket . ' </p>'); } else { output_json(CODE_SUCCESS, '恢复成功, 该考生考试信息为:<p><strong>准考证号:</strong>' . $exam_ticket . ' </p>'); } } catch (Exception $e) { output_json(CODE_ERROR, '踢出失败,请重试(如多次出现类似情况,请联系系统管理员)'); } }
public function out_student_save() { $exam_ticket = trim($this->input->post('account')); $password = $this->input->post('password'); $place_id = intval($this->input->post('place_id')); $exam_id = intval($this->input->post('exam_id')); $txt_student_tichu = intval($this->input->post('txt_student_tichu')); if (!strlen($password)) { output_json(CODE_ERROR, '理由不能为空.'); } if (!strlen($txt_student_tichu)) { output_json(CODE_ERROR, '状态不能为空.'); } // 检查帐号密码是否正确 $this->load->model(APPPATH . 'models/exam/student_model'); $student = $this->student_model->is_valid_student($exam_ticket); if (!$student) { output_json(CODE_ERROR, '该考生不存在.'); } $user_id = $student['uid']; // 重置考生密码 try { if ($txt_student_tichu == '1') { $action = 'out_student'; } else { $action = 'in_student'; } if ($action && ($log_type = Log_type_desc::get_log_alia($action))) { $log_content = $password; exam_log_1($log_type, $log_content, $user_id, $place_id, $exam_id); } $session_data = array('exam_ticket_out' => $exam_ticket, 'password_out' => $password, 'txt_student_tichu' => $txt_student_tichu); $this->session->set_userdata($session_data); ExamPlaceModel::out_exam_place_student($place_id, $user_id, $password, $txt_student_tichu); if ($txt_student_tichu == 1) { output_json(CODE_SUCCESS, '<p></p><p>踢出成功, 该考生考试信息为:</p><p><strong>准考证号:</strong>' . $exam_ticket . ' </p>'); } else { output_json(CODE_SUCCESS, '<p></p><p>恢复成功, 该考生考试信息为:</p><p><strong>准考证号:</strong>' . $exam_ticket . ' </p>'); } } catch (Exception $e) { output_json(CODE_ERROR, '<p></p><p>踢出失败,请重试(如多次出现类似情况,请联系系统管理员)</p>'); } }