$nottaken = !$sess->lasttaken && has_capability('mod/attendance:takeattendances', $context); $canchange = $sess->lasttaken && has_capability('mod/attendance:changeattendances', $context); if ($nottaken || $canchange) { redirect($att->url_take(array('sessionid' => $sess->id, 'grouptype' => $sess->groupid))); } } else { if ($size > 1) { $att->curdate = $today; // Temporarily set $view for single access to page from block. $att->view = ATT_VIEW_DAYS; } } } $PAGE->set_url($att->url_manage()); $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); $output = $PAGE->get_renderer('mod_attendance'); $tabs = new attendance_tabs($att, attendance_tabs::TAB_SESSIONS); $filtercontrols = new attendance_filter_controls($att); $sesstable = new attendance_manage_data($att); // Output starts here. echo $output->header(); echo $output->heading(get_string('attendanceforthecourse', 'attendance') . ' :: ' . format_string($course->fullname)); mod_attendance_notifyqueue::show(); echo $output->render($tabs); echo $output->render($filtercontrols); echo $output->render($sesstable); echo $output->footer();
// Redirect to the sessions tab always showing all sessions. $SESSION->attcurrentattview[$cm->course] = ATT_VIEW_ALL; redirect($att->url_manage()); } break; case att_sessions_page_params::ACTION_UPDATE: $sessionid = required_param('sessionid', PARAM_INT); $url = $att->url_sessions(array('action' => att_sessions_page_params::ACTION_UPDATE, 'sessionid' => $sessionid)); $formparams['sessionid'] = $sessionid; $mform = new mod_attendance_update_form($url, $formparams); if ($mform->is_cancelled()) { redirect($att->url_manage()); } if ($formdata = $mform->get_data()) { $att->update_session_from_form_data($formdata, $sessionid); mod_attendance_notifyqueue::notify_success(get_string('sessionupdated', 'attendance')); redirect($att->url_manage()); } 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)); if ($att->grade > 0) { att_update_all_users_grades($att->id, $att->course, $att->context, $cm); } redirect($att->url_manage(), get_string('sessiondeleted', 'attendance')); } $sessinfo = $att->get_session_info($sessionid); $message = get_string('deletecheckfull', '', get_string('session', 'attendance'));