MDL-35339 deprecate get_course_section() replace with course_create_sections_if_missing()

By passing course object instead of course id we ensure proper cache reset"
This commit is contained in:
Marina Glancy 2012-10-08 10:36:01 +08:00
parent 9796014660
commit 4ede27b253
9 changed files with 76 additions and 45 deletions

View file

@ -45,12 +45,7 @@ if (($marker >=0) && has_capability('moodle/course:setcurrentsection', $context)
}
// make sure all sections are created
$modinfo = get_fast_modinfo($course);
for ($sectionnum = 0; $sectionnum <= $course->numsections; $sectionnum++) {
if (!$modinfo->get_section_info($sectionnum)) {
get_course_section($sectionnum, $course->id);
}
}
course_create_sections_if_missing($course, range(0, $course->numsections));
$renderer = $PAGE->get_renderer('format_topics');

View file

@ -38,12 +38,7 @@ if ($week = optional_param('week', 0, PARAM_INT)) {
// End backwards-compatible aliasing..
// make sure all sections are created
$modinfo = get_fast_modinfo($course);
for ($sectionnum = 0; $sectionnum <= $course->numsections; $sectionnum++) {
if (!$modinfo->get_section_info($sectionnum)) {
get_course_section($sectionnum, $course->id);
}
}
course_create_sections_if_missing($course, range(0, $course->numsections));
$renderer = $PAGE->get_renderer('format_weeks');