get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $attforblock = $DB->get_record('attforblock', array('id' => $cm->instance), '*', MUST_EXIST); require_login($course, true, $cm); // Not specified studentid for displaying attendance? // Redirect to appropriate page if can if (!$studentid) { if (has_capability('mod/attforblock:manageattendances', $PAGE->context) || has_capability('mod/attforblock:takeattendances', $PAGE->context) || has_capability('mod/attforblock:changeattendances', $PAGE->context)) { redirect("manage.php?id=$cm->id"); } elseif (has_capability('mod/attforblock:viewreports', $PAGE->context)) { redirect("report.php?id=$cm->id"); } } if ($view) set_current_view($course->id, $_GET['view']); else $view = get_current_view($course->id, 'months'); require_capability('mod/attforblock:view', $PAGE->context); ?>