|
@ -39,12 +39,18 @@ $att = $DB->get_record('attendance', array('id' => $cm->instance), '* |
|
|
|
|
|
|
|
|
require_login($course, true, $cm); |
|
|
require_login($course, true, $cm); |
|
|
|
|
|
|
|
|
$pageparams->init($cm); |
|
|
$capabilities = array( |
|
|
$att = new attendance($att, $cm, $course, $PAGE->context, $pageparams); |
|
|
'mod/attendance:manageattendances', |
|
|
if (!$att->perm->can_manage() && !$att->perm->can_take() && !$att->perm->can_change()) { |
|
|
'mod/attendance:takeattendances', |
|
|
|
|
|
'mod/attendance:changeattendances' |
|
|
|
|
|
); |
|
|
|
|
|
if (!has_any_capability($capabilities, $PAGE->context)) { |
|
|
redirect($att->url_view()); |
|
|
redirect($att->url_view()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$pageparams->init($cm); |
|
|
|
|
|
$att = new attendance($att, $cm, $course, $PAGE->context, $pageparams); |
|
|
|
|
|
|
|
|
// If teacher is coming from block, then check for a session exists for today. |
|
|
// If teacher is coming from block, then check for a session exists for today. |
|
|
if ($from === 'block') { |
|
|
if ($from === 'block') { |
|
|
$sessions = $att->get_today_sessions(); |
|
|
$sessions = $att->get_today_sessions(); |
|
|