0

Update to lib.php (Marratech Moodle Plug-in)

I posted this a while back but lost it during my blog upgrade. Who need stink’n backups! Any ways, those who care, lib.php at sourceforge is now updated to 1.2. Here is the code snippet showing the changes (Thanks Bob):

@@ -580,10 +580,22 @@
* @return string – string delimited list of the usernames of moderators
*/
function emeeting_get_moderators($moduleid){
– $record = get_record(“emeeting”, “id”, $moduleid);
– $record = get_record(“course”, “id”, $record->course);
+ $emeeting = get_record(“emeeting”, “id”, $moduleid);
+ $course = get_record(“course”, “id”, $record->course);
+ $context = get_context_instance(COURSE_CONTEXT,$course->id);
+
+ // This part is a bit iffy, but it should function the same as the old code
+ //
+ // Best practices, however, would be to create an “emeeting moderator”
+ // ability, which could be added to the teacher role or any other role
+ // and query for that here.
+ //
+ // I think that is the kind of granularity they are going for w/the new system.
+ // Whether the benfits outweigh the time it would take to implement it, I’m
+ // not sure.
$teachers=array();
– $teachers = get_records(“user_teachers”, “course”, $record->id);
+ $teachers = get_users_by_capability($context,”moodle/legacy:editingteacher”)
+
$usernames=array();
$i=0;
if($teachers == null){
@@ -596,8 +608,8 @@
}
else{
foreach($teachers as $teacher){
– $user=get_record(“user”,”id”, $teacher->userid);
– $usernames[$i]=($user->username);
+ //$user=get_record(“user”,”id”, $teacher->userid);
+ $usernames[$i]=($teacher->username);
$i++;
}
}

Now the plug-in will work with Moodle 1.8. Full support for roles in the admin interface is still lacking. That will be our next task.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *