navigation MDL-22506 Fixed error when expanding site acitivities via AJAX

This commit is contained in:
Sam Hemelryk 2010-05-20 06:01:00 +00:00
parent 1c349e9524
commit 1aa1e9b5b9
2 changed files with 7 additions and 4 deletions

View File

@ -178,7 +178,6 @@ M.block_navigation.classes.tree.prototype.load_ajax = function(tid, outcome, arg
}
} catch (e) {
// If we got here then there was an error parsing the result
alert(e.message);
}
// The branch is empty so class it accordingly
args.target.replaceClass('branch', 'emptybranch');

View File

@ -1856,7 +1856,7 @@ class global_navigation_for_ajax extends global_navigation {
$this->cache = new navigation_cache(NAVIGATION_CACHE_NAME);
$this->children = new navigation_node_collection();
$this->rootnodes = array();
//$this->rootnodes['site'] = $this->add_course($SITE);
$this->rootnodes['site'] = $this->add_course($SITE);
$this->rootnodes['courses'] = $this->add(get_string('courses'), null, self::TYPE_ROOTNODE, null, 'courses');
}
/**
@ -1925,8 +1925,12 @@ class global_navigation_for_ajax extends global_navigation {
break;
}
}
$activities = $this->load_section_activities($sections[$cm->sectionnumber]->sectionnode, $cm->sectionnumber, get_fast_modinfo($course));
$modulenode = $this->load_activity($cm, $course, $activities[$cm->id]);
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));
$modulenode = $this->load_activity($cm, $course, $activities[$cm->id]);
}
break;
default:
throw new Exception('Unknown type');