Non-core contributed modules

addslotsform.html is broken: Undefined function scheduler_getteachers

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.5
  • Fix Version/s: 1.9.7, 2.0
  • 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.

http://cvs.moodle.org/contrib/plugins/mod/scheduler/addslotsform.html?r1=1.2.2.4&r2=1.2.2.5&pathrev=MOODLE_19_STABLE

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.)

Activity

Hide
Valery Fremaux added a comment -

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.

Show
Valery Fremaux added a comment - 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.
Hide
Valery Fremaux added a comment -

Hi Henning for the very efficient support job you are having on shceduler.

missing word was : Thanks !!

Show
Valery Fremaux added a comment - Hi Henning for the very efficient support job you are having on shceduler. missing word was : Thanks !!
Hide
Valery Fremaux added a comment -

more globally eliminate functional mention to "teacher" also...

Show
Valery Fremaux added a comment - more globally eliminate functional mention to "teacher" also...
Hide
Henning Bostelmann added a comment -

Hi Valery,

I'm just trying to synchronize my local changes to upstream...

I agree with your proposed solution; a function scheduler_get_attendants() would be a good addition to lib.php. (And I also agree with the renaming.)

Globally removing the references to "teacher" might be more difficult though - it's even in the role names (mod/scheduler:canseeotherteachersbooking etc.).

Show
Henning Bostelmann added a comment - Hi Valery, I'm just trying to synchronize my local changes to upstream... I agree with your proposed solution; a function scheduler_get_attendants() would be a good addition to lib.php. (And I also agree with the renaming.) Globally removing the references to "teacher" might be more difficult though - it's even in the role names (mod/scheduler:canseeotherteachersbooking etc.).
Hide
Valery Fremaux added a comment -

agree with you.

impact in module is quite height, and staffrolename property allows hiding most of teaching semantics.

I will roadmap an overall change at a quiter period....

Agreed changes have been commited.

scheduler_get_attendants function has been added to locallib.php rather than lib.php as it is not part as the Moodle module framework API.

Cheers.

Show
Valery Fremaux added a comment - agree with you. impact in module is quite height, and staffrolename property allows hiding most of teaching semantics. I will roadmap an overall change at a quiter period.... Agreed changes have been commited. scheduler_get_attendants function has been added to locallib.php rather than lib.php as it is not part as the Moodle module framework API. Cheers.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: