[Hw4mdl-svn] SF.net SVN: hw4mdl: [84] trunk/moodle/mod/liveclassroom/lib.php
Brought to you by:
jhlinder,
trollinger
From: <sh...@us...> - 2006-10-13 12:37:00
|
Revision: 84 http://svn.sourceforge.net/hw4mdl/?rev=84&view=rev Author: shazan Date: 2006-10-13 05:36:54 -0700 (Fri, 13 Oct 2006) Log Message: ----------- library updated with the new dabatase format. remove all unused functions Modified Paths: -------------- trunk/moodle/mod/liveclassroom/lib.php Modified: trunk/moodle/mod/liveclassroom/lib.php =================================================================== --- trunk/moodle/mod/liveclassroom/lib.php 2006-10-13 12:35:24 UTC (rev 83) +++ trunk/moodle/mod/liveclassroom/lib.php 2006-10-13 12:36:54 UTC (rev 84) @@ -192,10 +192,6 @@ return $return; } -////////////////////////////////////////////////////////////////////////////////////// -/// Any other liveclassroom functions go here. Each of them must have a name that -/// starts with liveclassroom_ - /** * Creates the profiles account for a given course. */ @@ -208,14 +204,12 @@ //$userid = $CFG->liveclassroom_settinguniqueid."_".$course->id.$LIVECLASSROOM_TEACHER_SUFFIX; $userid = $LIVECLASSROOM_MOODLE_PREFIX.$course->shortname.$LIVECLASSROOM_TEACHER_SUFFIX; - //add_to_log($course->id, "liveclassroom", "", "liveclassroom_create_profiles", "Creating $userId as Teacher"); if (! liveclassroom_api_create_user ($userid, $course->shortname, 'Teacher')) { //error("Cannot Create Teacher profile"); return false; } $userid = $LIVECLASSROOM_MOODLE_PREFIX.$course->shortname.$LIVECLASSROOM_STUDENT_SUFFIX; - //add_to_log($course->id, "liveclassroom", "", "", "Creating $userId as Student"); if (! liveclassroom_api_create_user ($userid, $course->shortname, 'Student')) { //error("Cannot Create Student profile"); return false; @@ -231,15 +225,12 @@ */ function liveclassroom_create_rooms ($course) { - //teacher is the lead of the presentation - add_to_log("", "liveclassroom", "", "liveclassroom_create_rooms", "first ".time()); + //teacher is the lead of the presentation liveclassroom_create_room($course->id, "Main classroom", true); - add_to_log("", "liveclassroom", "", "liveclassroom_create_rooms", "second ".time()); liveclassroom_create_room($course->id, "Other classroom", true); - add_to_log("", "liveclassroom", "", "liveclassroom_create_rooms", "third ".time()); + //teachers and students have the same rights liveclassroom_create_room($course->id, "Group 1", false); - add_to_log("", "liveclassroom", "", "liveclassroom_create_rooms", "4th ".time()); liveclassroom_create_room($course->id, "Group 2", false); return true; @@ -326,13 +317,14 @@ return false; } } + /* //save this room in moodle database $liveclassroom_rooms->course = $courseid; $liveclassroom_rooms->name = $roomname; $liveclassroom_rooms->room_id = $roomid; liveclassroom_rooms_add_instance($liveclassroom_rooms); - + */ return true; } @@ -366,156 +358,8 @@ return '0'; } -/** - * Give the list of type of room available - * @param $course : an instance of a course - * @return the list of type of room available - */ -function liveclassroom_get_list_type_rooms($course) { - - if (!($list = get_records('liveclassroom_rooms','course',$course->id) )) { - error( "Response get list type room : query to database failed"); - } - $list_name=array(); - //$i=0; - foreach($list as $liveclassroom_rooms) { - array_push($list_name,$liveclassroom_rooms->name); - //$list_name[$i]= $liveclassroom_rooms->name; - //$i++; - } - return $list_name; -} - -/** - * Give the list of type of room available - * @return the list of type of room available - */ -function liveclassroom_get_list_type_rooms_first_time() { - - if (!($list = get_records('liveclassroom_type_rooms','course',0) )) { - error( "Response get list type room : query to database failed"); - } - - $i=0; - foreach($list as $liveclassroom_type_rooms) { - $list_name[$i]= $liveclassroom_type_rooms->name; - $i++; - } - - return $list_name; -} - - - - /* -* Get the list of the rooms per course for a course given -* @param $course : object course -* return a list of the type of the room available for this course -*/ -function liveclassroom_get_list_type_rooms_per_course($course) { - - if(!($list = get_records('liveclassroom_rooms','course',$course->id))) { - error( "Response get list type room per course : query to database failed"); - } - - $i=0; - foreach($list as $liveclassroom_rooms) { - $list_name[$i] = $liveclassroom_rooms->name; - $i++; - } - - return $list_name; -} - -/* -* Create a new instance of liveclassroom Room -* @param $liveclassroom_rooms : object liveclassroom_rooms -*/ -function liveclassroom_rooms_add_instance($liveclassroom_rooms) { - - $liveclassroom_rooms->timemodified = time(); - - if(!(insert_record("liveclassroom_rooms", $liveclassroom_rooms))) { - error( "Response: creation of new instance failed"); - //return false; - } - return true; -} - -function liveclassroom_rooms_delete_instance($roomid) { -/// Given an ID of an instance of this module, -/// this function will permanently delete the instance -/// and any data that depends on it. - - if (! $liveclassroom_rooms = get_record("liveclassroom_rooms", "room_id", "$roomid")) { - return false; - } - - $result = true; - - # Delete any dependent records here # - - if (! delete_records("liveclassroom_rooms", "id", "$liveclassroom_rooms->id")) { - $result = false; - } - - return $result; -} - - -function liveclassroom_rooms_update_instance($liveclassroom_room) { - - - if (! $liveclassroom_rooms = get_record("liveclassroom_rooms", "room_id", "$liveclassroom_room->room_id")) { - return false; - } - $liveclassroom_rooms->timemodified = time(); - $liveclassroom_rooms->name = $liveclassroom_room->name; - - if(!(update_record("liveclassroom_rooms", $liveclassroom_rooms))) { - error( "Response: update of instance liveclassroom_rooms failed"); - //return false; - } - return true; -} - -/* -* Create a new type to liveclassroom Room -* @param $name : the name of the type -*/ -function liveclassroom_rooms_add_new_type($courseid,$name) { - - $liveclassroom_type_room->timemodified = time(); - - $liveclassroom_type_room->course = $courseid ; - $liveclassroom_type_room->lc_id = 0 ; - $liveclassroom_type_room->name = $name ; - - if(!(insert_record("liveclassroom_type_rooms", $liveclassroom_type_room))) { - error( "Response: creation of new type $name failed"); - } - return true; -} - - -/* -* Check if the room exist in the moodle database liveclassroom_rooms -* @param $liveclassroom : a liveclassroom instance -* return true if the room exist, false if not. -*/ - -function liveclassroom_rooms_exists($liveclassroom) { - - if(!get_records('liveclassroom_rooms','lc_id',$liveclassroom->id)) { - return false; - } - else return true; - -} - -/* * Give the shortnamefor a courseid given * @param $courseid : the id of the course * Return a string : the shortname of the course @@ -532,71 +376,7 @@ } } - - - -function liveclassroom_get_room_id($course,$roomnane){ - if(!($rooms = get_records('liveclassroom_rooms','course',$course->id))) { - error( "Response get roomid : query to database failed"); - } - foreach($rooms as $room){ - if (($room->name)==$roomnane){ - $roomid = $room->room_id; - } - } - return $roomid; -} - /* -* Give the name of the room with it room id -* @param $roomis : the id of the room on the server -* Return the name of the room -*/ -function liveclassroom_get_room_name_from_id($roomid) { - - if(!($list = get_record('liveclassroom_rooms','room_id',$roomid))) { - error( "Response get room name from id : query to database failed"); - } - return $list->name; - -} - -/* -* List the room_id of all the room available for a course -* -* @param $course -* return a table with all the room_id of the room for the course given -*/ -function liveclassroom_get_roomid_list($course) { - - if(!($rooms = get_records('liveclassroom_rooms','course',$course->id))) { - error( "Response get roomid list : query to database failed"); - } - - $i=0; - foreach ($rooms as $liveclassroom_rooms) { - if($liveclassroom_rooms->course==$course->id) { - $list_roomid[$i]=$liveclassroom_rooms->room_id; - $i++; - } - } - return $list_roomid; -} - - -function liveclassroom_test_get_room_list($course) { - - - -// $list_roomid = liveclassroom_get_roomid_list($course); - $studentuserid = liveclassroom_api_get_student_user_id($course->shortname); - $teacherid = liveclassroom_api_get_teacher_user_id($course->shortname); - liveclassroom_api_get_room_list($teacherid); - -} - - -/* * List all the activities for a course given ans a type of Room * @param $course : the course * @param $roomnase = the name of the room This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |