MDL-33937 Paged course view: Allows view of sections that are not visible

This commit is contained in:
sam marshall 2012-06-21 16:24:40 +01:00
parent f4a9bf65da
commit c069dacfc1
2 changed files with 22 additions and 4 deletions

View file

@ -99,8 +99,18 @@
$infoid = $course->id;
if(!empty($section)) {
$loglabel = 'view section';
$sectionparams = array('course' => $course->id, 'section' => $section);
$coursesections = $DB->get_record('course_sections', $sectionparams, 'id', MUST_EXIST);
// Get section details and check it exists.
$modinfo = get_fast_modinfo($course);
$coursesections = $modinfo->get_section_info($section, MUST_EXIST);
// Check user is allowed to see it.
if (!$coursesections->uservisible) {
// Note: We actually already know they don't have this capability
// or uservisible would have been true; this is just to get the
// correct error message shown.
require_capability('moodle/course:viewhiddensections', $context);
}
$infoid = $coursesections->id;
$logparam .= '&sectionid='. $infoid;
}