[Hw4mdl-svn] SF.net SVN: hw4mdl: [180] trunk/moodle/mod/liveclassroom
Brought to you by:
jhlinder,
trollinger
From: <hu...@us...> - 2007-01-11 21:55:17
|
Revision: 180 http://svn.sourceforge.net/hw4mdl/?rev=180&view=rev Author: hugues Date: 2007-01-11 13:55:02 -0800 (Thu, 11 Jan 2007) Log Message: ----------- http://u.horizonwimba.com/bugzilla/show_bug.cgi?id=10738 - Fixed some variable name typos 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 2007-01-11 15:25:54 UTC (rev 179) +++ trunk/moodle/mod/liveclassroom/api.php 2007-01-11 21:55:02 UTC (rev 180) @@ -417,7 +417,6 @@ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_DELETE_ROLE, "&target=$roomid&user_id=$userid&role_id=$role"); - preg_match("(\d*)", $data, $matches); $respcode = $matches[0]; @@ -909,27 +908,25 @@ function liveclassroom_api_get_student_user_id ($courseid){ global $CFG; - $course = get_record("course", "id", $courseid); + $course = get_record("course", "id", $courseid); + if (empty($course)) { + error(_FUNCTION_." empty course"); + } $enc_coursename = str_replace(" ", "_", $course->shortname); - $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_LIST_USER, "&filter00=last_name&filter00value=$enc_coursename&filter01=first_name&filter01value=Student"); + $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_LIST_USER, "&filter01=last_name&filter01value=$enc_coursename&filter02=first_name&filter02value=Student"); preg_match("(\d*)", $data, $matches); $respcode = $matches[0]; - if ( $respcode != 100) { - return false; - } + if ( $respcode != 100) { + return false; + } $line = explode("\n",$data); -// $tok = split("100 OK",$data); - // $tok1 = split($LIVECLASSROOM_API_RECORD_SEPERATOR,$tok[1]); -// $result = liveclassroom_parse_line($tok1[0],"user_id="); $result = liveclassroom_parse_line($line[1],"user_id="); - //Remove le " " at the end of the line - //$response = substr($result,0,-1); return $result; @@ -946,7 +943,7 @@ function liveclassroom_api_room_is_preview ($roomid){ global $CFG; - $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&filter00=class_id&filter00value=$roomid&filter01=preview&filter01value=0"); + $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_ROOM_LIST, "&filter01=class_id&filter01value=$roomid&filter02=preview&filter02value=0"); preg_match("(\d*)", $data, $matches); $respcode = $matches[0]; Modified: trunk/moodle/mod/liveclassroom/lib.php =================================================================== --- trunk/moodle/mod/liveclassroom/lib.php 2007-01-11 15:25:54 UTC (rev 179) +++ trunk/moodle/mod/liveclassroom/lib.php 2007-01-11 21:55:02 UTC (rev 180) @@ -307,11 +307,9 @@ $userid = LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename. ($isteacher?LIVECLASSROOM_TEACHER_SUFFIX:LIVECLASSROOM_STUDENT_SUFFIX); - $nickname = fullname($USER); - return liveclassroom_api_get_session ($userid, $nickname); } @@ -320,42 +318,54 @@ * Updates the parameters of a room * */ -function liveclassroom_update_room ($course_id, $roomname, $instructor_led, $attributes) { +function liveclassroom_update_room ($courseid, $roomname, $instructor_led, $attributes) { - $student_id = liveclassroom_api_get_student_user_id ($courseid) ; + $roomid = $attributes['roomId_Field']; + unset($attributes['roomId_Field']); + $studentid = liveclassroom_api_get_student_user_id ($courseid) ; + //set media_type and media_format according to the appropriate values according to the media_type attribute $attributes = liveclassroom_check_media($attributes); $attributes = liveclassroom_check_chat($attributes); - //print_r($list_attributes); //Test if the type of room has been changed if($_SESSION['led']!=$attributes['led']) { // Type changed - if($list_attributes['led']=='instructor'){ - liveclassroom_api_remove_user_role ($_GET['id'], $student_id, 'Instructor') ; - liveclassroom_api_add_user_role ($_GET['id'], $student_id, 'Student'); + if($attributes['led']=='instructor'){ + + if (! liveclassroom_api_remove_user_role ($roomid, $studentid, 'Instructor')) { + return false; + } + + if (! liveclassroom_api_add_user_role ($roomid, $studentid, 'Student')) { + return false; + } } else { - liveclassroom_api_remove_user_role ($_GET['id'], $student_id , 'Student') ; - liveclassroom_api_add_user_role ($_GET['id'], $student_id, 'Instructor'); + + if (!liveclassroom_api_remove_user_role ($roomid, $studentid , 'Student')) { + return false; + } + if (!liveclassroom_api_add_user_role ($roomid, $studentid, 'Instructor')) { + return false; + } } } unset($attributes['led']); unset($attributes['link']); - unset($attributes['roomId_Field']); //print_r($list_attributes); - if(!liveclassroom_api_modify_room($_GET['id'],$attributes)) { + if(!liveclassroom_api_modify_room($roomid, $attributes)) { return false; } //Guest enabled? if ($attributes['guests']==1) { - if (! liveclassroom_api_add_user_role ($_GET['id'], 'Guest' , 'Student')) { + if (! liveclassroom_api_add_user_role ($roomid, 'Guest' , 'Student')) { return false; } } else if ($attributes['guest']==0) { - if (! liveclassroom_api_remove_user_role ($_GET['id'], 'Guest' , 'Student')) { + if (! liveclassroom_api_remove_user_role ($roomid, 'Guest' , 'Student')) { return false; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |