如何在一堂课中将考试发送给所有学生

时间:2018-12-25 00:08:16

标签: php

您好,我想发送考试时必须选择部分,所以每次我重写每个系的考试时,都只能选择学校系统吗?

我在控制器中的代码

if ($param1 == 'create') {
  if ($this->input->post('class_id') > 0 && $this->input->post('section_id') > 0 && $this->input->post('subject_id') > 0) {
    $this->crud_model->create_online_exam();
    $this->session->set_flashdata('flash_message' , get_phrase('data_added_successfully'));
    return redirect(site_url('admin/manage_online_exam'), 'refresh');
  } else {
    $this->session->set_flashdata('error_message' , get_phrase('make_sure_to_select_valid_class_').','.get_phrase('_section_and_subject'));
    return redirect(site_url('admin/manage_online_exam'), 'refresh');
  }
}
if ($param1 == 'edit') {
  if ($this->input->post('class_id') > 0 && $this->input->post('section_id') > 0 && $this->input->post('subject_id') > 0) {
    $this->crud_model->update_online_exam();
    $this->session->set_flashdata('flash_message' , get_phrase('data_updated_successfully'));
    return redirect(site_url('admin/manage_online_exam'), 'refresh');
  } else {
    $this->session->set_flashdata('error_message' , get_phrase('make_sure_to_select_valid_class_').','.get_phrase('_section_and_subject'));
    redirect(site_url('admin/manage_online_exam'), 'refresh');
  }
}

我在crud_model中的代码

$this->db->insert('online_exam', $data);
}

function update_online_exam(){

    $data['title'] = html_escape($this->input->post('exam_title'));
    $data['class_id'] = $this->input->post('class_id');
    $data['section_id'] = $this->input->post('section_id');
    $data['subject_id'] = $this->input->post('subject_id');
    $data['minimum_percentage'] = html_escape($this->input->post('minimum_percentage'));
    $data['instruction'] = html_escape($this->input->post('instruction'));
    $data['exam_date'] = strtotime(html_escape($this->input->post('exam_date')));
    $data['time_start'] = html_escape($this->input->post('time_start'));
    $data['time_end'] = html_escape($this->input->post('time_end'));
    $data['duration'] = strtotime(date('Y-m-d', $data['exam_date']).' '.$data['time_end']) - strtotime(date('Y-m-d', $data['exam_date']).' '.$data['time_start']);

    $this->db->where('online_exam_id', $this->input->post('online_exam_id'));
    $this->db->update('online_exam', $data);
}

0 个答案:

没有答案