Merge branch 'MDL-43371-26' of git://github.com/FMCorz/moodle into MOODLE_26_STABLE

This commit is contained in:
Damyon Wiese
2014-01-14 14:05:27 +08:00
+13
View File
@@ -951,6 +951,9 @@ class lesson extends lesson_base {
require_once($CFG->libdir.'/gradelib.php');
require_once($CFG->dirroot.'/calendar/lib.php');
$cm = get_coursemodule_from_instance('lesson', $this->properties->id, $this->properties->course);
$context = context_module::instance($cm->id);
$DB->delete_records("lesson", array("id"=>$this->properties->id));
$DB->delete_records("lesson_pages", array("lessonid"=>$this->properties->id));
$DB->delete_records("lesson_answers", array("lessonid"=>$this->properties->id));
@@ -966,6 +969,10 @@ class lesson extends lesson_base {
}
}
// Delete files associated with this module.
$fs = get_file_storage();
$fs->delete_area_files($context->id);
grade_update('mod/lesson', $this->properties->course, 'mod', 'lesson', $this->properties->id, 0, null, array('deleted'=>1));
return true;
}
@@ -1820,6 +1827,12 @@ abstract class lesson_page extends lesson_base {
// ..and the page itself
$DB->delete_records("lesson_pages", array("id" => $this->properties->id));
// Delete files associated with this page.
$cm = get_coursemodule_from_instance('lesson', $this->lesson->id, $this->lesson->course);
$context = context_module::instance($cm->id);
$fs = get_file_storage();
$fs->delete_area_files($context->id, 'mod_lesson', 'page_contents', $this->properties->id);
// repair the hole in the linkage
if (!$this->properties->prevpageid && !$this->properties->nextpageid) {
//This is the only page, no repair needed