/** * Called to define this moodle form * * @return void */ public function definition() { global $USER; $mform =& $this->_form; $course = $this->_customdata['course']; $cm = $this->_customdata['cm']; $modcontext = $this->_customdata['modcontext']; $pageparams = new att_individualreport_page_params(); $pageparams->init($cm); $studentslist = $pageparams->get_students_list(); $mform->setType('id', PARAM_INT); $mform->addElement('select', 'studentid', get_string('student', 'attcontrol'), $studentslist); $mform->addElement('checkbox', 'includeallsessions', get_string('includeall', 'attcontrol'), get_string('yes')); $mform->setDefault('includeallsessions', true); $mform->addElement('checkbox', 'includenottaken', get_string('includenottaken', 'attcontrol'), get_string('yes')); $mform->setDefault('includenottaken', true); $mform->addElement('date_selector', 'startdate', get_string('startofperiod', 'attcontrol')); $mform->setDefault('startdate', $course->startdate); $mform->disabledIf('startdate', 'includeallsessions', 'checked'); $mform->addElement('date_selector', 'enddate', get_string('endofperiod', 'attcontrol')); $mform->disabledIf('enddate', 'includeallsessions', 'checked'); $mform->addElement('select', 'format', get_string('format'), array('excel' => get_string('downloadexcel', 'attcontrol'), 'ooo' => get_string('downloadooo', 'attcontrol'), 'text' => get_string('downloadtext', 'attcontrol'))); $submit_string = get_string('export', 'attcontrol'); $this->add_action_buttons(false, $submit_string); $mform->addElement('hidden', 'id', $cm->id); }
$id = required_param('id', PARAM_INT); $from = optional_param('from', null, PARAM_ACTION); $pageparams->view = optional_param('view', null, PARAM_INT); $pageparams->curdate = optional_param('curdate', null, PARAM_INT); $pageparams->student = optional_param('student', null, PARAM_INT); $pageparams->sort = optional_param('sort', null, PARAM_INT); $pageparams->coursefilter = optional_param('coursefilter', null, PARAM_INT); $pageparams->studentfilter = optional_param('studentfilter', null, PARAM_INT); $pageparams->action = optional_param('action', null, PARAM_INT); $cm = get_coursemodule_from_id('attcontrol', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $att = $DB->get_record('attcontrol', array('id' => $cm->instance), '*', MUST_EXIST); require_login($course, true, $cm); //Defines whether the student view or the teacher view is displayed $nostudent = $pageparams->student == null; $pageparams->init($cm); $att = new attcontrol($att, $cm, $course, $PAGE->context, $pageparams); //Prepare the student or teacher view. if (!$att->perm->can_view_reports() && $nostudent) { $att->pageparams->student = $USER->id; } if ($USER->id == $att->pageparams->student) { $att->perm->require_view_capability(); $own = true; } else { $att->perm->require_view_reports_capability(); $own = false; } $PAGE->set_url($att->url_individualreport()); $PAGE->set_pagelayout('report'); $PAGE->set_title($course->shortname . ": " . $att->name . ' - ' . get_string('individualreport', 'attcontrol'));