From 020c6ef89641b87a3c794288cb6d87803e067d2c Mon Sep 17 00:00:00 2001 From: Artem Andreev Date: Fri, 10 Sep 2010 11:55:18 +0400 Subject: [PATCH] For redirecting from the block is taken into account the situation when the current time are a few sessions --- manage.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/manage.php b/manage.php index 45875ae..94cadf5 100644 --- a/manage.php +++ b/manage.php @@ -51,10 +51,18 @@ FROM {$CFG->prefix}attendance_sessions WHERE $today BETWEEN sessdate AND (sessdate + duration) AND courseid = $course->id"; - if($att = get_record_sql($sql)) { - 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); + 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 + ($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'; } } }