[Hw4mdl-svn] SF.net SVN: hw4mdl: [154] trunk/moodle
Brought to you by:
jhlinder,
trollinger
|
From: <hu...@us...> - 2007-01-02 15:45:49
|
Revision: 154
http://svn.sourceforge.net/hw4mdl/?rev=154&view=rev
Author: hugues
Date: 2007-01-02 07:45:44 -0800 (Tue, 02 Jan 2007)
Log Message:
-----------
http://u.horizonwimba.com/bugzilla/show_bug.cgi?id=10533
- Updated the way we send the id of the room to delete and foxed a room deletion bug as well :(
- fixed the archive deletion mesage
- re-indented another file
Modified Paths:
--------------
trunk/moodle/lang/en_utf8/liveclassroom.php
trunk/moodle/mod/liveclassroom/api.php
trunk/moodle/mod/liveclassroom/lib.php
trunk/moodle/mod/liveclassroom/manageRoomAction.php
trunk/moodle/mod/liveclassroom/welcome.php
Modified: trunk/moodle/lang/en_utf8/liveclassroom.php
===================================================================
--- trunk/moodle/lang/en_utf8/liveclassroom.php 2006-12-29 16:03:27 UTC (rev 153)
+++ trunk/moodle/lang/en_utf8/liveclassroom.php 2007-01-02 15:45:44 UTC (rev 154)
@@ -86,6 +86,7 @@
$string['roomCreated'] = "Your room has been successfully created.";
$string['roomUpdated'] = "Your room has been successfully updated.";
$string['roomDeleted'] = "Your room has been successfully deleted.";
+$string['archiveDeleted'] = "Your archive has been successfully deleted.";
$string['notfind'] = "Invalid Live Classroom parameters. Please contact your administrator for more information.";
$string['room'] = "Invalid Live Classroom parameters. Please contact your administrator for more information. ";
$string['connection'] = "Moodle cannot connect to the Live Classroom server. Please reload the page or contact your administrator for more information. ";
Modified: trunk/moodle/mod/liveclassroom/api.php
===================================================================
--- trunk/moodle/mod/liveclassroom/api.php 2006-12-29 16:03:27 UTC (rev 153)
+++ trunk/moodle/mod/liveclassroom/api.php 2007-01-02 15:45:44 UTC (rev 154)
@@ -539,17 +539,19 @@
global $CFG;
global $COURSE;
- liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_DELETE_ROOM,"&target=$roomid");
-
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_DELETE_ROOM,"&target=$roomid");
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
if ( $respcode == 302) {
- add_to_log($COURSE->id, "liveclassroom", "Delete Room", liveclassroom_send_logs("errorDeleteRoom302","roomId=$roomid&courseId=".$COURSE->id), "$roomid suppression failed");
- // error( "Target not found");
- return false;
+ add_to_log($COURSE->id, "liveclassroom", "Delete Room", liveclassroom_send_logs("errorDeleteRoom302","roomId=$roomid&courseId=".$COURSE->id), "$roomid suppression failed");
+ // error( "Target not found");
+ return false;
}
else if ( $respcode != 100) {
- add_to_log($COURSE->id, "liveclassroom", "Delete Room", liveclassroom_send_logs("errorDeleteRoom100","roomId=$roomid&courseId=".$COURSE->id), "$roomid suppression failed");
- return false;
- }
+ add_to_log($COURSE->id, "liveclassroom", "Delete Room", liveclassroom_send_logs("errorDeleteRoom100","roomId=$roomid&courseId=".$COURSE->id), "$roomid suppression failed");
+ return false;
+ }
add_to_log($COURSE->id, "liveclassroom", "Delete Room", liveclassroom_send_logs("deleteRoom","roomId=$roomid&courseId=".$COURSE->id), "$roomid has been deleted with success");
return true;
@@ -566,7 +568,7 @@
global $COURSE;
- liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_MODIFY_ROOM,"&target=$roomid&preview=0");
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_MODIFY_ROOM,"&target=$roomid&preview=0");
preg_match("(\d*)", $data, $matches);
$respcode = $matches[0];
Modified: trunk/moodle/mod/liveclassroom/lib.php
===================================================================
--- trunk/moodle/mod/liveclassroom/lib.php 2006-12-29 16:03:27 UTC (rev 153)
+++ trunk/moodle/mod/liveclassroom/lib.php 2007-01-02 15:45:44 UTC (rev 154)
@@ -50,27 +50,27 @@
* @return nothing, but returns an error if the configuration is wrong
*/
function liveclassroom_process_options ($config) {
- global $CFG;
-
- if(empty($config->servername)){
- add_to_log("", "liveclassroom", "URL", liveclassroom_send_logs("errorUrlUnavailable",""), "URL unavailable");
- error(get_string('wrongconfigurationURLunavailable', 'liveclassroom'));
- }
- else if(empty($config->adminusername)){
- error(get_string('emptyAdminUsername', 'liveclassroom'));
- }
- else if(empty($config->adminpassword)){
- error(get_string('emptyAdminPassword', 'liveclassroom'));
- }
-
- liveclassroom_api_authenticate($config->servername,$config->adminusername,$config->adminpassword);
+ global $CFG;
+
+ if(empty($config->servername)){
+ add_to_log("", "liveclassroom", "URL", liveclassroom_send_logs("errorUrlUnavailable",""), "URL unavailable");
+ error(get_string('wrongconfigurationURLunavailable', 'liveclassroom'));
+ }
+ else if(empty($config->adminusername)){
+ error(get_string('emptyAdminUsername', 'liveclassroom'));
+ }
+ else if(empty($config->adminpassword)){
+ error(get_string('emptyAdminPassword', 'liveclassroom'));
+ }
+
+ liveclassroom_api_authenticate($config->servername,$config->adminusername,$config->adminpassword);
- //TODO: check the user is really an admin
- return;
+ //TODO: check the user is really an admin
+ return;
}
/*
-* Create a new instance of liveclassroom
+* Create a new instance of liveclassroom
* @param $liveclassroom : object liveclassroom
*/
function liveclassroom_add_instance($liveclassroom) {
@@ -86,11 +86,11 @@
if($result = insert_record("liveclassroom", $liveclassroom)) {
add_to_log($liveclassroom->course, "liveclassroom", "Add activity",
- liveclassroom_send_logs("addInstance","liveclassroomId=".$result."&roomname=$roomname"), "Activity \"".$liveclassroom->name."\" added");
+ liveclassroom_send_logs("addInstance","liveclassroomId=".$result."&roomname=$roomname"), "Activity \"".$liveclassroom->name."\" added");
}
else {
add_to_log($liveclassroom->course, "liveclassroom", "Add activity",
- liveclassroom_send_logs("errorAddInstance","liveclassroomId=".$result."&roomname=$roomname"), "Activity \"".$liveclassroom->name."\" has not been added");
+ liveclassroom_send_logs("errorAddInstance","liveclassroomId=".$result."&roomname=$roomname"), "Activity \"".$liveclassroom->name."\" has not been added");
$result=false;
}
return $result;
@@ -108,43 +108,43 @@
// Need to update the section
-
- //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");
- }
- $old_section = $cm->section;
- //Find the right section in the course_section
- $section = get_record("course_sections", "id", $cm->section);
-
- //delete in the course section
- if (! delete_mod_from_section($cm->id, "$cm->section")) {
- // add_to_log("", "liveclassroom", "$LIVECLASSROOM_LOGS?error=deleteAll", "Delete all activities", "Could not delete the ".$mod->modulename." from that section");
- $result = false;
- //notify("Could not delete the $mod->modulename from that section");
- }
- //update the course module section
- if (! $sectionid = add_mod_to_section($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");
+ }
+ $old_section = $cm->section;
+ //Find the right section in the course_section
+ $section = get_record("course_sections", "id", $cm->section);
+
+ //delete in the course section
+ if (! delete_mod_from_section($cm->id, "$cm->section")) {
+ // add_to_log("", "liveclassroom", "$LIVECLASSROOM_LOGS?error=deleteAll", "Delete all activities", "Could not delete the ".$mod->modulename." from that section");
+ $result = false;
+ //notify("Could not delete the $mod->modulename from that section");
+ }
+ //update the course module section
+ if (! $sectionid = add_mod_to_section($liveclassroom) ) {
error("Could not add the new course module to that section");
}
- //update the course modules
+ //update the course modules
if (! set_field("course_modules", "section", $sectionid, "id", $cm->id)) {
error("Could not update the course module with the correct section");
}
- add_to_log($liveclassrooms->course, "liveclassroom", "Update activity", liveclassroom_send_logs("updateInstance","liveclassroomId=".$liveclassroom->id."&roomname=$roomname"), "Activity ".$liveclassroom->name." has been updated with success");
+ add_to_log($liveclassrooms->course, "liveclassroom", "Update activity", liveclassroom_send_logs("updateInstance","liveclassroomId=".$liveclassroom->id."&roomname=$roomname"), "Activity ".$liveclassroom->name." has been updated with success");
return update_record("liveclassroom", $liveclassroom);
/*
if(update_record("liveclassroom", $liveclassroom)){
- add_to_log("", "liveclassroom", "Update activity", "$LIVECLASSROOM_LOGS?type=addInstance", "Activity ".$liveclassroom->name." has been updated with success, associated to the room $roomname");
- return true;
- }
-
+ add_to_log("", "liveclassroom", "Update activity", "$LIVECLASSROOM_LOGS?type=addInstance", "Activity ".$liveclassroom->name." has been updated with success, associated to the room $roomname");
+ return true;
+ }
+
else {
- add_to_log("", "liveclassroom", "Update activity", "$LIVECLASSROOM_LOGS?type=addInstance", "Activity ".$liveclassroom->name." associated to the room $roomname, has not been updated");
- return false;
- }*/
+ add_to_log("", "liveclassroom", "Update activity", "$LIVECLASSROOM_LOGS?type=addInstance", "Activity ".$liveclassroom->name." associated to the room $roomname, has not been updated");
+ return false;
+ }*/
}
@@ -152,7 +152,7 @@
/// 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 = get_record("liveclassroom", "id", "$id")) {
return false;
}
@@ -162,11 +162,11 @@
# Delete any dependent records here #
if (! delete_records("liveclassroom", "id", $liveclassroom->id)) {
- add_to_log($liveclassrooms->course, "liveclassroom", "Delete activity", liveclassroom_send_logs("errorDeleteInstance","liveclassroomId=".$liveclassroom->id."&roomname=$roomname"), "Activity ".$liveclassroom->name." deletion failed");
- $result = false;
+ add_to_log($liveclassrooms->course, "liveclassroom", "Delete activity", liveclassroom_send_logs("errorDeleteInstance","liveclassroomId=".$liveclassroom->id."&roomname=$roomname"), "Activity ".$liveclassroom->name." deletion failed");
+ $result = false;
}
- add_to_log($liveclassrooms->course, "liveclassroom", "Delete activity", liveclassroom_send_logs("deleteInstance","liveclassroomId=".$liveclassroom->id."&roomname=$roomname"), "Activity ".$liveclassroom->name." has been deleted with success");
-
+ add_to_log($liveclassrooms->course, "liveclassroom", "Delete activity", liveclassroom_send_logs("deleteInstance","liveclassroomId=".$liveclassroom->id."&roomname=$roomname"), "Activity ".$liveclassroom->name." has been deleted with success");
+
return $result;
}
@@ -255,11 +255,11 @@
$enc_coursename = str_replace(" ", "_", $course->shortname);
$userid = LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.LIVECLASSROOM_TEACHER_SUFFIX;
-
+
if (! liveclassroom_api_create_user ($userid, $enc_coursename, 'Teacher')) {
//error("Cannot Create Teacher profile");
- return false;
+ return false;
}
$userid = LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.LIVECLASSROOM_STUDENT_SUFFIX;
@@ -267,7 +267,7 @@
if (! liveclassroom_api_create_user ($userid, $enc_coursename, 'Student')) {
//error("Cannot Create Student profile");
- return false;
+ return false;
}
return true;
}
@@ -281,16 +281,16 @@
*/
function liveclassroom_create_rooms ($course) {
- //teacher is the lead of the presentation
+ //teacher is the lead of the presentation
- liveclassroom_create_room($course->id, "Main Lecture Hall", true, liveclassroom_api_give_lectureroom_attributes());
-
- //teachers and students have the same rights
- liveclassroom_create_room($course->id, "Group 1", false, liveclassroom_api_give_discussionroom_attributes());
- liveclassroom_create_room($course->id, "Group 2", false, liveclassroom_api_give_discussionroom_attributes());
- liveclassroom_create_room($course->id, "Group 3", false, liveclassroom_api_give_discussionroom_attributes());
-
- return true;
+ liveclassroom_create_room($course->id, "Main Lecture Hall", true, liveclassroom_api_give_lectureroom_attributes());
+
+ //teachers and students have the same rights
+ liveclassroom_create_room($course->id, "Group 1", false, liveclassroom_api_give_discussionroom_attributes());
+ liveclassroom_create_room($course->id, "Group 2", false, liveclassroom_api_give_discussionroom_attributes());
+ liveclassroom_create_room($course->id, "Group 3", false, liveclassroom_api_give_discussionroom_attributes());
+
+ return true;
}
@@ -326,53 +326,53 @@
$teacherid = LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.LIVECLASSROOM_TEACHER_SUFFIX;
$studentid = LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.LIVECLASSROOM_STUDENT_SUFFIX;
-
- if($bool==true) { // main lecture hall
-
- if (! liveclassroom_api_create_class ($roomid, $roomname, $bool, $attributes)) {
- //error ("liveclassroom_create_room: Cannot create room with id:$roomid and name: $roomname");
- return false;
- }
- if (! liveclassroom_api_add_user_role ($roomid, $teacherid, 'ClassAdmin')) {
-
- //error('liveclassroom_create_room: Cannot add classadminright to Teachers');
- return false;
- }
- if (! liveclassroom_api_add_user_role ($roomid, $studentid, 'Student')) {
- //error('liveclassroom_create_room: Cannot add Participant right to students');
- return false;
- }
- if (! liveclassroom_api_remove_user_role ($roomid, 'Guest' , 'Student')) {
- //error('liveclassroom_create_room: Cannot remove Participant right to Guest');
- return false;
- }
- }
- else if($bool==false){ // discussion room
- if (! liveclassroom_api_create_class ($roomid, $roomname, $bool, $attributes)) {
- //error ("liveclassroom_create_room: Cannot create room with id:$roomid and name: $roomname");
- return false;
- }
- if (! liveclassroom_api_add_user_role ($roomid, $teacherid, 'ClassAdmin')) {
-
- //error('liveclassroom_create_room: Cannot add classadminright to Teachers');
- return false;
- }
- if (! liveclassroom_api_add_user_role ($roomid, $studentid, 'Instructor')) {
- //error('liveclassroom_create_room: Cannot add Participant right to students');
- return false;
- }
- if (! liveclassroom_api_remove_user_role ($roomid, 'Guest' , 'Student')) {
- //error('liveclassroom_create_room: Cannot remove Participant right to Guest');
- return false;
- }
- }
- //Guest enabled?
- if ((isset($attributes['guests'])) && ($attributes['guests']==1)) {
- if (! liveclassroom_api_add_user_role ($roomid, 'Guest' , 'Student')) {
- return false;
- }
- }
-
+
+ if($bool==true) { // main lecture hall
+
+ if (! liveclassroom_api_create_class ($roomid, $roomname, $bool, $attributes)) {
+ //error ("liveclassroom_create_room: Cannot create room with id:$roomid and name: $roomname");
+ return false;
+ }
+ if (! liveclassroom_api_add_user_role ($roomid, $teacherid, 'ClassAdmin')) {
+
+ //error('liveclassroom_create_room: Cannot add classadminright to Teachers');
+ return false;
+ }
+ if (! liveclassroom_api_add_user_role ($roomid, $studentid, 'Student')) {
+ //error('liveclassroom_create_room: Cannot add Participant right to students');
+ return false;
+ }
+ if (! liveclassroom_api_remove_user_role ($roomid, 'Guest' , 'Student')) {
+ //error('liveclassroom_create_room: Cannot remove Participant right to Guest');
+ return false;
+ }
+ }
+ else if($bool==false){ // discussion room
+ if (! liveclassroom_api_create_class ($roomid, $roomname, $bool, $attributes)) {
+ //error ("liveclassroom_create_room: Cannot create room with id:$roomid and name: $roomname");
+ return false;
+ }
+ if (! liveclassroom_api_add_user_role ($roomid, $teacherid, 'ClassAdmin')) {
+
+ //error('liveclassroom_create_room: Cannot add classadminright to Teachers');
+ return false;
+ }
+ if (! liveclassroom_api_add_user_role ($roomid, $studentid, 'Instructor')) {
+ //error('liveclassroom_create_room: Cannot add Participant right to students');
+ return false;
+ }
+ if (! liveclassroom_api_remove_user_role ($roomid, 'Guest' , 'Student')) {
+ //error('liveclassroom_create_room: Cannot remove Participant right to Guest');
+ return false;
+ }
+ }
+ //Guest enabled?
+ if ((isset($attributes['guests'])) && ($attributes['guests']==1)) {
+ if (! liveclassroom_api_add_user_role ($roomid, 'Guest' , 'Student')) {
+ return false;
+ }
+ }
+
return true;
}
@@ -384,7 +384,7 @@
* @return array the activity ids of classrooms links available for this course
*/
function liveclassroom_ids($courseid) {
- return array ();
+ return array ();
}
/**
@@ -393,7 +393,7 @@
* @return string the number of classrooms available for this course
*/
function liveclassroom_count_rooms($courseid) {
- return '0';
+ return '0';
}
@@ -403,7 +403,7 @@
* @return string the number of archives available for this course
*/
function liveclassroom_count_archives($courseid) {
- return '0';
+ return '0';
}
@@ -413,15 +413,15 @@
* Return a string : the shortname of the course
*/
function liveclassroom_get_course_shortname($courseid) {
-
- if(!($course = get_record('course','id',$courseid))) {
- //error( "Response get room name: query to database failed");
- return false;
- }
+
+ if(!($course = get_record('course','id',$courseid))) {
+ //error( "Response get room name: query to database failed");
+ return false;
+ }
- // $name = $course->shortname;
- return $course->shortname;
-
+ // $name = $course->shortname;
+ return $course->shortname;
+
}
/*
@@ -431,20 +431,20 @@
* Return a table with the activities name
*/
function liveclassroom_get_activities_list_per_room($course,$roomname) {
-
- if(!($activity_list = get_records('liveclassroom','course',$course->id))) {
- error( "Response get_activities_list : query to database failed");
- }
+
+ if(!($activity_list = get_records('liveclassroom','course',$course->id))) {
+ error( "Response get_activities_list : query to database failed");
+ }
- $i=0;
- foreach($activity_list as $liveclassroom) {
- if($liveclassroom->type==$roomname) {
- $list_return[$i] = $liveclassroom->name;
- $i++;
- }
- }
+ $i=0;
+ foreach($activity_list as $liveclassroom) {
+ if($liveclassroom->type==$roomname) {
+ $list_return[$i] = $liveclassroom->name;
+ $i++;
+ }
+ }
- return $list_return;
+ return $list_return;
}
/* To know if the room given is a lecture room
@@ -452,16 +452,16 @@
* return a boolean : true if the room is lecture room, false if not.
*/
function liveclassroom_is_lecturehall($roomid,$courseid) {
-
- $studentuserid = liveclassroom_api_get_student_user_id($courseid);
+
+ $studentuserid = liveclassroom_api_get_student_user_id($courseid);
- if(liveclassroom_api_role_user_room($roomid, $studentuserid)=='Student') {
- return true;
- }
- else{
- return false ;
- }
-
+ if(liveclassroom_api_role_user_room($roomid, $studentuserid)=='Student') {
+ return true;
+ }
+ else{
+ return false ;
+ }
+
}
/* To know if the room given is a discussion room
@@ -469,67 +469,67 @@
* return a boolean : true if the room is breakout room, false if not.
*/
function liveclassroom_is_breakout($roomid, $courseid) {
-
- $studentuserid = liveclassroom_api_get_student_user_id($courseid);
+
+ $studentuserid = liveclassroom_api_get_student_user_id($courseid);
- if(liveclassroom_api_role_user_room($roomid, $studentuserid)=='Instructor') {
- return true;
- }
- else{
- return false;
- }
+ if(liveclassroom_api_role_user_room($roomid, $studentuserid)=='Instructor') {
+ return true;
+ }
+ else{
+ return false;
+ }
}
/*
* Delete all the activities on Moodle database for a room given
* @praram $roomid : the id of the room associated to the activities
-* return a boolean true if all is well done
+* return a boolean true if all is well done
*/
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.
-
- $result = true;
+
+ $result = true;
if ($liveclassrooms = get_records("liveclassroom", "type", $roomid)) {
$roomname = liveclassroom_api_get_room_name($liveclassroom->type);
- # 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)) {
- add_to_log($liveclassrooms->course, "liveclassroom", liveclassroom_send_logs("errorDeleteAllcm","liveclassroomId=".$liveclassroom->id."&roomname=$roomname&cm=".$cm->id), "Delete all activities", "Could not delete the ".$cm->id." (coursemodule)");
- $result = false;
- //Delete a course module and any associated data at the course level (events)
- // notify("Could not delete the $cm->id (coursemodule)");
- }
- if (! delete_records("liveclassroom", "id", "$liveclassroom->id")) {
- add_to_log($liveclassrooms->course, "liveclassroom", liveclassroom_send_logs("errorDeleteAlldb","liveclassroomId=".$liveclassroom->id."&roomname=$roomname"), "Delete all activities", "All activities associated to the room $roomname have not been deleted from the liveclassroom database");
- $result = false;
- }
- //delete in the course section too
- if (! delete_mod_from_section($cm->id, "$cm->section")) {
- add_to_log($liveclassrooms->course, "liveclassroom", liveclassroom_send_logs("errorDeleteAllsection","liveclassroomId=".$liveclassroom->id."&roomname=$roomname&cm=".$cm->id."§ion=".$cm->section), "Delete all activities", "Could not delete the ".$cm->id." from that section");
- $result = false;
- //notify("Could not delete the $mod->modulename from that section");
- }
-
- }
- }
-
- add_to_log($liveclassrooms->course, "liveclassroom", liveclassroom_send_logs("deleteAll","liveclassroomId=".$liveclassroom->id."&roomname=$roomname"), "Delete all activities", "All activities associated to the room $roomname have been deleted with success");
-
+ # 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)) {
+ add_to_log($liveclassrooms->course, "liveclassroom", liveclassroom_send_logs("errorDeleteAllcm","liveclassroomId=".$liveclassroom->id."&roomname=$roomname&cm=".$cm->id), "Delete all activities", "Could not delete the ".$cm->id." (coursemodule)");
+ $result = false;
+ //Delete a course module and any associated data at the course level (events)
+ // notify("Could not delete the $cm->id (coursemodule)");
+ }
+ if (! delete_records("liveclassroom", "id", "$liveclassroom->id")) {
+ add_to_log($liveclassrooms->course, "liveclassroom", liveclassroom_send_logs("errorDeleteAlldb","liveclassroomId=".$liveclassroom->id."&roomname=$roomname"), "Delete all activities", "All activities associated to the room $roomname have not been deleted from the liveclassroom database");
+ $result = false;
+ }
+ //delete in the course section too
+ if (! delete_mod_from_section($cm->id, "$cm->section")) {
+ add_to_log($liveclassrooms->course, "liveclassroom", liveclassroom_send_logs("errorDeleteAllsection","liveclassroomId=".$liveclassroom->id."&roomname=$roomname&cm=".$cm->id."§ion=".$cm->section), "Delete all activities", "Could not delete the ".$cm->id." from that section");
+ $result = false;
+ //notify("Could not delete the $mod->modulename from that section");
+ }
+
+ }
+ }
+
+ add_to_log($liveclassrooms->course, "liveclassroom", liveclassroom_send_logs("deleteAll","liveclassroomId=".$liveclassroom->id."&roomname=$roomname"), "Delete all activities", "All activities associated to the room $roomname have been deleted with success");
+
return $result;
}
/*
-* Create a linePart element - represent a <td>
+* Create a linePart element - represent a <td>
*
* @param $xmldoc : the DOM document
* @param $p_type : type of the element
@@ -538,67 +538,67 @@
* Return a DOM document element
**/
function liveclassroom_create_linepart_element($xmldoc, $p_displayContext, $p_type, $p_parameters) {
-
- $element = $xmldoc->create_element('lineElement');
-
- $displayContext = $xmldoc->create_element('displayContext');
- $displayContext->append_child($xmldoc->create_text_node($p_displayContext));
- $element->append_child($displayContext);
- $type = $xmldoc->create_element('type');
- $type->append_child($xmldoc->create_text_node($p_type));
- $element->append_child($type);
- $parameters = $xmldoc->create_element('parameters');
-
- foreach ($p_parameters as $key => $valuetab) {
-
- $parameter = $xmldoc->create_element('parameter');
- $name = $xmldoc->create_element('name');
- $name->append_child($xmldoc->create_text_node("$key"));
- $value = $xmldoc->create_element('value');
- $value->append_child($xmldoc->create_text_node("$valuetab"));
- $parameter->append_child($name);
- $parameter->append_child($value);
-
- $parameters->append_child($parameter);
-
- }
+
+ $element = $xmldoc->create_element('lineElement');
+
+ $displayContext = $xmldoc->create_element('displayContext');
+ $displayContext->append_child($xmldoc->create_text_node($p_displayContext));
+ $element->append_child($displayContext);
+ $type = $xmldoc->create_element('type');
+ $type->append_child($xmldoc->create_text_node($p_type));
+ $element->append_child($type);
+ $parameters = $xmldoc->create_element('parameters');
+
+ foreach ($p_parameters as $key => $valuetab) {
+
+ $parameter = $xmldoc->create_element('parameter');
+ $name = $xmldoc->create_element('name');
+ $name->append_child($xmldoc->create_text_node("$key"));
+ $value = $xmldoc->create_element('value');
+ $value->append_child($xmldoc->create_text_node("$valuetab"));
+ $parameter->append_child($name);
+ $parameter->append_child($value);
+
+ $parameters->append_child($parameter);
+
+ }
-
- $element->append_child($parameters);
-
- return $element;
+
+ $element->append_child($parameters);
+
+ return $element;
}
/*
-* Create a header bar element
+* Create a header bar element
*
* @param $xmldoc : the DOM document
*
* Return a DOM document element which represent the header bar
**/
function liveclassroom_create_headerbar($xmldoc){
- $headerbar = $xmldoc->create_element('windowsElement');
-
- $hbtype = $xmldoc->create_element('type');
- $hbtype->append_child($xmldoc->create_text_node("headerBar"));
- $headerbar->append_child($hbtype);
- $hbelementParameters = $xmldoc->create_element("windowsElementParameters");
- $headerbarinformations = $xmldoc->create_element("headerBarInformations");
- $hbstyle = $xmldoc->create_element("style");
- $hbstyle->append_child($xmldoc->create_text_node("headerBar"));
- $headerbarinformations->append_child($hbstyle);
- $hbpictureUrl = $xmldoc->create_element("pictureUrl");
- $hbpictureUrl->append_child($xmldoc->create_text_node("pictures/items/headerbar-logo.png"));
- $headerbarinformations->append_child($hbpictureUrl);
- $hbelementParameters->append_child($headerbarinformations);
-
- $headerbar->append_child($hbelementParameters);
-
- return $headerbar;
+ $headerbar = $xmldoc->create_element('windowsElement');
+
+ $hbtype = $xmldoc->create_element('type');
+ $hbtype->append_child($xmldoc->create_text_node("headerBar"));
+ $headerbar->append_child($hbtype);
+ $hbelementParameters = $xmldoc->create_element("windowsElementParameters");
+ $headerbarinformations = $xmldoc->create_element("headerBarInformations");
+ $hbstyle = $xmldoc->create_element("style");
+ $hbstyle->append_child($xmldoc->create_text_node("headerBar"));
+ $headerbarinformations->append_child($hbstyle);
+ $hbpictureUrl = $xmldoc->create_element("pictureUrl");
+ $hbpictureUrl->append_child($xmldoc->create_text_node("pictures/items/headerbar-logo.png"));
+ $headerbarinformations->append_child($hbpictureUrl);
+ $hbelementParameters->append_child($headerbarinformations);
+
+ $headerbar->append_child($hbelementParameters);
+
+ return $headerbar;
}
/*
-* Create a validation comment element
+* Create a validation comment element
*
* @param $xmldoc : the DOM document
* @param $parameters : array of parameters to add to the element
@@ -606,28 +606,28 @@
* Return a DOM document element which represent the validation comment
**/
function liveclassroom_create_validation_comment($xmldoc, $parameters){
- $validationelement = $xmldoc->create_element("validationElement");
- $vtype = $xmldoc->create_element("type");
- $vtype->append_child($xmldoc->create_text_node("validationComment"));
- $validationelement->append_child($vtype);
-
- $vparameters = $xmldoc->create_element("parameters");
-
- foreach ($parameters as $key => $valuetab) {
-
- $name = $xmldoc->create_element("$key");
- $name->append_child($xmldoc->create_text_node("$valuetab"));
- $vparameters->append_child($name);
-
- }
-
- $validationelement->append_child($vparameters);
-
- return $validationelement;
+ $validationelement = $xmldoc->create_element("validationElement");
+ $vtype = $xmldoc->create_element("type");
+ $vtype->append_child($xmldoc->create_text_node("validationComment"));
+ $validationelement->append_child($vtype);
+
+ $vparameters = $xmldoc->create_element("parameters");
+
+ foreach ($parameters as $key => $valuetab) {
+
+ $name = $xmldoc->create_element("$key");
+ $name->append_child($xmldoc->create_text_node("$valuetab"));
+ $vparameters->append_child($name);
+
+ }
+
+ $validationelement->append_child($vparameters);
+
+ return $validationelement;
}
/*
-* Create a validation button element
+* Create a validation button element
*
* @param $xmldoc : the DOM document
* @param $parameters : array of parameters to add to the element
@@ -637,48 +637,48 @@
**/
function liveclassroom_create_validation_button($xmldoc, $parameters, $actionParameters){
- $validationelement = $xmldoc->create_element("validationElement");
- $vtype = $xmldoc->create_element("type");
- $vtype->append_child($xmldoc->create_text_node("validationButton"));
- $validationelement->append_child($vtype);
-
- $vparameters = $xmldoc->create_element("parameters");
-
- $vstyle = $xmldoc->create_element("style");
- $vstyle->append_child($xmldoc->create_text_node($parameters['style']));
- $vparameters->append_child($vstyle);
+ $validationelement = $xmldoc->create_element("validationElement");
+ $vtype = $xmldoc->create_element("type");
+ $vtype->append_child($xmldoc->create_text_node("validationButton"));
+ $validationelement->append_child($vtype);
+
+ $vparameters = $xmldoc->create_element("parameters");
+
+ $vstyle = $xmldoc->create_element("style");
+ $vstyle->append_child($xmldoc->create_text_node($parameters['style']));
+ $vparameters->append_child($vstyle);
- $vaction = $xmldoc->create_element("action");
- $vactionName = $xmldoc->create_element("name");
- $vactionName->append_child($xmldoc->create_text_node($parameters['action'] ));
- $vaction->append_child($vactionName);
-
-
-
- $vactionParameters = $xmldoc->create_element("parameters");
-
- foreach ($actionParameters as $parameter) {
-
- $actionParameter = $xmldoc->create_element("parameter");
- $actionParameter->append_child($xmldoc->create_text_node("$parameter"));
+ $vaction = $xmldoc->create_element("action");
+ $vactionName = $xmldoc->create_element("name");
+ $vactionName->append_child($xmldoc->create_text_node($parameters['action'] ));
+ $vaction->append_child($vactionName);
+
+
+
+ $vactionParameters = $xmldoc->create_element("parameters");
+
+ foreach ($actionParameters as $parameter) {
+
+ $actionParameter = $xmldoc->create_element("parameter");
+ $actionParameter->append_child($xmldoc->create_text_node("$parameter"));
- $vactionParameters->append_child($actionParameter);
-
- }
- $vaction->append_child($vactionParameters);
-
- $vparameters->append_child($vaction);
-
- $vactionValue = $xmldoc->create_element("value");
- $vactionValue->append_child($xmldoc->create_text_node($parameters['value']));
- $vparameters->append_child($vactionValue);
-
- $validationelement->append_child($vparameters);
- return $validationelement;
+ $vactionParameters->append_child($actionParameter);
+
+ }
+ $vaction->append_child($vactionParameters);
+
+ $vparameters->append_child($vaction);
+
+ $vactionValue = $xmldoc->create_element("value");
+ $vactionValue->append_child($xmldoc->create_text_node($parameters['value']));
+ $vparameters->append_child($vactionValue);
+
+ $validationelement->append_child($vparameters);
+ return $validationelement;
}
/*
-* Create a validation button bar element
+* Create a validation button bar element
*
* @param $xmldoc : the DOM document
* Uses liveclassroom_create_validation_comment and liveclassroom_create_validation_button
@@ -686,48 +686,48 @@
**/
function liveclassroom_create_validationbar($xmldoc,$roomId){
- $headerbar = $xmldoc->create_element('windowsElement');
-
- $hbtype = $xmldoc->create_element('type');
- $hbtype->append_child($xmldoc->create_text_node("validationBar"));
- $headerbar->append_child($hbtype);
- $hbelementParameters = $xmldoc->create_element("windowsElementParameters");
-
- $validationelements = $xmldoc->create_element("validationElements");
- $parameters = array("style" => "alert", "value" => "*");
- $validationelements->append_child(liveclassroom_create_validation_comment($xmldoc, $parameters));
-
- $parameters = array("style" => "", "value" => "Required Fields");
- $validationelements->append_child(liveclassroom_create_validation_comment($xmldoc, $parameters));
-
- $parameters = array("style" => "", "name" => "", "action" => "launchAjaxRequest", "value" => "Cancel");
- $actionParameters = array("generateListRooms.php", "Management", "_", "false");
- $validationelements->append_child(liveclassroom_create_validation_button($xmldoc, $parameters, $actionParameters));
-
- if($_GET['action']=='update'){
- $submit = "updateRoom";
- $submitName = "Save all";
- }
- else
- {
- $submit = "createRoom";
- $submitName = "Create";
- }
-
- $parameters = array("style" => "comment", "name" => "", "action" => "submitForm", "value" => "$submitName");
-
- $actionParameters = array("manageRoomAction.php", "$submit", "id" => "$roomId");
- $validationelements->append_child(liveclassroom_create_validation_button($xmldoc, $parameters, $actionParameters));
-
-
- $hbelementParameters->append_child($validationelements);
- $headerbar->append_child($hbelementParameters);
-
- return $headerbar;
+ $headerbar = $xmldoc->create_element('windowsElement');
+
+ $hbtype = $xmldoc->create_element('type');
+ $hbtype->append_child($xmldoc->create_text_node("validationBar"));
+ $headerbar->append_child($hbtype);
+ $hbelementParameters = $xmldoc->create_element("windowsElementParameters");
+
+ $validationelements = $xmldoc->create_element("validationElements");
+ $parameters = array("style" => "alert", "value" => "*");
+ $validationelements->append_child(liveclassroom_create_validation_comment($xmldoc, $parameters));
+
+ $parameters = array("style" => "", "value" => "Required Fields");
+ $validationelements->append_child(liveclassroom_create_validation_comment($xmldoc, $parameters));
+
+ $parameters = array("style" => "", "name" => "", "action" => "launchAjaxRequest", "value" => "Cancel");
+ $actionParameters = array("generateListRooms.php", "Management", "_", "false");
+ $validationelements->append_child(liveclassroom_create_validation_button($xmldoc, $parameters, $actionParameters));
+
+ if($_GET['action']=='update'){
+ $submit = "updateRoom";
+ $submitName = "Save all";
+ }
+ else
+ {
+ $submit = "createRoom";
+ $submitName = "Create";
+ }
+
+ $parameters = array("style" => "comment", "name" => "", "action" => "submitForm", "value" => "$submitName");
+
+ $actionParameters = array("manageRoomAction.php", "$submit", "id" => "$roomId");
+ $validationelements->append_child(liveclassroom_create_validation_button($xmldoc, $parameters, $actionParameters));
+
+
+ $hbelementParameters->append_child($validationelements);
+ $headerbar->append_child($hbelementParameters);
+
+ return $headerbar;
}
/*
-* Create a menu element
+* Create a menu element
*
* @param $xmldoc : the DOM document
* @params $p_... : parameters of the menu element
@@ -736,57 +736,57 @@
**/
function liveclassroom_create_menu_element($xmldoc,$p_availibility, $p_type, $p_typeOfUser, $p_typeOfProduct, $p_pictureUrl, $p_value, $p_lcTypeAction, $p_lcNameAction){
- $menuElement = $xmldoc->create_element('menuElement');
-
- $type = $xmldoc->create_element('type');
- $type->append_child($xmldoc->create_text_node("$p_type"));
- $menuElement->append_child($type);
-
- $typeOfProduct = $xmldoc->create_element('typeOfProduct');
- $typeOfProduct->append_child($xmldoc->create_text_node("$p_typeOfProduct"));
- $menuElement->append_child($typeOfProduct);
-
- $availibility = $xmldoc->create_element('availibility');
- $availibility->append_child($xmldoc->create_text_node("$p_availibility"));
- $menuElement->append_child($availibility);
-
- $typeOfUser = $xmldoc->create_element('typeOfUser');
- $typeOfUser->append_child($xmldoc->create_text_node("$p_typeOfUser"));
- $menuElement->append_child($typeOfUser);
-
- $pictureUrl = $xmldoc->create_element('pictureUrl');
- $pictureUrl->append_child($xmldoc->create_text_node("$p_pictureUrl"));
- $menuElement->append_child($pictureUrl);
-
- $value = $xmldoc->create_element('value');
- $value->append_child($xmldoc->create_text_node("$p_value"));
- $menuElement->append_child($value);
-
- $lcAction = $xmldoc->create_element('action');
- $lcActionName = $xmldoc->create_element('name');
- $lcActionName->append_child($xmldoc->create_text_node("$p_lcTypeAction"));
+ $menuElement = $xmldoc->create_element('menuElement');
+
+ $type = $xmldoc->create_element('type');
+ $type->append_child($xmldoc->create_text_node("$p_type"));
+ $menuElement->append_child($type);
+
+ $typeOfProduct = $xmldoc->create_element('typeOfProduct');
+ $typeOfProduct->append_child($xmldoc->create_text_node("$p_typeOfProduct"));
+ $menuElement->append_child($typeOfProduct);
+
+ $availibility = $xmldoc->create_element('availibility');
+ $availibility->append_child($xmldoc->create_text_node("$p_availibility"));
+ $menuElement->append_child($availibility);
+
+ $typeOfUser = $xmldoc->create_element('typeOfUser');
+ $typeOfUser->append_child($xmldoc->create_text_node("$p_typeOfUser"));
+ $menuElement->append_child($typeOfUser);
+
+ $pictureUrl = $xmldoc->create_element('pictureUrl');
+ $pictureUrl->append_child($xmldoc->create_text_node("$p_pictureUrl"));
+ $menuElement->append_child($pictureUrl);
+
+ $value = $xmldoc->create_element('value');
+ $value->append_child($xmldoc->create_text_node("$p_value"));
+ $menuElement->append_child($value);
+
+ $lcAction = $xmldoc->create_element('action');
+ $lcActionName = $xmldoc->create_element('name');
+ $lcActionName->append_child($xmldoc->create_text_node("$p_lcTypeAction"));
- $lcAction->append_child($lcActionName);
- $lcActionParameters = $xmldoc->create_element('parameters');
-
- $lcActionParameter = $xmldoc->create_element('parameter');
- $lcActionParameter->append_child($xmldoc->create_text_node("$p_lcNameAction"));
- $lcActionParameters->append_child($lcActionParameter);
-
- $lcAction->append_child($lcActionParameters);
+ $lcAction->append_child($lcActionName);
+ $lcActionParameters = $xmldoc->create_element('parameters');
+
+ $lcActionParameter = $xmldoc->create_element('parameter');
+ $lcActionParameter->append_child($xmldoc->create_text_node("$p_lcNameAction"));
+ $lcActionParameters->append_child($lcActionParameter);
+
+ $lcAction->append_child($lcActionParameters);
- $lcAction->append_child($lcActionParameters);
+ $lcAction->append_child($lcActionParameters);
-
- $menuElement->append_child($lcAction);
+
+ $menuElement->append_child($lcAction);
- $xmldoc->append_child($menuElement);
+ $xmldoc->append_child($menuElement);
- return $menuElement;
+ return $menuElement;
}
/*
-* Create a product information element
+* Create a product information element
*
* @param $xmldoc : the DOM document
* @param $position : type of the element
@@ -798,25 +798,25 @@
**/
function liveclassroom_create_product_information($xmldoc,$position,$name,$style,$value) {
- $productInfo = $xmldoc->create_element('productInformations');
-
- $productPosition = $xmldoc->create_element('position');
- $productPosition->append_child($xmldoc->create_text_node("$position"));
- $productInfo->append_child($productPosition);
-
- $productName = $xmldoc->create_element('name');
- $productName->append_child($xmldoc->create_text_node("$name"));
- $productInfo->append_child($productName);
-
- $productStyle = $xmldoc->create_element('style');
- $productStyle->append_child($xmldoc->create_text_node("$style"));
- $productInfo->append_child($productStyle);
-
- $productValue = $xmldoc->create_element('value');
- $productValue->append_child($xmldoc->create_text_node("$value"));
- $productInfo->append_child($productValue);
-
- return $productInfo;
+ $productInfo = $xmldoc->create_element('productInformations');
+
+ $productPosition = $xmldoc->create_element('position');
+ $productPosition->append_child($xmldoc->create_text_node("$position"));
+ $productInfo->append_child($productPosition);
+
+ $productName = $xmldoc->create_element('name');
+ $productName->append_child($xmldoc->create_text_node("$name"));
+ $productInfo->append_child($productName);
+
+ $productStyle = $xmldoc->create_element('style');
+ $productStyle->append_child($xmldoc->create_text_node("$style"));
+ $productInfo->append_child($productStyle);
+
+ $productValue = $xmldoc->create_element('value');
+ $productValue->append_child($xmldoc->create_text_node("$value"));
+ $productInfo->append_child($productValue);
+
+ return $productInfo;
}
@@ -830,109 +830,109 @@
*/
function create_panel_info($xmldoc, $p_context, $p_styleEnabled, $p_styleDisabled, $p_name, $pos, $p_display) {
- $panelInformation = $xmldoc->create_element('panelInformations');
-
- $display = $xmldoc->create_element('display');
- $display->append_child($xmldoc->create_text_node("$p_display"));
- $panelInformation->append_child($display);
-
- $styleEnabled = $xmldoc->create_element('styleEnabled');
- $styleEnabled->append_child($xmldoc->create_text_node("$p_styleEnabled"));
- $panelInformation->append_child($styleEnabled);
-
- $styleDisabled = $xmldoc->create_element('styleDisabled');
- $styleDisabled->append_child($xmldoc->create_text_node("$p_styleDisabled"));
- $panelInformation->append_child($styleDisabled);
-
- $name = $xmldoc->create_element('name');
- $name->append_child($xmldoc->create_text_node("$p_name"));
- $panelInformation->append_child($name);
-
- $position = $xmldoc->create_element('position');
- $position->append_child($xmldoc->create_text_node($pos));
- $panelInformation->append_child($position);
-
- $contextDisplay = $xmldoc->create_element('contextDisplay');
- $contextDisplay->append_child($xmldoc->create_text_node("$p_context"));
- $panelInformation->append_child($contextDisplay);
-
- return $panelInformation;
+ $panelInformation = $xmldoc->create_element('panelInformations');
+
+ $display = $xmldoc->create_element('display');
+ $display->append_child($xmldoc->create_text_node("$p_display"));
+ $panelInformation->append_child($display);
+
+ $styleEnabled = $xmldoc->create_element('styleEnabled');
+ $styleEnabled->append_child($xmldoc->create_text_node("$p_styleEnabled"));
+ $panelInformation->append_child($styleEnabled);
+
+ $styleDisabled = $xmldoc->create_element('styleDisabled');
+ $styleDisabled->append_child($xmldoc->create_text_node("$p_styleDisabled"));
+ $panelInformation->append_child($styleDisabled);
+
+ $name = $xmldoc->create_element('name');
+ $name->append_child($xmldoc->create_text_node("$p_name"));
+ $panelInformation->append_child($name);
+
+ $position = $xmldoc->create_element('position');
+ $position->append_child($xmldoc->create_text_node($pos));
+ $panelInformation->append_child($position);
+
+ $contextDisplay = $xmldoc->create_element('contextDisplay');
+ $contextDisplay->append_child($xmldoc->create_text_node("$p_context"));
+ $panelInformation->append_child($contextDisplay);
+
+ return $panelInformation;
}
/**
-* This function is to check the parameters are good on the frame and there is no hack !
+* This function is to check the parameters are good on the frame and there is no hack !
* @param $request : array with the url parameters (usually $_POST or $_GET)
* return a string with all the parameters if the signature is ok, false if not (HACKING)
*/
function liveclassroom_init_session($request){
-
- if(time() <= ($request['time']+1800)) {
-
- $enc_params = array();
- //array of keys
- $url_parameters = $request;
- foreach ($request as $key => $url_p) {
- if(strstr($key,"enc_")) {
- $enc_params[substr($key, 4)]=$url_p;
- }
- }
+
+ if(time() <= ($request['time']+1800)) {
+
+ $enc_params = array();
+ //array of keys
+ $url_parameters = $request;
+ foreach ($request as $key => $url_p) {
+ if(strstr($key,"enc_")) {
+ $enc_params[substr($key, 4)]=$url_p;
+ }
+ }
- foreach ($enc_params as $key => $value) {
- $signature .= $value;
- $url_params .= "enc_".$key."=".$value."&" ;
- }
-
- if(strcmp(md5($signature), $request['signature'])!=0) {
- add_to_log($request['enc_course_id'], "liveclassroom", liveclassroom_send_logs("errorSignature",""), "Init session", "Signature is not recognize.");
- error("Signature is not recognize.");
- return false;
-
- }
+ foreach ($enc_params as $key => $value) {
+ $signature .= $value;
+ $url_params .= "enc_".$key."=".$value."&" ;
+ }
+
+ if(strcmp(md5($signature), $request['signature'])!=0) {
+ add_to_log($request['enc_course_id'], "liveclassroom", liveclassroom_send_logs("errorSignature",""), "Init session", "Signature is not recognize.");
+ error("Signature is not recognize.");
+ return false;
+
+ }
- return true;
- }
- else {
- add_to_log($request['enc_course_id'], "liveclassroom", liveclassroom_send_logs("errorSessionTimeOut",""), "Init session", "Session has timed out due to inactivity.");
- error("The session has timed out due to inactivity. Please reload the page to reconnect.");
- return false;
-
- }
+ return true;
+ }
+ else {
+ add_to_log($request['enc_course_id'], "liveclassroom", liveclassroom_send_logs("errorSessionTimeOut",""), "Init session", "Session has timed out due to inactivity.");
+ error("The session has timed out due to inactivity. Please reload the page to reconnect.");
+ return false;
+
+ }
}
/*
* Give the parameters with the signature md5 to give to the frame
-* @param $courseid : the id of the current course
+* @param $courseid : the id of the current course
* return a string with all the parameters to give to the url
*/
function liveclassroom_get_url_params($courseid) {
- global $USER;
- global $CFG;
-
- //For moodle 1.7
-// if(strstr($CFG->release,"1.6")) // 1.6.* version
+ global $USER;
+ global $CFG;
+
+ //For moodle 1.7
+// if(strstr($CFG->release,"1.6")) // 1.6.* version
- if(isstudent($courseid)) { //Student
- $role='Student';
- }
- else if (isadmin() || isteacher($courseid, $USER->id)) { // Admin, Teacher
- $role='Instructor';
- }
-
- if(strstr($CFG->release,"1.7")) { // 1.7.* version
- if (iscreator()) { // Course Creator
- $role='Instructor';
- }
- else if (!isteacheredit($courseid)) { // Non-editing Teacher
- $role='Student';
- }
- }
-
- $signature = md5($courseid.$USER->email.$USER->firstname.$USER->lastname.$role);
- $url_params = "enc_course_id=".$courseid."&enc_email=".$USER->email."&enc_firstname=".$USER->firstname."&enc_lastname=".$USER->lastname."&enc_role=".$role."&signature=".$signature;
+ if(isstudent($courseid)) { //Student
+ $role='Student';
+ }
+ else if (isadmin() || isteacher($courseid, $USER->id)) { // Admin, Teacher
+ $role='Instructor';
+ }
+
+ if(strstr($CFG->release,"1.7")) { // 1.7.* version
+ if (iscreator()) { // Course Creator
+ $role='Instructor';
+ }
+ else if (!isteacheredit($courseid)) { // Non-editing Teacher
+ $role='Student';
+ }
+ }
+
+ $signature = md5($courseid.$USER->email.$USER->firstname.$USER->lastname.$role);
+ $url_params = "enc_course_id=".$courseid."&enc_email=".$USER->email."&enc_firstname=".$USER->firstname."&enc_lastname=".$USER->lastname."&enc_role=".$role."&signature=".$signature;
- return $url_params;
+ return $url_params;
}
@@ -944,48 +944,48 @@
function liveclassroom_get_session_params($xmldoc, $sessionParams) {
// General Information
- global $CFG;
-
- $information = $xmldoc->create_element("information");
+ global $CFG;
+
+ $information = $xmldoc->create_element("information");
$firstName = $xmldoc->create_element("firstName");
$firstName->append_child($xmldoc->create_text_node($sessionParams['enc_firstname']));
$lastName = $xmldoc->create_element("lastName");
$lastName->append_child($xmldoc->create_text_node($sessionParams['enc_lastname']));
$role = $xmldoc->create_element("role");
- $role->append_child($xmldoc->create_text_node($sessionParams['enc_role']));
+ $role->append_child($xmldoc->create_text_node($sessionParams['enc_role']));
$email = $xmldoc->create_element("email");
$email->append_child($xmldoc->create_text_node($sessionParams['enc_email']));
$timeOfLoad = $xmldoc->create_element("timeOfLoad");
$timeOfLoad->append_child($xmldoc->create_text_node($sessionParams['time']));
$courseId = $xmldoc->create_element("courseId");
- $courseId->append_child($xmldoc->create_text_node($sessionParams['enc_course_id']));
- if ($sessionParams['authToken'] != null) {
- $authToken = $xmldoc->create_element("authToken");
- $authToken->append_child($xmldoc->create_text_node($sessionParams['authToken']));
- }
- $lcServerUrl = $xmldoc->create_element("lcServerUrl");
- $lcServerUrl->append_child($xmldoc->create_text_node($CFG->liveclassroom_servername));
- $vtServerUrl = $xmldoc->create_element("vtServerUrl");
- $vtServerUrl->append_child($xmldoc->create_text_node(""));
+ $courseId->append_child($xmldoc->create_text_node($sessionParams['enc_course_id']));
+ if ($sessionParams['authToken'] != null) {
+ $authToken = $xmldoc->create_element("authToken");
+ $authToken->append_child($xmldoc->create_text_node($sessionParams['authToken']));
+ }
+ $lcServerUrl = $xmldoc->create_element("lcServerUrl");
+ $lcServerUrl->append_child($xmldoc->create_text_node($CFG->liveclassroom_servername));
+ $vtServerUrl = $xmldoc->create_element("vtServerUrl");
+ $vtServerUrl->append_child($xmldoc->create_text_node(""));
$signature = $xmldoc->create_element("signature");
$signature->append_child($xmldoc->create_text_node($sessionParams['signature']));
-
+
$information->append_child($firstName);
$information->append_child($lastName);
- $information->append_child($role);
- $information->append_child($email);
- $information->append_child($timeOfLoad);
+ $information->append_child($role);
+ $information->append_child($email);
+ $information->append_child($timeOfLoad);
$information->append_child($courseId);
$information->append_child($authToken);
$information->append_child($lcServerUrl);
$information->append_child($vtServerUrl);
- $information->append_child($signature);
+ $information->append_child($signature);
return $information;
-
- // END of General Information
-
+
+ // END of General Information
+
}
/* Create a message element
@@ -996,36 +996,36 @@
*/
function liveclassroom_create_message($xmldoc, $value) {
- $message = $xmldoc->create_element('windowsElement');
-
- $messagetype = $xmldoc->create_element('type');
- $messagetype->append_child($xmldoc->create_text_node("message"));
- $message->append_child($messagetype);
-
- $messageElementParameters = $xmldoc->create_element("windowsElementParameters");
-
- $m = $xmldoc->create_element("message");
-
- $mtype = $xmldoc->create_element("type");
- $mtype->append_child($xmldoc->create_text_node("message"));
- $m->append_child($mtype);
-
- $mvalue = $xmldoc->create_element("value");
- $mvalue->append_child($xmldoc->create_text_node($value));
- $m->append_child($mvalue);
-
- $messageElementParameters->append_child($m);
-
- $message->append_child($messageElementParameters);
-
- return $message;
+ $message = $xmldoc->create_element('windowsElement');
+
+ $messagetype = $xmldoc->create_element('type');
+ $messagetype->append_child($xmldoc->create_text_node("message"));
+ $message->append_child($messagetype);
+
+ $messageElementParameters = $xmldoc->create_element("windowsElementParameters");
+
+ $m = $xmldoc->create_element("message");
+
+ $mtype = $xmldoc->create_element("type");
+ $mtype->append_child($xmldoc->create_text_node("message"));
+ $m->append_child($mtype);
+
+ $mvalue = $xmldoc->create_element("value");
+ $mvalue->append_child($xmldoc->create_text_node($value));
+ $m->append_child($mvalue);
+
+ $messageElementParameters->append_child($m);
+
+ $message->append_child($messageElementParameters);
+
+ return $message;
}
/*
-* Get the message with a type
+* Get the message with a type
* @param $type : a string with the type of the message
-* return a string with the message to display
+* return a string with the message to display
*/
function liveclassroom_get_message($type) {
@@ -1045,14 +1045,14 @@
*/
function liveclassroom_send_logs($type,$parameters) {
- global $LIVECLASSROOM_LOGS;
+ global $LIVECLASSROOM_LOGS;
-
- $link = $LIVECLASSROOM_LOGS."?type=$type";
- $link .= "&$parameters";
- $link .= "&time=".time();
-
- return $link;
+
+ $link = $LIVECLASSROOM_LOGS."?type=$type";
+ $link .= "&$parameters";
+ $link .= "&time=".time();
+
+ return $link;
}
@@ -1086,7 +1086,7 @@
if (empty($version)) {
return "emptyversion";
}
-
+
return $version;
}
Modified: trunk/moodle/mod/liveclassroom/manageRoomAction.php
===================================================================
--- trunk/moodle/mod/liveclassroom/manageRoomAction.php 2006-12-29 16:03:27 UTC (rev 153)
+++ trunk/moodle/mod/liveclassroom/manageRoomAction.php 2007-01-02 15:45:44 UTC (rev 154)
@@ -129,23 +129,33 @@
$messageType = 'roomUpdated';
}
else if($_GET['action']=='deleteRoom') {
+
+ $is_archive = liveclassroom_api_room_is_archive($_GET['id']);
+
//delete the activities linked to this room
if (! liveclassroom_delete_all_instance_of_room($_GET['id'])) {
- notify("Could not delete the instances of the room");
+ notify("Could not delete the activities for the room: " + $_GET['id']);
}
//delete the room on the server
- liveclassroom_api_delete_room($_GET['id']);
-
- $messageType = 'roomDeleted';
+ if (! liveclassroom_api_delete_room($_GET['id'])) {
+ error("Unable to delete room with Id: ".$_GET['id']);
+ }
+
+ if ($is_archive) {
+ $messageType = 'archiveDeleted';
+ }
+ else {
+ $messageType = 'roomDeleted';
+ }
}
if (!$usersession = liveclassroom_create_session ($course, isteacher($courseid, $USER->id))) {
error ("Cannot create session");
}
-
- $urlParams = $url.'&authToken='.$usersession.'&time='.$_GET['time'];
- if(isset($messageType)) $urlParams .= '&messageType='.$messageType;
+
+ $urlParams = $url.'&authToken='.$usersession.'&time='.$_GET['time'];
+ if(isset($messageType)) $urlParams .= '&messageType='.$messageType;
header('Location: welcome.php?id='.$courseid.'&'.$urlParams);
}
Modified: trunk/moodle/mod/liveclassroom/welcome.php
===================================================================
--- trunk/moodle/mod/liveclassroom/welcome.php 2006-12-29 16:03:27 UTC (rev 153)
+++ trunk/moodle/mod/liveclassroom/welcome.php 2007-01-02 15:45:44 UTC (rev 154)
@@ -106,7 +106,7 @@
function doDelete(){
if(currentId!=""){
- var complete_url='manageRoomAction.php'+'?time='+session["timeOfLoad"]+'&enc_course_id='+session["courseId"]+'&enc_email='+session["email"]+'&enc_firstname='+session["firstName"]+'&enc_lastname='+session["lastName"]+'&enc_role='+session["role"]+'&signature='+session["signature"]+'&id ='+currentId+'&action=deleteRoom&hza='+session['authToken'] ;
+ var complete_url='manageRoomAction.php'+'?time='+session["timeOfLoad"]+'&enc_course_id='+session["courseId"]+'&enc_email='+session["email"]+'&enc_firstname='+session["firstName"]+'&enc_lastname='+session["lastName"]+'&enc_role='+session["role"]+'&signature='+session["signature"]+'&id='+currentId+'&action=deleteRoom&hza='+session['authToken'] ;
location.href = complete_url
//var w = window.open(complete_url, '_top');
// w.focus();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|