]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7772 "Quiz results overview: not all combinations of Show attempts with ... ...
authorjamiesensei <jamiesensei>
Wed, 30 Apr 2008 08:22:20 +0000 (08:22 +0000)
committerjamiesensei <jamiesensei>
Wed, 30 Apr 2008 08:22:20 +0000 (08:22 +0000)
Second patch, found a bug while merging and testing in 1.9.

mod/quiz/report/overview/report.php

index 9e0b1fa8d0d81d9db2853f04dc002410855e0bef..650b58e9fc62fa87c4de2905ff34be17aff47d91 100644 (file)
@@ -305,15 +305,18 @@ class quiz_report extends quiz_default_report {
             echo $headers." \n";
         }
 
-        // Get users with quiz attempt capability
-        if (empty($currentgroup)) {
-    
-            // all users who can attempt quizzes
-            $allowed = join(',',array_keys(get_users_by_capability($context, 'mod/quiz:attempt','','','','','','',false)));
-        } else {
-    
-            // all users who can attempt quizzes and who are in the currently selected group
-            $allowed = join(',',array_keys(get_users_by_capability($context, 'mod/quiz:attempt','','','','',$currentgroup,'',false)));
+        // Get users with quiz attempt capability 'students'.
+        // don't need to do this expensive call if we are listing all attempts though.
+        if ( $noattempts != 3 ) { 
+            if (empty($currentgroup)) {
+        
+                // all users who can attempt quizzes
+                $allowed = join(',',array_keys(get_users_by_capability($context, 'mod/quiz:attempt','','','','','','',false)));
+            } else {
+        
+                // all users who can attempt quizzes and who are in the currently selected group
+                $allowed = join(',',array_keys(get_users_by_capability($context, 'mod/quiz:attempt','','','','',$currentgroup,'',false)));
+            }
         }
 
         // Construct the SQL
@@ -424,17 +427,8 @@ class quiz_report extends quiz_default_report {
 
                     $picture = print_user_picture($attempt->userid, $course->id, $attempt->picture, false, true);
 
-            // If we're showing all attempts, check to see if user still has the quiz attempt capability
-            if ( $noattempts == 3 ) {
-
-                        $userlink = '<a class="dimmed" href="'.$CFG->wwwroot.'/user/view.php?id='.
-                                $attempt->userid.'&amp;course='.$course->id.'">'.fullname($attempt).'</a>';
-                    }
-                    else {
-
-                        $userlink = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$attempt->userid.
-                                '&amp;course='.$course->id.'">'.fullname($attempt).'</a>';
-                    }
+                    $userlink = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$attempt->userid.
+                            '&amp;course='.$course->id.'">'.fullname($attempt).'</a>';
 
                     // Username columns.
                     $row = array();