From 10df888a1fe6609887a283b68198b81acb31dc91 Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 25 May 2008 14:33:33 +0000 Subject: [PATCH] MDL-14679 deprecated lib converted to new $DB --- lib/deprecatedlib.php | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 8a2b8a2cdb..c1062ae82b 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -184,23 +184,22 @@ function get_teacher($courseid) { * @todo Finish documenting this function */ function get_recent_enrolments($courseid, $timestart) { - - global $CFG; + global $DB; $context = get_context_instance(CONTEXT_COURSE, $courseid); - return get_records_sql("SELECT DISTINCT u.id, u.firstname, u.lastname, l.time - FROM {$CFG->prefix}user u, - {$CFG->prefix}role_assignments ra, - {$CFG->prefix}log l - WHERE l.time > '$timestart' - AND l.course = '$courseid' - AND l.module = 'course' - AND l.action = 'enrol' - AND l.info = u.id - AND u.id = ra.userid - AND ra.contextid ".get_related_contexts_string($context)." - ORDER BY l.time ASC"); + $sql = "SELECT DISTINCT u.id, u.firstname, u.lastname, l.time + FROM {user} u, {role_assignments} ra, {log} l + WHERE l.time > ? + AND l.course = ? + AND l.module = 'course' + AND l.action = 'enrol' + AND l.info = u.id + AND u.id = ra.userid + AND ra.contextid ".get_related_contexts_string($context)." + ORDER BY l.time ASC"; + $params = array($timestart, $courseid); + return $DB->get_records_sql($sql, $params); } ########### FROM weblib.php ########################################################################## @@ -427,12 +426,6 @@ function get_current_group($courseid, $full = false) { - - - - - - /** * Print an error page displaying an error message. * Old method, don't call directly in new code - use print_error instead. -- 2.39.5