Browse Source

Fixes #209

use correct url to redirect to view, fix some missing object warnings.
MOODLE_31_STABLE
Dan Marsden 9 years ago
parent
commit
f0089f669c
  1. 13
      classes/structure.php
  2. 3
      manage.php

13
classes/structure.php

@ -676,10 +676,15 @@ class mod_attendance_structure {
GROUP BY ue.userid, ue.status"; GROUP BY ue.userid, ue.status";
$params = array('zerotime' => 0, 'uid' => $userid, 'estatus' => ENROL_INSTANCE_ENABLED, 'courseid' => $this->course->id); $params = array('zerotime' => 0, 'uid' => $userid, 'estatus' => ENROL_INSTANCE_ENABLED, 'courseid' => $this->course->id);
$enrolments = $DB->get_record_sql($sql, $params); $enrolments = $DB->get_record_sql($sql, $params);
if (!empty($enrolments)) {
$user->enrolmentstatus = $enrolments->status; $user->enrolmentstatus = $enrolments->status;
$user->enrolmentstart = $enrolments->mintime; $user->enrolmentstart = $enrolments->mintime;
$user->enrolmentend = $enrolments->maxtime; $user->enrolmentend = $enrolments->maxtime;
} else {
$user->enrolmentstatus = '';
$user->enrolmentstart = 0;
$user->enrolmentend = 0;
}
return $user; return $user;
} }

3
manage.php

@ -46,7 +46,8 @@ $capabilities = array(
'mod/attendance:changeattendances' 'mod/attendance:changeattendances'
); );
if (!has_any_capability($capabilities, $context)) { if (!has_any_capability($capabilities, $context)) {
redirect($att->url_view()); $url = new moodle_url('/mod/attendance/view.php', array('id' => $cm->id));
redirect($url);
} }
$pageparams->init($cm); $pageparams->init($cm);

Loading…
Cancel
Save