[Hw4mdl-svn] SF.net SVN: hw4mdl: [127] trunk/moodle/mod/liveclassroom
Brought to you by:
jhlinder,
trollinger
|
From: <sh...@us...> - 2006-12-27 09:39:33
|
Revision: 127
http://svn.sourceforge.net/hw4mdl/?rev=127&view=rev
Author: shazan
Date: 2006-12-27 01:39:30 -0800 (Wed, 27 Dec 2006)
Log Message:
-----------
fix the bug 1051. When a course shortnane was created with a space, it made errors with the profiles creation. Now space is replace with an underscore
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-12-26 11:15:55 UTC (rev 126)
+++ trunk/moodle/mod/liveclassroom/api.php 2006-12-27 09:39:30 UTC (rev 127)
@@ -228,8 +228,11 @@
global $CFG;
global $LIVECLASSROOM_MOODLE_PREFIX;
global $COURSE;
+
+ $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, "&target=$userid&first_name=$rolename&last_name=$coursename");
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_CREATE_USER, $enc_list);
preg_match("(\d*)", $data, $matches);
$respcode = $matches[0];
@@ -291,7 +294,12 @@
global $USER;
global $COURSE;
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_TOKEN, "&target=$userid&nickname=$nickname");
+
+ $final_list = "&target=$userid&nickname=$nickname";
+ $enc_list = str_replace(" ", "+", $final_list);
+
+
+ $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_GET_TOKEN, $enc_list);
preg_match("(\d*)", $data, $matches);
@@ -772,8 +780,12 @@
global $CFG;
$name = $course->shortname;
-
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_LIST_USER, "&filter00=last_name&filter00value=$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];
@@ -888,7 +900,9 @@
$course = get_record("course", "id", $courseid);
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_LIST_USER, "&filter00=last_name&filter00value=$course->shortname&filter01=first_name&filter01value=Student");
+ $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");
preg_match("(\d*)", $data, $matches);
$respcode = $matches[0];
@@ -1110,7 +1124,9 @@
$course = get_record("course", "id", $courseid);
- $data = liveclassroom_api_send_query(LIVECLASSROOM_API_FUNCTION_LIST_USER, "&filter00=last_name&filter00value=$course->shortname&filter01=first_name&filter01value=Teacher");
+ $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=Teacher");
preg_match("(\d*)", $data, $matches);
$respcode = $matches[0];
Modified: trunk/moodle/mod/liveclassroom/lib.php
===================================================================
--- trunk/moodle/mod/liveclassroom/lib.php 2006-12-26 11:15:55 UTC (rev 126)
+++ trunk/moodle/mod/liveclassroom/lib.php 2006-12-27 09:39:30 UTC (rev 127)
@@ -247,17 +247,20 @@
global $LIVECLASSROOM_TEACHER_SUFFIX;
global $LIVECLASSROOM_STUDENT_SUFFIX;
global $LIVECLASSROOM_MOODLE_PREFIX;
- //$userid = $CFG->liveclassroom_settinguniqueid."_".$course->id.$LIVECLASSROOM_TEACHER_SUFFIX;
- $userid = $LIVECLASSROOM_MOODLE_PREFIX.$course->shortname.$LIVECLASSROOM_TEACHER_SUFFIX;
-
- if (! liveclassroom_api_create_user ($userid, $course->shortname, 'Teacher')) {
+
+ $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.$course->shortname.$LIVECLASSROOM_STUDENT_SUFFIX;
- if (! liveclassroom_api_create_user ($userid, $course->shortname, 'Student')) {
+ $userid = $LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.$LIVECLASSROOM_STUDENT_SUFFIX;
+
+ if (! liveclassroom_api_create_user ($userid, $enc_coursename, 'Student')) {
//error("Cannot Create Student profile");
return false;
@@ -292,8 +295,11 @@
global $LIVECLASSROOM_STUDENT_SUFFIX;
global $LIVECLASSROOM_MOODLE_PREFIX;
- $userid = $LIVECLASSROOM_MOODLE_PREFIX.$course->shortname.
+ $enc_coursename = str_replace(" ", "_", $course->shortname);
+
+ $userid = $LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.
($isteacher?$LIVECLASSROOM_TEACHER_SUFFIX:$LIVECLASSROOM_STUDENT_SUFFIX);
+
$nickname = fullname($USER);
@@ -315,10 +321,12 @@
global $LIVECLASSROOM_MOODLE_PREFIX;
$course_name = liveclassroom_get_course_shortname($courseid);
- $roomid = $LIVECLASSROOM_MOODLE_PREFIX.$course_name.'_'.rand();
+ $enc_coursename = str_replace(" ", "_", $course_name);
+
+ $roomid = $LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.'_'.rand();
- $teacherid = $LIVECLASSROOM_MOODLE_PREFIX.$course_name.$LIVECLASSROOM_TEACHER_SUFFIX;
- $studentid = $LIVECLASSROOM_MOODLE_PREFIX.$course_name.$LIVECLASSROOM_STUDENT_SUFFIX;
+ $teacherid = $LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.$LIVECLASSROOM_TEACHER_SUFFIX;
+ $studentid = $LIVECLASSROOM_MOODLE_PREFIX.$enc_coursename.$LIVECLASSROOM_STUDENT_SUFFIX;
if($bool==true) { // main lecture hall
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|