[Hw4mdl-svn] SF.net SVN: hw4mdl: [59] trunk/moodle/mod/liveclassroom/api.php
Brought to you by:
jhlinder,
trollinger
From: <sh...@us...> - 2006-09-12 16:03:43
|
Revision: 59 http://svn.sourceforge.net/hw4mdl/?rev=59&view=rev Author: shazan Date: 2006-09-12 09:03:20 -0700 (Tue, 12 Sep 2006) Log Message: ----------- New functions added Modified Paths: -------------- trunk/moodle/mod/liveclassroom/api.php Modified: trunk/moodle/mod/liveclassroom/api.php =================================================================== --- trunk/moodle/mod/liveclassroom/api.php 2006-09-08 15:24:47 UTC (rev 58) +++ trunk/moodle/mod/liveclassroom/api.php 2006-09-12 16:03:20 UTC (rev 59) @@ -569,6 +569,9 @@ return $response; } + + + /** * delete Room from the server * @@ -681,16 +684,31 @@ /* * archive=1 ===> room is an archive * -* IMPLEMENT ME !!! +* NEED TO BE TESTED !!! */ -function liveclassroom_api_get_archive_list($roomid,$userid,$role) { +function liveclassroom_api_get_archive_list() { global $CFG; global $LIVECLASSROOM_API_ADMIN; - global $LIVECLASSROOM_API_FUNCTION_MODIFY_ROOM; + global $LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST; - $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_MODIFY_ROOM, "&filter00=archive&filter00value=1"); - - + $data = liveclassroom_api_send_query($ch,$LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&attribute&filter01=archive&filter01value=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]); + + $j=0; + + for($i=0;$i<sizeof($tok1);$i++) { + $list_return[$j]=$tok[$i]; + + } + return $list_return; } /* @@ -867,7 +885,94 @@ return false; } } + +/* Check if the room is an archive +* @param $roomid : the id of the room +* return a boolean : true if the room is an archive, false if it's closed +*/ +function liveclassroom_api_room_is_archive ($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, "&filter00=class_id&filter00value=$roomid&filter01=archive&filter01value=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]); + + if(sizeof($tok1)>1){ + return true; + } + else { + return false; + } +} + +/* +* List all the orphaned archive on the server +* NEED TO BE TESTED !!!! +*/ + +function liveclassroom_api_get_orphaned_archive_list() { + + $tab_archive = liveclassroom_api_get_archive_list() ; + + + //liste des archive + //si ya une class id on la prend pas + + $j=0; + + for($i=0;$i<sizeof($tab_archive);$i++) { + if ($tok[$i]!=null) { + //tester les room + $list_return[$j]=$tok[$i]; + } + } + print $data; + return $list_return; +} + +/* +* Give the description of he room given +* @param $roomid : the id of the room +* return a String :description of the room +*/ +function liveclassroom_api_get_room_description($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=description&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]); + + $tok2 = split("class_id=",$tok1[0]); + $result = liveclassroom_parse_line($tok2[0],"description="); + //Remove le " " at the end of the line + $response = substr($result,0,-1); + + return $response; + +} + /** * Enroll the given user into the group. * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |