/** * @param attcontrol $att */ public function __construct(attcontrol $att) { if ($att->pageparams->grouptype) { $this->users = $att->get_users($att->pageparams->grouptype); } else { $this->users = $att->get_users($att->pageparams->group); } $this->pageparams = $att->pageparams; $this->perm = $att->perm; $this->groupmode = $att->get_group_mode(); $this->cm = $att->cm; $this->statuses = $att->get_statuses(); $this->sessioninfo = $att->get_session_info($att->pageparams->sessionid); $this->updatemode = $this->sessioninfo->lasttaken > 0; if (isset($att->pageparams->copyfrom)) { $this->sessionlog = $att->get_session_log($att->pageparams->copyfrom); } else { if ($this->updatemode) { $this->sessionlog = $att->get_session_log($att->pageparams->sessionid); } else { $this->sessionlog = array(); } } if (!$this->updatemode) { $this->sessions4copy = $att->get_today_sessions_for_copy($this->sessioninfo); } $this->urlpath = $att->url_take()->out_omit_querystring(); $params = $att->pageparams->get_significant_params(); $params['id'] = $att->cm->id; $this->urlparams = $params; $this->att = $att; }
if ($mform->is_cancelled()) { redirect($att->url_manage()); } if ($formdata = $mform->get_data()) { $att->update_session_from_form_data($formdata, $sessionid); redirect($att->url_manage(), get_string('sessionupdated', 'attcontrol')); } break; case att_sessions_page_params::ACTION_DELETE: $sessionid = required_param('sessionid', PARAM_INT); $confirm = optional_param('confirm', null, PARAM_INT); if (isset($confirm) && confirm_sesskey()) { $att->delete_sessions(array($sessionid)); redirect($att->url_manage(), get_string('sessiondeleted', 'attcontrol')); } $sessinfo = $att->get_session_info($sessionid); $message = get_string('deletecheckfull', '', get_string('session', 'attcontrol')); $message .= str_repeat(html_writer::empty_tag('br'), 2); $message .= userdate($sessinfo->sessdate, get_string('strftimedmyhm', 'attcontrol')); $message .= html_writer::empty_tag('br'); $message .= $sessinfo->description; $params = array('action' => $att->pageparams->action, 'sessionid' => $sessionid, 'confirm' => 1, 'sesskey' => sesskey()); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('attcontrolforthecourse', 'attcontrol') . ' :: ' . $course->fullname); echo $OUTPUT->confirm($message, $att->url_sessions($params), $att->url_manage()); echo $OUTPUT->footer(); exit; case att_sessions_page_params::ACTION_DELETE_SELECTED: $confirm = optional_param('confirm', null, PARAM_INT); if (isset($confirm) && confirm_sesskey()) { $sessionsids = required_param('sessionsids', PARAM_ALPHANUMEXT);