get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $attforblock = $DB->get_record('attforblock', array('id' => $cm->instance), '*', MUST_EXIST); } else { $attforblock = $DB->get_record('attforblock', array('id' => $a), '*', MUST_EXIST); $course = $DB->get_record('course', array('id' => $workshop->course), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('attforblock', $attforblock->id, $course->id, false, 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); ?>