Is there a function in Moodle that gets the records with the teachers (iduser) given a curseid? ... or .. it has to be done?.
thanks in advance for any link or tip to answer this issue.
$context = get_context_instance(CONTEXT_COURSE, $courseid);
$users = get_context_users_bycap($context, 'moodle/course:update');
print_object($users);
Jamie and Eloy caught me via Skype, here's some quick notes about this
The best fix I can think of for that Jamie wants is to teach gubc to store the resulting user ids in a temporary results table. We have trouble with temptables on MSSQL and Ora, so it should be a "static" temp results table with a "transaction id" of sorts. This will work relatively well for the code-paths where most of the work is in SQL - for the cases where we filter stuff in PHP, it will be... ugh.
We could have a better solution if we had portable mechanisms for
Any enhancement in these 3 aspects would make gubc (and other parts of accesslib) much more maintainable and scalable. Right now optimising accesslib means mostly working around the limitations of portable SQL in those areas.
$context = get_context_instance(CONTEXT_COURSE, $courseid);
$users = get_users_by_capability($context, 'moodle/course:update');
print_object($users);