[Hw4mdl-svn] SF.net SVN: hw4mdl: [77] trunk/moodle/mod/liveclassroom/lib.php
Brought to you by:
jhlinder,
trollinger
|
From: <sh...@us...> - 2006-10-03 14:17:22
|
Revision: 77
http://svn.sourceforge.net/hw4mdl/?rev=77&view=rev
Author: shazan
Date: 2006-10-03 07:17:12 -0700 (Tue, 03 Oct 2006)
Log Message:
-----------
add functions to delete room and activities linked
Modified Paths:
--------------
trunk/moodle/mod/liveclassroom/lib.php
Modified: trunk/moodle/mod/liveclassroom/lib.php
===================================================================
--- trunk/moodle/mod/liveclassroom/lib.php 2006-10-03 14:15:57 UTC (rev 76)
+++ trunk/moodle/mod/liveclassroom/lib.php 2006-10-03 14:17:12 UTC (rev 77)
@@ -33,7 +33,7 @@
require_once($CFG->libdir.'/datalib.php');
require_once("api.php");
-
+require_once($CFG->dirroot.'/course/lib.php');
//Suffixes used when creting the profiles account on the LC server
$LIVECLASSROOM_TEACHER_SUFFIX = "_T"; //Teachers will use the user $CFG->liveclassroom_settinguniqueid + $course->id + $LIVECLASSROOM_TEACHER_SUFFIX
$LIVECLASSROOM_STUDENT_SUFFIX = "_S"; //Students will use the user $CFG->liveclassroom_settinguniqueid + $course->id + $LIVECLASSROOM_STUDENT_SUFFIX
@@ -444,10 +444,31 @@
return true;
}
+function liveclassroom_rooms_delete_instance($roomid) {
+/// Given an ID of an instance of this module,
+/// this function will permanently delete the instance
+/// and any data that depends on it.
+
+ if (! $liveclassroom_rooms = get_record("liveclassroom_rooms", "room_id", "$roomid")) {
+ return false;
+ }
+
+ $result = true;
+
+ # Delete any dependent records here #
+
+ if (! delete_records("liveclassroom_rooms", "id", "$liveclassroom_rooms->id")) {
+ $result = false;
+ }
+
+ return $result;
+}
+
+
function liveclassroom_rooms_update_instance($liveclassroom_rooms) {
$liveclassroom_rooms->timemodified = time();
- $liveclassroom_rooms->id = $liveclassroom_rooms->instance;
+ // $liveclassroom_rooms->id = $liveclassroom_rooms->instance;
if(!(update_record("liveclassroom_rooms", $liveclassroom_rooms))) {
error( "Response: update of instance liveclassroom_rooms failed");
@@ -630,6 +651,39 @@
}
}
+function liveclassroom_delete_all_instance_of_room($roomid) {
+/// Given an ID of an instance of this module,
+/// this function will permanently delete the instance
+/// and any data that depends on it.
+ if (! $liveclassrooms = get_records("liveclassroom", "type", $roomid)) {
+ return false;
+ }
+ $result = true;
+
+ # Delete any dependent records here #
+ foreach($liveclassrooms as $liveclassroom){
+
+ //get the course_module instance linked to the liveclassroom instance
+ if (! $cm = get_coursemodule_from_instance("liveclassroom", $liveclassroom->id, $liveclassroom->course)) {
+ error("Course Module ID was incorrect");
+ }
+ if (! delete_course_module($cm->id)) {
+ notify("Could not delete the $cm->id (coursemodule)");
+ }
+ if (! delete_records("liveclassroom", "id", "$liveclassroom->id")) {
+ $result = false;
+ }
+ //delete in the course section too
+ if (! delete_mod_from_section($cm->id, "$cm->section")) {
+ notify("Could not delete the $mod->modulename from that section");
+ }
+
+ }
+
+ return $result;
+}
+
+
?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|