Permalink
Browse files

Merge branch 'MDL-26903' of git://github.com/samhemelryk/moodle

  • Loading branch information...
2 parents 1997d9d + c78262b commit 61baea5d22e42ef8518fd38e9eb6c02d6ed0a38f @skodak skodak committed Mar 21, 2011
Showing with 8 additions and 9 deletions.
  1. +8 −9 lib/navigationlib.php
View
@@ -2246,23 +2246,22 @@ public function initialise() {
$this->load_section_activities($sections[$course->sectionnumber]->sectionnode, $course->sectionnumber, get_fast_modinfo($course));
break;
case self::TYPE_ACTIVITY :
- $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
+ $sql = "SELECT c.*
+ FROM {course} c
+ JOIN {course_modules} cm ON cm.course = c.id
+ WHERE cm.id = :cmid";
+ $params = array('cmid' => $this->instanceid);
+ $course = $DB->get_record_sql($sql, $params, MUST_EXIST);
$modinfo = get_fast_modinfo($course);
$cm = $modinfo->get_cm($this->instanceid);
require_course_login($course, true, $cm);
$this->page->set_context(get_context_instance(CONTEXT_MODULE, $cm->id));
$coursenode = $this->load_course($course);
- $sections = $this->load_course_sections($course, $coursenode);
- foreach ($sections as $section) {
- if ($section->id == $cm->section) {
- $cm->sectionnumber = $section->section;
- break;
- }
- }
if ($course->id == SITEID) {
$modulenode = $this->load_activity($cm, $course, $coursenode->find($cm->id, self::TYPE_ACTIVITY));
} else {
- $activities = $this->load_section_activities($sections[$cm->sectionnumber]->sectionnode, $cm->sectionnumber, get_fast_modinfo($course));
+ $sections = $this->load_course_sections($course, $coursenode);
+ $activities = $this->load_section_activities($sections[$cm->sectionnum]->sectionnode, $cm->sectionnum, get_fast_modinfo($course));
$modulenode = $this->load_activity($cm, $course, $activities[$cm->id]);
}
break;

0 comments on commit 61baea5

Please sign in to comment.