Browse Source

For redirecting from the block is taken into account the situation when the current time are a few sessions

MOODLE_23_STABLE
Artem Andreev 15 years ago
parent
commit
020c6ef896
  1. 16
      manage.php

16
manage.php

@ -51,10 +51,18 @@
FROM {$CFG->prefix}attendance_sessions FROM {$CFG->prefix}attendance_sessions
WHERE $today BETWEEN sessdate AND (sessdate + duration) WHERE $today BETWEEN sessdate AND (sessdate + duration)
AND courseid = $course->id"; AND courseid = $course->id";
if($att = get_record_sql($sql)) { if($atts = get_records_sql($sql)) {
if ((!$att->lasttaken and has_capability('mod/attforblock:takeattendances', $context)) or $size = count($atts);
($att->lasttaken and has_capability('mod/attforblock:changeattendances', $context))) { if ($size == 1) {
redirect('attendances.php?id='.$id.'&sessionid='.$att->id.'&grouptype='.$att->groupid); $att = reset($atts);
if ((!$att->lasttaken and has_capability('mod/attforblock:takeattendances', $context)) or
($att->lasttaken and has_capability('mod/attforblock:changeattendances', $context))) {
redirect('attendances.php?id='.$id.'&sessionid='.$att->id.'&grouptype='.$att->groupid);
}
} elseif ($size > 1) {
$current = $today;
//temporally set $view for single access to page from block
$view = 'days';
} }
} }
} }

Loading…
Cancel
Save