mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
MDL-59057 enrol: New enrol API method - by_ue_id
Part of MDL-57791 epic.
This commit is contained in:
parent
357507b4e6
commit
fba4052685
@ -1414,6 +1414,21 @@ function enrol_send_welcome_email_options() {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the course where a user enrolment belong to.
|
||||
*
|
||||
* @param int $ueid user_enrolments id
|
||||
* @return stdClass
|
||||
*/
|
||||
function enrol_get_course_by_user_enrolment_id($ueid) {
|
||||
global $DB;
|
||||
$sql = "SELECT c.* FROM {user_enrolments} ue
|
||||
JOIN {enrol} e ON e.id = ue.enrolid
|
||||
JOIN {course} c ON c.id = e.courseid
|
||||
WHERE ue.id = :ueid";
|
||||
return $DB->get_record_sql($sql, array('ueid' => $ueid));
|
||||
}
|
||||
|
||||
/**
|
||||
* All enrol plugins should be based on this class,
|
||||
* this is also the main source of documentation.
|
||||
|
Loading…
x
Reference in New Issue
Block a user