Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.9.5
-
Component/s: Module: Scheduler
-
Labels:None
-
Environment:Ubuntu Server 8.04 LTS
-
Database:Any
-
Affected Branches:MOODLE_19_STABLE
-
Fixed Branches:MOODLE_19_STABLE, MOODLE_20_STABLE
Description
On a freshly checked-out copy of the scheduler module, the "Add Slots" form is currently broken - it displays only until half, and then prints the message
Fatal error: Call to undefined function scheduler_getteachers()
For details see http://moodle.org/mod/forum/discuss.php?d=136195 .
The function scheduler_getteachers, used in line 78, is in fact not defined - I found it in none of the libraries. The problem was apparently introduced by the following commit to the MOODLE_19_STABLE branch.
The change introduced a call to the new function scheduler_getteachers, but didn't implement the function. Possibly the commit was incomplete - I'm unsure about the history.
I propose to revert this commit, using the attached diff.
Note that the diff also introduces a small change to the parameters for calling get_users_by_capability(). This is to prevent administrators from showing up in the list of teachers. (This problem - admins showing up in teacher or student lists - actually occurs in several other files as well. I will later post this as a separate issue.)
Hi Henning for the very efficient support job you are having on shceduler.
for this issue, what would you opinate about this kind of fix :
keeping the scheduler_getteacher() encapsulation BUT :
1. renaming it as scheduler_get_attendants()
simplifying the detection algorithm removing the moodle/legacy:teacher that was essentially intended for backward compatibility.
resulting in a more simple way :
function scheduler_get_attendants($cmid){
$context = get_context_instance(CONTEXT_MODULE, $cmid);
$attendants = get_users_by_capability ($context, 'mod/scheduler:attend', 'u.id,lastname,firstname,email,picture', 'lastname', '', '', '', '', false, false, false);
}
based on course_module context.
Cheers.