]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14679 fixed $exceptions regression in first part of datalib conversion
authorskodak <skodak>
Sun, 25 May 2008 10:16:53 +0000 (10:16 +0000)
committerskodak <skodak>
Sun, 25 May 2008 10:16:53 +0000 (10:16 +0000)
lib/accesslib.php
lib/deprecatedlib.php
mod/feedback/lib.php

index 427b67874b4fcd13c856c44f4c68172a9e42dd8c..ecae13105da49fdf4da31d49e7614f846f1965e5 100755 (executable)
@@ -4116,7 +4116,7 @@ function get_default_course_role($course) {
  * @param $limitnum - number of records to fetch
  * @param $groups - single group or array of groups - only return
  *               users who are in one of these group(s).
- * @param $exceptions - list of users to exclude
+ * @param $exceptions - list of users to exclude, comma separated or array
  * @param view - set to true when roles are pulled for display only
  *               this is so that we can filter roles with no visible
  *               assignment, for example, you might want to "hide" all
@@ -4238,6 +4238,9 @@ function get_users_by_capability($context, $capability, $fields='', $sort='',
 
     /// User exceptions
     if (!empty($exceptions)) {
+        if (is_array($exceptions)) {
+            $exceptions = implode(',', $exceptions);
+        }
         $wherecond['userexceptions'] = ' u.id NOT IN ('.$exceptions.')';
     }
 
index 28f987748a0cac8b4acf13a8525e5a9e05c366f9..696251c3d7b3a44cd3d90a2df2f467824604f4f2 100644 (file)
@@ -274,12 +274,11 @@ function get_course_students($courseid, $sort='ul.timeaccess', $dir='', $page=''
                 }
                 // Now we have to make sure site teachers are excluded
 
+                $exceptions = array();
                 if ($teachers = get_course_teachers(SITEID)) {
                     foreach ($teachers as $teacher) {
-                        $exceptions .= ','. $teacher->userid;
+                        $exceptions[] = $teacher->userid;
                     }
-                    $exceptions = ltrim($exceptions, ',');
-
                 }
 
                 return get_users(true, $search, true, $exceptions, $sort, $firstinitial, $lastinitial,
@@ -363,7 +362,7 @@ function get_course_students($courseid, $sort='ul.timeaccess', $dir='', $page=''
  * @return object
  * @todo Finish documenting this function
  */
-function get_course_teachers($courseid, $sort='t.authority ASC', $exceptions='') {
+function get_course_teachers($courseid, $sort='t.authority ASC', array $exceptions=null) {
 
     global $CFG;
 
@@ -398,15 +397,6 @@ function get_course_teachers($courseid, $sort='t.authority ASC', $exceptions='')
     return sort_by_roleassignment_authority($users, $context);
 
     /// some fields will be missing, like authority, editall
-    /*
-    return get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.maildisplay, u.mailformat, u.maildigest,
-                                   u.email, u.city, u.country, u.lastlogin, u.picture, u.lang, u.timezone,
-                                   u.emailstop, t.authority,t.role,t.editall,t.timeaccess as lastaccess
-                            FROM {$CFG->prefix}user u,
-                                 {$CFG->prefix}user_teachers t
-                            WHERE t.course = '$courseid' AND t.userid = u.id
-                              AND u.deleted = '0' AND u.confirmed = '1' $exceptions $sort");
-    */
 }
 
 /**
index 8f61d0daeb34ee7728eb8044efdb9482587847a9..72f4d87254c2a7470ef0fb3d61ea0631416f9988 100644 (file)
@@ -1734,7 +1734,6 @@ function feedback_send_email_anonym($cm, $feedback, $course) {
         return;
     }
     
-    // $teachers = get_course_teachers($course->id);
     $teachers = feedback_get_receivemail_users($cm->id);
 
     if ($teachers) {