Revision: 164
http://svn.sourceforge.net/hw4mdl/?rev=164&view=rev
Author: hugues
Date: 2007-01-04 06:51:15 -0800 (Thu, 04 Jan 2007)
Log Message:
-----------
http://u.horizonwimba.com/bugzilla/show_bug.cgi?id=10620
- Fixed the room creation parameters by forcing a couple of media parameters
Modified Paths:
--------------
trunk/moodle/mod/liveclassroom/api.php
trunk/moodle/mod/liveclassroom/generateSettings.php
trunk/moodle/mod/liveclassroom/js/hwCommons.js
trunk/moodle/mod/liveclassroom/lib.php
trunk/moodle/mod/liveclassroom/manageRoomAction.php
Modified: trunk/moodle/mod/liveclassroom/api.php
===================================================================
--- trunk/moodle/mod/liveclassroom/api.php 2007-01-04 11:17:35 UTC (rev 163)
+++ trunk/moodle/mod/liveclassroom/api.php 2007-01-04 14:51:15 UTC (rev 164)
@@ -66,25 +66,25 @@
/*
-* Get the prefix to use for creating rooms and users.
+* Get the prefix to use for creating rooms and users.
*
* return $prefix : a string which is the prefix to use
*/
function liveclassroom_api_get_prefix() {
- global $CFG;
+ global $CFG;
- //get the admin user name
- $aun = $CFG->liveclassroom_adminusername;
- if( (substr($aun, 0,1)=='_') && (substr($aun, -1,1)=='_') ) { //Prefix
- $prefix = $aun;
+ //get the admin user name
+ $aun = $CFG->liveclassroom_adminusername;
+ if( (substr($aun, 0,1)=='_') && (substr($aun, -1,1)=='_') ) { //Prefix
+ $prefix = $aun;
- }
- else {
- $prefix = '';
+ }
+ else {
+ $prefix = '';
- }
- return $prefix;
-
+ }
+ return $prefix;
+
}
/**
@@ -103,12 +103,12 @@
*/
function liveclassroom_api_authenticate ($servername='', $login='', $passwd='') {
global $CFG;
- global $COURSE;
-
+ global $COURSE;
+
if (empty($servername)) { // feed them with $CFG
- $servername = $CFG->liveclassroom_servername;
- $login = $CFG->liveclassroom_adminusername;
- $passwd = $CFG->liveclassroom_adminpassword;
+ $servername = $CFG->liveclassroom_servername;
+ $login = $CFG->liveclassroom_adminusername;
+ $passwd = $CFG->liveclassroom_adminpassword;
}
$url = $servername.
@@ -120,7 +120,7 @@
"&credential_1=". $passwd;
$cookie_file_path = $CFG->dataroot.'/cookie.txt'; // Cookie File path
- $cook = fopen($CFG->dataroot.'/tmp.txt', "w+"); //temporary file to check the date
+ $cook = fopen($CFG->dataroot.'/tmp.txt', "w+"); //temporary file to check the date
fputs($cook,time()); // Add the current time into the file = last authenticate time
$ch = curl_init();
@@ -133,17 +133,17 @@
$data = curl_exec($ch);
if (curl_errno($ch)) {
- add_to_log($COURSE->id, "liveclassroom", "URL", liveclassroom_send_logs("errorUrlUnavailable","courseId=".$COURSE->id), "URL incorrect");
+ add_to_log($COURSE->id, "liveclassroom", "URL", liveclassroom_send_logs("errorUrlUnavailable","courseId=".$COURSE->id), "URL incorrect");
// print curl_error($ch);
return false;
}
preg_match("(\d*)", $data, $matches);
$resp_code = $matches[0];
- if ( $resp_code == 204 ) {
+ if ( $resp_code == 204 ) {
add_to_log($COURSE->id, "liveclassroom", "Authentication", liveclassroom_send_logs("errorAuthentication2","respcode=$resp_code&courseId=".$COURSE->id), "Authentication Failed");
error(get_string('wrongadminpass', 'liveclassroom'));
- return false;
+ return false;
}
else if ( $resp_code != 100 && $resp_code != 301) {
//error( "Response: Authentication Failed: $resp_code");
@@ -162,38 +162,38 @@
/**
* Send a query to the server with the given function and the given attributes
* Check if the session cookie exist and get the cookie creation date.
- * If it's less than 30 minutes, the cookie is got for the request, if not a new authenticate is done.
- * @param $const : function called
+ * If it's less than 30 minutes, the cookie is got for the request, if not a new authenticate is done.
+ * @param $const : function called
* @param $attribute : different list of attributes for the function called
* return $data : result query
*/
function liveclassroom_api_send_query($const,$attribute) {
- global $CFG;
+ global $CFG;
- $cook = $CFG->dataroot.'/tmp.txt'; //Open the temp file to check the last modification date
- $cookie_file_path = $CFG->dataroot.'/cookie.txt'; // Cookie File path
-
- if(file_exists($cook)) {
- $fileContent = file_get_contents($cook);
+ $cook = $CFG->dataroot.'/tmp.txt'; //Open the temp file to check the last modification date
+ $cookie_file_path = $CFG->dataroot.'/cookie.txt'; // Cookie File path
+
+ if(file_exists($cook)) {
+ $fileContent = file_get_contents($cook);
- }
- else {
- $lastModifTime = 0;
- }
- //1800 seconds = 30 minutes
- $modif = $fileContent+1800;
+ }
+ else {
+ $lastModifTime = 0;
+ }
+ //1800 seconds = 30 minutes
+ $modif = $fileContent+1800;
- if( (!file_exists($cookie_file_path)) || ((file_exists($cook)) && (time()>$modif)) ){
- if (!$ch = liveclassroom_api_authenticate()) {
- return false;
- }
- }
-
+ if( (!file_exists($cookie_file_path)) || ((file_exists($cook)) && (time()>$modif)) ){
+ if (!$ch = liveclassroom_api_authenticate()) {
+ return false;
+ }
+ }
+
- $url = $CFG->liveclassroom_servername.
- LIVECLASSROOM_API_ADMIN.
- $const.
- $attribute;
+ $url = $CFG->liveclassroom_servername.
+ LIVECLASSROOM_API_ADMIN.
+ $const.
+ $attribute;
$ch = curl_init();
@@ -203,15 +203,15 @@
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
-
- $data = curl_exec($ch);
-
- if (curl_errno($ch)) {
- print curl_error($ch);
- return false;
- }
-
- return $data;
+
+ $data = curl_exec($ch);
+
+ if (curl_errno($ch)) {
+ print curl_error($ch);
+ return false;
+ }
+
+ return $data;
}
@@ -231,28 +231,28 @@
function liveclassroom_api_create_user ($userid, $coursename, $rolename) {
global $CFG;
global $COURSE;
-
- $final_list = "&target=$userid&first_name=$rolename&last_name=$coursename";
- $enc_list = str_replace(" ", "+", $final_list);
+
+ $final_list = "&target=$userid&first_name=$rolename&last_name=$coursename";
+ $enc_list = str_replace(" ", "+", $final_list);
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_CREATE_USER, $enc_list);
-
- preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
-/*
- if ( $respcode == 302) {
- error( "Creation user failed, malformed exist");
- return false;
- }
- */
-
-
- if ( $respcode != 100 && $respcode != 301) {
- add_to_log($COURSE->id, "liveclassroom", "Create User", liveclassroom_send_logs("errorCreateUser","userId=$userid&respcode=$respcode&courseId=".$COURSE->id), "User Creation Failed");
- // error( "Response: Account ($userId) Creation Failed: $resp_code");
- return false;
- }
- add_to_log($COURSE->id, "liveclassroom", "Create User", liveclassroom_send_logs("createUser","userId=$userid&courseId=".$COURSE->id), "User Creation succeeded");
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_CREATE_USER, $enc_list);
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+/*
+ if ( $respcode == 302) {
+ error( "Creation user failed, malformed exist");
+ return false;
+ }
+ */
+
+
+ if ( $respcode != 100 && $respcode != 301) {
+ add_to_log($COURSE->id, "liveclassroom", "Create User", liveclassroom_send_logs("errorCreateUser","userId=$userid&respcode=$respcode&courseId=".$COURSE->id), "User Creation Failed");
+ // error( "Response: Account ($userId) Creation Failed: $resp_code");
+ return false;
+ }
+ add_to_log($COURSE->id, "liveclassroom", "Create User", liveclassroom_send_logs("createUser","userId=$userid&courseId=".$COURSE->id), "User Creation succeeded");
return true;
}
@@ -263,22 +263,22 @@
*
*/
function liveclassroom_api_create_group($groupid) {
-
+
global $CFG;
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_CREATE_GROUP, "&target=$groupid");
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_CREATE_GROUP, "&target=$groupid");
if ( $respcode == 301) {
- error( "Response: Authentication Failed: $resp_code");
- return false;
- }
- if ( $respcode != 100 && $respcode != 301) {
- error( "Response: Cannot Create group with id:$groupid");
- return false;
- }
+ error( "Response: Authentication Failed: $resp_code");
+ return false;
+ }
+ if ( $respcode != 100 && $respcode != 301) {
+ error( "Response: Cannot Create group with id:$groupid");
+ return false;
+ }
-
- return true;
+
+ return true;
}
@@ -295,22 +295,22 @@
function liveclassroom_api_get_session ($userid, $nickname) {
global $CFG;
global $USER;
- global $COURSE;
-
-
- $final_list = "&target=$userid&nickname=$nickname";
- $enc_list = str_replace(" ", "+", $final_list);
+ global $COURSE;
+
+
+ $final_list = "&target=$userid&nickname=$nickname";
+ $enc_list = str_replace(" ", "+", $final_list);
-
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_TOKEN, $enc_list);
-
+
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_TOKEN, $enc_list);
+
preg_match("(\d*)", $data, $matches);
$respcode = $matches[0];
if ( $respcode != 100) {
-
- add_to_log($COURSE->id, "liveclassroom", "Create Session", liveclassroom_send_logs("errorCreateSession","respcode=$respcode&nickname=$nickname&courseId=".$COURSE->id), "Cannot Create Session.");
+
+ add_to_log($COURSE->id, "liveclassroom", "Create Session", liveclassroom_send_logs("errorCreateSession","respcode=$respcode&nickname=$nickname&courseId=".$COURSE->id), "Cannot Create Session.");
return false;
}
@@ -334,8 +334,8 @@
//error ("Token empty, data=<pre>$data</pre>");
return false;
}
- add_to_log($COURSE->id, "liveclassroom", "Create Session", liveclassroom_send_logs("createSession","nickname=$nickname&courseId=".$COURSE->id), "Creating Session for $nickname");
-
+ add_to_log($COURSE->id, "liveclassroom", "Create Session", liveclassroom_send_logs("createSession","nickname=$nickname&courseId=".$COURSE->id), "Creating Session for $nickname");
+
return $authtoken;
}
@@ -347,37 +347,40 @@
*/
function liveclassroom_api_create_class ($roomid, $roomname, $bool, $attributes) {
global $CFG;
- global $COURSE;
-
- $list_attributes = '';
-
- unset($attributes['longname']);
- while (list($key, $val) = each($attributes)) {
- if(($key!='class_id')&&(isset($val))&&($val!="")){
- $list_attributes .= "&".$key."=".$val;
- }
- }
+ global $COURSE;
+
+ $list_attributes = '';
+
+ unset($attributes['longname']);
+ unset($attributes['led']);
- $final_list = "&target=$roomid"."&longname=$roomname".$list_attributes;
- $enc_list = str_replace(" ", "+", $final_list);
-
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_CREATE_CLASS, $enc_list);
-
- preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
-
- if ( $respcode == 301) {
- error( "Class $roomname already exist");
- return false;
- }
- if ( $respcode != 100) {
- add_to_log($COURSE->id, "liveclassroom", "Create Room", liveclassroom_send_logs("errorCreateClass","roomname=$roomname&roomId=$roomid&respcode=$respcode&courseId=".$COURSE->id), "Cannot Create Class with id : $roomid, and name : $roomname.");
- return false;
- }
+ while (list($key, $val) = each($attributes)) {
+ if(($key!='class_id')&&(isset($val))&&($val!="")){
+ $list_attributes .= "&".$key."=".$val;
+ }
+ }
- add_to_log($COURSE->id, "liveclassroom", "Create Room", liveclassroom_send_logs("createClass","roomname=$roomname&courseId=".$COURSE->id), "$roomname create with success");
- return true;
+ $final_list = "&target=$roomid"."&longname=$roomname".$list_attributes;
+ $enc_list = str_replace(" ", "+", $final_list);
+
+//DEBUG: error($enc_list);
+
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_CREATE_CLASS, $enc_list);
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode == 301) {
+ error( "Class $roomname already exist");
+ return false;
+ }
+ if ( $respcode != 100) {
+ add_to_log($COURSE->id, "liveclassroom", "Create Room", liveclassroom_send_logs("errorCreateClass","roomname=$roomname&roomId=$roomid&respcode=$respcode&courseId=".$COURSE->id), "Cannot Create Class with id : $roomid, and name : $roomname.");
+ return false;
+ }
+ add_to_log($COURSE->id, "liveclassroom", "Create Room", liveclassroom_send_logs("createClass","roomname=$roomname&courseId=".$COURSE->id), "$roomname create with success");
+ return true;
}
/*
@@ -390,7 +393,7 @@
function liveclassroom_api_add_user_role ($roomid, $userid, $role) {
global $CFG;
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_CREATE_ROLE, "&target=$roomid&user_id=$userid&role_id=$role");
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_CREATE_ROLE, "&target=$roomid&user_id=$userid&role_id=$role");
preg_match("(\d*)", $data, $matches);
@@ -414,7 +417,7 @@
function liveclassroom_api_remove_user_role ($roomid, $userid, $role) {
global $CFG;
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_DELETE_ROLE, "&target=$roomid&user_id=$userid&role_id=$role");
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_DELETE_ROLE, "&target=$roomid&user_id=$userid&role_id=$role");
preg_match("(\d*)", $data, $matches);
@@ -430,7 +433,7 @@
function liveclassroom_api_remove_group_role ($roomid, $groupid, $role) {
global $CFG;
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_DELETE_ROLE, "&target=$roomid&user_id=$groupid&role_id=$role");
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_DELETE_ROLE, "&target=$roomid&user_id=$groupid&role_id=$role");
preg_match("(\d*)", $data, $matches);
@@ -453,30 +456,30 @@
*/
function liveclassroom_api_room_exist($roomname) {
- global $CFG;
+ global $CFG;
- $final_list = "&filter00=longname&filter00value=$roomname";
- $enc_list = str_replace(" ", "+", $final_list);
+ $final_list = "&filter00=longname&filter00value=$roomname";
+ $enc_list = str_replace(" ", "+", $final_list);
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, $enc_list);
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, $enc_list);
- preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
-
- if ( $respcode != 100) {
- return false;
- }
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
- $tok = split("100 OK",$data);
- $tok1 = split(LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+ $tok = split("100 OK",$data);
+ $tok1 = split(LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
- if(sizeof($tok1)>1){
-
- return true;
- }
- else {
- return false;
- }
+ if(sizeof($tok1)>1){
+
+ return true;
+ }
+ else {
+ return false;
+ }
}
@@ -487,43 +490,43 @@
* return a string delimited by the pattern and the end of line
*/
function liveclassroom_parse_line($line,$pattern) {
-
- $response = split($pattern,$line);
- //$result = substr($response[1],0,-1);
-
+
+ $response = split($pattern,$line);
+ //$result = substr($response[1],0,-1);
+
- return $response[1];
+ return $response[1];
}
/**
* Get the room id from a roomname
-* @param $roomname
-* return the room_id from the server
+* @param $roomname
+* return the room_id from the server
*/
function liveclassroom_api_get_roomid($roomname) {
- global $CFG;
+ global $CFG;
- $final_list = "&filter00=longname&filter00value=$roomname";
- $enc_list = str_replace(" ", "+", $final_list);
-
+ $final_list = "&filter00=longname&filter00value=$roomname";
+ $enc_list = str_replace(" ", "+", $final_list);
+
$data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, $enc_list);
- preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
-
- if ( $respcode != 100) {
- return false;
- }
- $tok = split("100 OK",$data);
- $tok1 = split(LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
- $result = liveclassroom_parse_line($tok1[0],"class_id=");
-
- //Remove le " " at the end of the line
- $response = substr($result,0,-1);
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ $tok = split("100 OK",$data);
+ $tok1 = split(LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+ $result = liveclassroom_parse_line($tok1[0],"class_id=");
+
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
- return $response;
+ return $response;
}
@@ -536,25 +539,25 @@
* return true if the room is deleted, false otherwise
*/
function liveclassroom_api_delete_room($roomid) {
- global $CFG;
- global $COURSE;
-
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_DELETE_ROOM,"&target=$roomid");
+ global $CFG;
+ global $COURSE;
+
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_DELETE_ROOM,"&target=$roomid");
preg_match("(\d*)", $data, $matches);
$respcode = $matches[0];
-
- if ( $respcode == 302) {
+
+ 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;
- }
- else if ( $respcode != 100) {
+ // 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("deleteRoom","roomId=$roomid&courseId=".$COURSE->id), "$roomid has been deleted with success");
- return true;
+
+ 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;
}
/**
@@ -564,24 +567,24 @@
* return true if the room has being opened, false otherwise
*/
function liveclassroom_api_open_room($roomid) {
- global $CFG;
- global $COURSE;
-
-
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_MODIFY_ROOM,"&target=$roomid&preview=0");
- preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
-
- if ( $respcode == 302) {
- add_to_log($COURSE->id, "liveclassroom", "Open Room", liveclassroom_send_logs("errorOpenRoom302","roomId=$roomid&courseId=".$COURSE->id), "$roomid opening failed");
- return false;
+ global $CFG;
+ global $COURSE;
+
+
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_MODIFY_ROOM,"&target=$roomid&preview=0");
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode == 302) {
+ add_to_log($COURSE->id, "liveclassroom", "Open Room", liveclassroom_send_logs("errorOpenRoom302","roomId=$roomid&courseId=".$COURSE->id), "$roomid opening failed");
+ return false;
}
- if ( $respcode != 100) {
- add_to_log($COURSE->id, "liveclassroom", "Open Room", liveclassroom_send_logs("errorOpenRoom100","roomId=$roomid&courseId=".$COURSE->id), "$roomid opening failed");
- return false;
- }
- add_to_log($COURSE->id, "liveclassroom", "Open Room", liveclassroom_send_logs("openRoom","roomId=$roomid&courseId=".$COURSE->id), "$roomid has been opened with success");
- return true;
+ if ( $respcode != 100) {
+ add_to_log($COURSE->id, "liveclassroom", "Open Room", liveclassroom_send_logs("errorOpenRoom100","roomId=$roomid&courseId=".$COURSE->id), "$roomid opening failed");
+ return false;
+ }
+ add_to_log($COURSE->id, "liveclassroom", "Open Room", liveclassroom_send_logs("openRoom","roomId=$roomid&courseId=".$COURSE->id), "$roomid has been opened with success");
+ return true;
}
/**
@@ -591,24 +594,24 @@
* return true if the room has being closed, false otherwise
*/
function liveclassroom_api_close_room($roomid) {
- global $CFG;
- global $COURSE;
-
- liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_MODIFY_ROOM,"&target=$roomid&preview=1");
- preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
-
- if ( $respcode == 302) {
- add_to_log($COURSE->id, "liveclassroom", "Close Room", liveclassroom_send_logs("errorCloseRoom302","roomId=$roomid&courseId=".$COURSE->id), "$roomid closing failed");
-
- return false;
+ global $CFG;
+ global $COURSE;
+
+ liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_MODIFY_ROOM,"&target=$roomid&preview=1");
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode == 302) {
+ add_to_log($COURSE->id, "liveclassroom", "Close Room", liveclassroom_send_logs("errorCloseRoom302","roomId=$roomid&courseId=".$COURSE->id), "$roomid closing failed");
+
+ return false;
}
- if ( $respcode != 100) {
- add_to_log($COURSE->id, "liveclassroom", "Close Room", liveclassroom_send_logs("errorCloseRoom100","roomId=$roomid&courseId=".$COURSE->id), "$roomid closing failed");
- return false;
- }
- add_to_log($COURSE->id, "liveclassroom", "Close Room", liveclassroom_send_logs("closeRoom","roomId=$roomid&courseId=".$COURSE->id), "$roomid has been closed with success");
- return true;
+ if ( $respcode != 100) {
+ add_to_log($COURSE->id, "liveclassroom", "Close Room", liveclassroom_send_logs("errorCloseRoom100","roomId=$roomid&courseId=".$COURSE->id), "$roomid closing failed");
+ return false;
+ }
+ add_to_log($COURSE->id, "liveclassroom", "Close Room", liveclassroom_send_logs("closeRoom","roomId=$roomid&courseId=".$COURSE->id), "$roomid has been closed with success");
+ return true;
}
@@ -620,31 +623,31 @@
*/
function liveclassroom_api_modify_room($roomid,$table_attributes) {
global $CFG;
- global $COURSE;
+ global $COURSE;
while (list($key, $val) = each($table_attributes)) {
- if(($key!='class_id')&&(isset($val))&&($val!="")){
+ if(($key!='class_id')&&(isset($val))&&($val!="")){
- $list_attributes .= "&".$key."=".$val;
- }
+ $list_attributes .= "&".$key."=".$val;
+ }
}
$final_list = "&target=$roomid".$list_attributes;
- $enc_list = str_replace(" ", "+", $final_list);
+ $enc_list = str_replace(" ", "+", $final_list);
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_MODIFY_ROOM, $enc_list);
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_MODIFY_ROOM, $enc_list);
preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
+ $respcode = $matches[0];
if ( $respcode != 100) {
- add_to_log($COURSE->id, "liveclassroom", "Modify Room", liveclassroom_send_logs("errorModifyRoom100","roomId=$roomid&courseId=".$COURSE->id), "Room modification failed");
- return false;
- }
+ add_to_log($COURSE->id, "liveclassroom", "Modify Room", liveclassroom_send_logs("errorModifyRoom100","roomId=$roomid&courseId=".$COURSE->id), "Room modification failed");
+ return false;
+ }
- add_to_log($COURSE->id, "liveclassroom", "Modify Room", liveclassroom_send_logs("modifyRoom","roomId=$roomid&courseId=".$COURSE->id), "$roomid has been modified with success");
+ add_to_log($COURSE->id, "liveclassroom", "Modify Room", liveclassroom_send_logs("modifyRoom","roomId=$roomid&courseId=".$COURSE->id), "$roomid has been modified with success");
return true;
}
@@ -666,31 +669,31 @@
$enc_list = str_replace(" ", "+", $final_list);
$data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, $enc_list);
-
- preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
-
- if ( $respcode != 100) {
- return false;
- }
- //print $data;
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $data;
-
- $line = explode ("\n",$data);
+
+ $line = explode ("\n",$data);
- $j=0;
-
- for($i=1;$i<sizeof($line)-3;$i=$i+4) {
- $test = strstr($line[$i+1],$roomid);
- if($test!=false) {
- $list_return[$j][0]= liveclassroom_parse_line($line[$i],"preview=");
- $list_return[$j][1]= liveclassroom_parse_line($line[$i+1],"class_id=");
- $list_return[$j][2] = liveclassroom_parse_line($line[$i+2],"longname=");
- $j++;
- }
- }
-
- return $list_return;
+ $j=0;
+
+ for($i=1;$i<sizeof($line)-3;$i=$i+4) {
+ $test = strstr($line[$i+1],$roomid);
+ if($test!=false) {
+ $list_return[$j][0]= liveclassroom_parse_line($line[$i],"preview=");
+ $list_return[$j][1]= liveclassroom_parse_line($line[$i+1],"class_id=");
+ $list_return[$j][2] = liveclassroom_parse_line($line[$i+2],"longname=");
+ $j++;
+ }
+ }
+
+ return $list_return;
}
/*
@@ -707,33 +710,33 @@
$enc_list = str_replace(" ", "+", $final_list);
$data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, $enc_list);
-
- preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
-
- if ( $respcode != 100) {
- return false;
- }
- //print $data;
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $data;
-
- $line = explode ("\n",$data);
+
+ $line = explode ("\n",$data);
- $j=0;
-
- for($i=1;$i<sizeof($line)-3;$i=$i+4) {
- $test = strstr($line[$i+1],$roomid);
- if($test!=false) {
- if(liveclassroom_parse_line($line[$i],"preview=")==0) {
- $list_return[$j][1]= liveclassroom_parse_line($line[$i+1],"class_id=");
- $list_return[$j][2] = liveclassroom_parse_line($line[$i+2],"longname=");
- $j++;
- }
- }
- }
-
+ $j=0;
+
+ for($i=1;$i<sizeof($line)-3;$i=$i+4) {
+ $test = strstr($line[$i+1],$roomid);
+ if($test!=false) {
+ if(liveclassroom_parse_line($line[$i],"preview=")==0) {
+ $list_return[$j][1]= liveclassroom_parse_line($line[$i+1],"class_id=");
+ $list_return[$j][2] = liveclassroom_parse_line($line[$i+2],"longname=");
+ $j++;
+ }
+ }
+ }
+
- return $list_return;
+ return $list_return;
}
@@ -750,31 +753,31 @@
$enc_list = str_replace(" ", "+", $final_list);
$data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, $enc_list);
-
- preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
-
- if ( $respcode != 100) {
- return false;
- }
- //print $data;
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $data;
-
- $line = explode ("\n",$data);
+
+ $line = explode ("\n",$data);
- $j=0;
-
- for($i=1;$i<sizeof($line)-3;$i=$i+4) {
- $id = liveclassroom_parse_line($line[$i+1],"class_id=");
- $list_return[$id][0]= liveclassroom_parse_line($line[$i],"preview=");
- $list_return[$id][1]= $id;
- $list_return[$id][2] = liveclassroom_parse_line($line[$i+2],"longname=");
- $j++;
-
- }
-
+ $j=0;
+
+ for($i=1;$i<sizeof($line)-3;$i=$i+4) {
+ $id = liveclassroom_parse_line($line[$i+1],"class_id=");
+ $list_return[$id][0]= liveclassroom_parse_line($line[$i],"preview=");
+ $list_return[$id][1]= $id;
+ $list_return[$id][2] = liveclassroom_parse_line($line[$i+2],"longname=");
+ $j++;
+
+ }
+
- return $list_return;
+ return $list_return;
}
/*
@@ -788,52 +791,52 @@
global $CFG;
$name = $course->shortname;
- $enc_name = str_replace(" ", "_", $name);
-
- $final_list = "&filter00=last_name&filter00value=$enc_name";
+ $enc_name = str_replace(" ", "_", $name);
+
+ $final_list = "&filter00=last_name&filter00value=$enc_name";
$enc_list = str_replace(" ", "+", $final_list);
-
+
$data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_LIST_USER, $enc_list);
- preg_match("(\d*)", $data, $matches);
- $respcode = $matches[0];
-
- if ( $respcode != 100) {
- return false;
- }
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
- $tok = split("100 OK",$data);
- $tok1 = split(LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+ $tok = split("100 OK",$data);
+ $tok1 = split(LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
- if(sizeof($tok1)>1){
- return true;
- }
- else {
- return false;
- }
+ if(sizeof($tok1)>1){
+ return true;
+ }
+ else {
+ return false;
+ }
}
/*
* Give the rights for a lecture room to the room given
* @param $roomid : the id of the room to modifiy the settings
-*
+*
*/
function liveclassroom_api_give_lectureroom_attributes() {
global $CFG;
- $attributes = array('media_type'=>'two-way-audio','preview' =>'0','archive'=>'0','can_archive'=>'1','hms_simulcast'=>'public','chatenable'=>'1','privatechatenable'=>'1','hms_two_way_enabled'=>'1','userlimit'=>'-1');
-
+ $attributes = array('media_type'=>'two-way-aud...
[truncated message content] |