]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14679 deprecated lib converted to new $DB
authorskodak <skodak>
Sun, 25 May 2008 14:33:33 +0000 (14:33 +0000)
committerskodak <skodak>
Sun, 25 May 2008 14:33:33 +0000 (14:33 +0000)
lib/deprecatedlib.php

index 8a2b8a2cdb2f4938849294b3be463391991e5c20..c1062ae82b4921686c90db805e7d1e72cadc9796 100644 (file)
@@ -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.