MDL-12448 - Fix page_generic_activity->init_full() to use get_coursemodule_from_instance(). Merged from MOODLE_19_STABLE.

This commit is contained in:
tjhunt 2007-12-06 11:38:53 +00:00
parent f9124bd22f
commit 0d7c3b78cd

View File

@ -589,9 +589,7 @@ class page_generic_activity extends page_base {
if(empty($this->activityname)) {
error('Page object derived from page_generic_activity but did not define $this->activityname');
}
$module = get_record('modules', 'name', $this->activityname);
$this->modulerecord = get_record('course_modules', 'module', $module->id, 'instance', $this->id);
if(empty($this->modulerecord)) {
if (!$this->modulerecord = get_coursemodule_from_instance($this->activityname, $this->id)) {
error('Cannot fully initialize page: invalid '.$this->activityname.' instance id '. $this->id);
}
$this->courserecord = get_record('course', 'id', $this->modulerecord->course);