Permalink
Browse files

Merge branch 'master' of git.moodle.org:/git/integration

  • Loading branch information...
2 parents 1f95c9a + 2c23734 commit 4386e0d1019f1b04b13339cc93fd7b9c650c2638 @stronk7 stronk7 committed Mar 21, 2011
Showing with 9 additions and 10 deletions.
  1. +8 −9 lib/navigationlib.php
  2. +1 −1 user/selector/module.js
View
17 lib/navigationlib.php
@@ -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;
View
2 user/selector/module.js
@@ -89,7 +89,7 @@ M.core_user.init_user_selector = function (Y, name, hash, extrafields, lastsearc
handle_keyup : function(e) {
// Trigger an ajax search after a delay.
this.cancel_timeout();
- this.timeoutid = setTimeout(function(obj){obj.send_query(false)}, this.querydelay*1000, this);
+ this.timeoutid = Y.later(this.querydelay*1000, e, function(obj){obj.send_query(false)}, this);
// Enable or diable the clear button.
this.clearbutton.set('disabled', (this.get_search_text() == ''));

0 comments on commit 4386e0d

Please sign in to comment.