$PAGE->set_pagelayout('admin'); //$PAGE->set_title($course->shortname. ": ".$att->name); //$PAGE->set_heading($course->fullname); $PAGE->set_cacheable(true); //$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'attendance')); $PAGE->navbar->add($att->name); $formparams = array('attendanceid' => $att->id ,'classid'=>$att->classid ,'fromcalendar'=>$fromcalendarview); switch ($att->pageparams->action) { case local_att_sessions_page_params::ACTION_ADD: $url = $att->url_sessions(array('action' => local_att_sessions_page_params::ACTION_ADD)); $mform = new local_attendance_add_form($url, $formparams); if ($formdata = $mform->get_data()) { $sessions = local_construct_sessions_data_for_add($formdata); $att->add_sessions($sessions); redirect($url, get_string('sessionsgenerated', 'local_attendance')); } break; case local_att_sessions_page_params::ACTION_UPDATE: $sessionid = required_param('sessionid', PARAM_INT); $url = $att->url_sessions(array('action' => local_att_sessions_page_params::ACTION_UPDATE, 'sessionid' => $sessionid)); $formparams['sessionid'] = $sessionid; $mform = new local_attendance_update_form($url, $formparams); if ($mform->is_cancelled()) { redirect($att->url_manage()); } if ($formdata = $mform->get_data()) {