[Hw4mdl-svn] SF.net SVN: hw4mdl: [64] trunk/moodle/mod/liveclassroom
Brought to you by:
jhlinder,
trollinger
|
From: <sh...@us...> - 2006-09-14 15:23:49
|
Revision: 64
http://svn.sourceforge.net/hw4mdl/?rev=64&view=rev
Author: shazan
Date: 2006-09-14 08:23:34 -0700 (Thu, 14 Sep 2006)
Log Message:
-----------
functions added to get all information to edit a room
Modified Paths:
--------------
trunk/moodle/mod/liveclassroom/api.php
trunk/moodle/mod/liveclassroom/lib.php
Modified: trunk/moodle/mod/liveclassroom/api.php
===================================================================
--- trunk/moodle/mod/liveclassroom/api.php 2006-09-13 16:07:14 UTC (rev 63)
+++ trunk/moodle/mod/liveclassroom/api.php 2006-09-14 15:23:34 UTC (rev 64)
@@ -985,7 +985,7 @@
return $response;
}
- /*
+/*
* Give the nam of the room given
* @param $roomid : the id of the room
* return a String :name of the room
@@ -1018,7 +1018,338 @@
return $response;
}
-
+
+/*
+* Give the media type of the room given
+* @param $roomid : the id of the room
+* return a String :media type of the room
+*/
+function liveclassroom_api_get_media_type($roomid){
+ global $CFG;
+ global $LIVECLASSROOM_API_ADMIN;
+ global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST;
+ global $LIVECLASSROOM_API_RECORD_SEPERATOR;
+
+ $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute=media_type&filter00=class_id&filter00value=$roomid");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $url;
+ $tok = split("100 OK",$data);
+ $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+
+ $test = strstr($tok1[0],"media_type=");
+
+ //$tok2 = split("class_id=",$tok1[0]);
+ $result = liveclassroom_parse_line($test,"media_type=");
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
+
+ return $response;
+
+}
+
+/*
+*
+* @param $roomid : the id of the room
+* return a boolean :true if hms two way is enabled, false if not
+*/
+function liveclassroom_api_room_is_hmstwoway_enabled($roomid){
+ global $CFG;
+ global $LIVECLASSROOM_API_ADMIN;
+ global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST;
+ global $LIVECLASSROOM_API_RECORD_SEPERATOR;
+
+ $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute=hms_two_way_enabled&filter00=class_id&filter00value=$roomid");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $url;
+ $tok = split("100 OK",$data);
+ $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+
+ $test = strstr($tok1[0],"hms_two_way_enabled=");
+
+ //$tok2 = split("class_id=",$tok1[0]);
+ $result = liveclassroom_parse_line($test,"hms_two_way_enabled=");
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
+
+ if($response==1) {
+ return true;
+ }
+ else return false;
+
+}
+/*
+*
+* @param $roomid : the id of the room
+* return a boolean :true if hms Simulcat is restricted, false if not
+*/
+function liveclassroom_api_room_is_hmsSimulcast_restricted($roomid){
+ global $CFG;
+ global $LIVECLASSROOM_API_ADMIN;
+ global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST;
+ global $LIVECLASSROOM_API_RECORD_SEPERATOR;
+
+ $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute=hms_simulcast_restricted&filter00=class_id&filter00value=$roomid");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $url;
+ $tok = split("100 OK",$data);
+ $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+
+ $test = strstr($tok1[0],"hms_simulcast_restricted=");
+
+ //$tok2 = split("class_id=",$tok1[0]);
+ $result = liveclassroom_parse_line($test,"hms_simulcast_restricted=");
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
+
+ if($response==1) {
+ return true;
+ }
+ else return false;
+
+}
+
+/*
+* Get the number of user limit of the room given
+* @param $roomid : the id of the room
+* return a int : number of user limit
+*/
+function liveclassroom_api_room_get_user_limit($roomid){
+ global $CFG;
+ global $LIVECLASSROOM_API_ADMIN;
+ global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST;
+ global $LIVECLASSROOM_API_RECORD_SEPERATOR;
+
+ $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute=userlimit&filter00=class_id&filter00value=$roomid");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $url;
+ $tok = split("100 OK",$data);
+ $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+
+ $test = strstr($tok1[0],"userlimit=");
+
+ //$tok2 = split("class_id=",$tok1[0]);
+ $result = liveclassroom_parse_line($test,"userlimit=");
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
+ return $response;
+
+}
+
+function liveclassroom_api_is_private_chat_enabled($roomid){
+ global $CFG;
+ global $LIVECLASSROOM_API_ADMIN;
+ global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST;
+ global $LIVECLASSROOM_API_RECORD_SEPERATOR;
+
+ $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute=privatechatenable&filter00=class_id&filter00value=$roomid");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $url;
+ $tok = split("100 OK",$data);
+ $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+
+ $test = strstr($tok1[0],"privatechatenable=");
+
+ //$tok2 = split("class_id=",$tok1[0]);
+ $result = liveclassroom_parse_line($test,"privatechatenable=");
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
+
+ if($response==1) {
+ return true;
+ }
+ else return false;
+
+}
+
+function liveclassroom_api_is_ppt_import_enabled($roomid){
+ global $CFG;
+ global $LIVECLASSROOM_API_ADMIN;
+ global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST;
+ global $LIVECLASSROOM_API_RECORD_SEPERATOR;
+
+ $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute=can_ppt_import&filter00=class_id&filter00value=$roomid");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $url;
+ $tok = split("100 OK",$data);
+ $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+
+ $test = strstr($tok1[0],"can_ppt_import=");
+
+ //$tok2 = split("class_id=",$tok1[0]);
+ $result = liveclassroom_parse_line($test,"can_ppt_import=");
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
+
+ if($response==1) {
+ return true;
+ }
+ else return false;
+
+}
+
+function liveclassroom_api_is_liveshare_enabled($roomid){
+ global $CFG;
+ global $LIVECLASSROOM_API_ADMIN;
+ global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST;
+ global $LIVECLASSROOM_API_RECORD_SEPERATOR;
+
+ $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute=can_liveshare&filter00=class_id&filter00value=$roomid");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $url;
+ $tok = split("100 OK",$data);
+ $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+
+ $test = strstr($tok1[0],"can_liveshare=");
+
+ //$tok2 = split("class_id=",$tok1[0]);
+ $result = liveclassroom_parse_line($test,"can_liveshare=");
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
+
+ if($response==1) {
+ return true;
+ }
+ else return false;
+
+}
+
+function liveclassroom_api_is_archive_enabled($roomid){
+ global $CFG;
+ global $LIVECLASSROOM_API_ADMIN;
+ global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST;
+ global $LIVECLASSROOM_API_RECORD_SEPERATOR;
+
+ $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute=can_archive&filter00=class_id&filter00value=$roomid");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $url;
+ $tok = split("100 OK",$data);
+ $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+
+ $test = strstr($tok1[0],"can_archive=");
+
+ //$tok2 = split("class_id=",$tok1[0]);
+ $result = liveclassroom_parse_line($test,"can_archive=");
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
+
+ if($response==1) {
+ return true;
+ }
+ else return false;
+
+}
+
+function liveclassroom_api_is_student_liveApp_enabled($roomid){
+ global $CFG;
+ global $LIVECLASSROOM_API_ADMIN;
+ global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST;
+ global $LIVECLASSROOM_API_RECORD_SEPERATOR;
+
+ $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute=student-wb-liveapp&filter00=class_id&filter00value=$roomid");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $url;
+ $tok = split("100 OK",$data);
+ $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+
+ $test = strstr($tok1[0],"student-wb-liveapp=");
+
+ //$tok2 = split("class_id=",$tok1[0]);
+ $result = liveclassroom_parse_line($test,"student-wb-liveapp=");
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
+
+ if($response==1) {
+ return true;
+ }
+ else return false;
+
+}
+
+function liveclassroom_api_is_student_whiteBoard_enabled($roomid){
+ global $CFG;
+ global $LIVECLASSROOM_API_ADMIN;
+ global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST;
+ global $LIVECLASSROOM_API_RECORD_SEPERATOR;
+
+ $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute=student-wb-enabled&filter00=class_id&filter00value=$roomid");
+
+ preg_match("(\d*)", $data, $matches);
+ $respcode = $matches[0];
+
+ if ( $respcode != 100) {
+ return false;
+ }
+ //print $url;
+ $tok = split("100 OK",$data);
+ $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]);
+
+ $test = strstr($tok1[0],"student-wb-enabled=");
+
+ //$tok2 = split("class_id=",$tok1[0]);
+ $result = liveclassroom_parse_line($test,"student-wb-enabled=");
+ //Remove le " " at the end of the line
+ $response = substr($result,0,-1);
+
+ if($response==1) {
+ return true;
+ }
+ else return false;
+
+}
/**
* Enroll the given user into the group.
*
Modified: trunk/moodle/mod/liveclassroom/lib.php
===================================================================
--- trunk/moodle/mod/liveclassroom/lib.php 2006-09-13 16:07:14 UTC (rev 63)
+++ trunk/moodle/mod/liveclassroom/lib.php 2006-09-14 15:23:34 UTC (rev 64)
@@ -313,7 +313,7 @@
return false;
}
}
- else if($bool==false){ // discussion out
+ else if($bool==false){ // discussion room
if (! liveclassroom_api_add_user_role ($roomid, $teacherid, 'ClassAdmin')) {
//error('liveclassroom_create_room: Cannot add classadminright to Teachers');
@@ -551,9 +551,9 @@
}
/*
-* List all the room "Lecture or Main rooms" for a course given
+* List all the room "Lecture or Main rooms" and all the room "Breackout or Discussion rooms" for a course given
* @param $course
-* return a table with all the room name considering as a lecture/main room
+* return a table 2 dimensions with all the room name
*/
function liveclassroom_get_main_room_list($course) {
@@ -626,61 +626,42 @@
return $list_return;
}
-/*
-function liveclassroom_get_type_room($roomname) {
+
+/* To know if the room given is a lecture room
+* @param $roomid : the id of the room
+* return a boolean : true if the room is lecture room, false if not.
+*/
+function liveclassroom_is_lecturehall($roomid,$courseshortname) {
- if(!($lc = get_record('liveclassroom_type_rooms','name',$roomname))) {
- error( "Response get type name: query to database failed2");
- return false;
- }
- else {
- $type = $lc->id-1;
- return $type;
- }
-}
-*/
-/*
-* Get the type number of liveclassroom
-* @param $liveclassroom : the object liveclassroom
-* return the type number of the liveclassroom
-*/
-/*
-function liveclassroom_get_type($liveclassroom) {
+ $studentuserid = liveclassroom_api_get_student_user_id($courseshortname);
- if(!($lc = get_record('liveclassroom','id',$liveclassroom->id))) {
- error( "Response get type: query to database failed");
+// $role = liveclassroom_api_role_user_room($roomid, $studentuserid);
+ if(liveclassroom_api_role_user_room($roomid, $studentuserid)=='Student') {
+ return true;
}
- else {
- return $lc->type;
- }
+ else{
+ return false ;
+ }
+
}
-*/
-/**
-* Give the name of the room for the course and the type given
-* @param $course : course
-* @param $type : type of the room
-* return the name of the room for the course
-*//*
-function liveclassroom_get_room_name($course,$type) {
-/*
- global $LIVECLASSROOM_MOODLE_PREFIX;
- if($type == 0) {//Main Lecture Hall
- return $LIVECLASSROOM_MOODLE_PREFIX.$course->shortname;
- }
- else if ($type == 1) { //Discussion room
-
- }
+/* To know if the room given is a discussion room
+* @param $roomid : the id of the room
+* return a boolean : true if the room is breakout room, false if not.
+*/
+function liveclassroom_is_breakout($roomid, $courseshortname) {
+ $studentuserid = liveclassroom_api_get_student_user_id($courseshortname);
- if(!($lc = get_record('liveclassroom_type_rooms','id',$type+1))) {
- error( "Response get room name: query to database failed");
- }
- else {
- $name = $lc->name;
- return $name;
+ //$role = liveclassroom_api_role_user_room($roomid, $studentuserid);
+ if(liveclassroom_api_role_user_room($roomid, $studentuserid)=='Instructor') {
+ return true;
}
+ else{
+ return false;
+ }
}
-*/
+
+
?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|