]> git.mjollnir.org Git - moodle.git/commitdiff
get_my_courses() callers update - check of the $fields param - pass null instead
authormartinlanghoff <martinlanghoff>
Sun, 6 May 2007 05:32:40 +0000 (05:32 +0000)
committermartinlanghoff <martinlanghoff>
Sun, 6 May 2007 05:32:40 +0000 (05:32 +0000)
The default way to call get_my_courses() is now to pass null in the $fields
param to get the (cached copy) of the useful fields. Cuts down enormously
on DB traffic, memory footprint, and session size.

calendar/lib.php
mod/forum/lib.php
my/index.php
user/view.php

index 5c43b3b020dee661fe39cf4fc5b03a73f903d21e..55c39b6ebcff566c56253575e3ca1984092e6870 100644 (file)
@@ -1247,10 +1247,10 @@ function calendar_get_default_courses($ignoreref = false) {
     }
     
     if (isset($CFG->adminseesall)) {
-        $courses = get_my_courses($USER->id, 'visible DESC', '*', $CFG->adminseesall);
+        $courses = get_my_courses($USER->id, 'visible DESC', null, $CFG->adminseesall);
     }
     else {
-        $courses = get_my_courses($USER->id, 'visible DESC', '*', false);
+        $courses = get_my_courses($USER->id, 'visible DESC', null, false);
     }
     // Make sure global events are included
     $courses[0] = true;
index 946eefa16e9decac029dd387b1aeb46878a48506..e609cad0f75bbb2310b79f4eda109cad5094e037 100644 (file)
@@ -1300,7 +1300,7 @@ function forum_get_readable_forums($userid, $courseid=0) {
         // If no course is specified, then the user can see SITE + his courses. 
         // And admins can see all courses, so pass the $doanything flag enabled
         $courses1 = get_records('course', 'id', SITEID);
-        $courses2 = get_my_courses($userid, 'visible DESC,sortorder ASC', '*', true);
+        $courses2 = get_my_courses($userid, 'visible DESC,sortorder ASC', null, true);
         $courses = array_merge($courses1, $courses2);
     }
     if (!$courses) {
index 20506423e16de5ce19b00c4a85354219b743a016..9c8b0354207603c38f0409317c1b32f04ddbfd59 100644 (file)
@@ -55,7 +55,7 @@
 /// The main overview in the middle of the page
     
     // limits the number of courses showing up
-    $courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', '*', false, 21);
+    $courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', null, false, 21);
     $site = get_site();
     $course = $site; //just in case we need the old global $course hack
 
index 6f59476217b497dfb5a2614d7b1e3a7e4c540bc4..a6e01d6ddf3874ba8ce958301dd855317a307c8f 100644 (file)
     profile_display_fields($user->id);
 
 
-    if ($mycourses = get_my_courses($user->id,'visible DESC,sortorder ASC', '*', false, 21)) {
+    if ($mycourses = get_my_courses($user->id,'visible DESC,sortorder ASC', null, false, 21)) {
         $shown=0;
         $courselisting = '';
         foreach ($mycourses as $mycourse) {