|
@ -51,11 +51,19 @@ |
|
|
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)) { |
|
|
|
|
|
$size = count($atts); |
|
|
|
|
|
if ($size == 1) { |
|
|
|
|
|
$att = reset($atts); |
|
|
if ((!$att->lasttaken and has_capability('mod/attforblock:takeattendances', $context)) or |
|
|
if ((!$att->lasttaken and has_capability('mod/attforblock:takeattendances', $context)) or |
|
|
($att->lasttaken and has_capability('mod/attforblock:changeattendances', $context))) { |
|
|
($att->lasttaken and has_capability('mod/attforblock:changeattendances', $context))) { |
|
|
redirect('attendances.php?id='.$id.'&sessionid='.$att->id.'&grouptype='.$att->groupid); |
|
|
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'; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|