]> git.mjollnir.org Git - moodle.git/commitdiff
[Added] Added function lesson_delete_course() to clean up the lesson_default table
authormichaelpenne <michaelpenne>
Thu, 9 Mar 2006 02:26:20 +0000 (02:26 +0000)
committermichaelpenne <michaelpenne>
Thu, 9 Mar 2006 02:26:20 +0000 (02:26 +0000)
mod/lesson/lib.php

index 5f1655d9c15497d4ec9ada9c50887967383ee29e..9eadf5806a95f7dfa5f19a55b2cac525b49cab46 100644 (file)
@@ -297,6 +297,29 @@ function lesson_delete_instance($id) {
     return $result;
 }
 
+/**
+ * Given a course object, this function will clean up anything that
+ * would be leftover after all the instances were deleted.
+ *
+ * As of now, this function just cleans the lesson_default table
+ *
+ * @param object $course an object representing the course that is being deleted
+ * @param boolean $feedback to specify if the process must output a summary of its work
+ * @return boolean
+ */
+function lesson_delete_course($course, $feedback=true) {
+
+    $count = count_records('lesson_default', 'course', $course->id);
+    delete_records('lesson_default', 'course', $course->id);
+    
+    //Inform about changes performed if feedback is enabled
+    if ($feedback) {
+        notify(get_string('deletedefaults', 'lesson', $count));
+    }
+    
+    return true;
+}
+
 /*******************************************************************/
 function lesson_user_outline($course, $user, $mod, $lesson) {
 /// Return a small object with summary information about what a