]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15393 "show group name in drop down select for what to show in report" AND MDL...
authorjamiesensei <jamiesensei>
Tue, 24 Jun 2008 16:36:44 +0000 (16:36 +0000)
committerjamiesensei <jamiesensei>
Tue, 24 Jun 2008 16:36:44 +0000 (16:36 +0000)
lang/en_utf8/quiz_overview.php
mod/quiz/report/overview/overviewsettings_form.php
mod/quiz/report/overview/report.php

index 11fbc43d1d4671e31882c34f1b89db47745131e2..dddc39ab41e115b52cae0ce6bf3b88c5033f8f3c 100644 (file)
@@ -12,9 +12,9 @@ $string['highlightinggraded'] = 'The user attempt that contributes to final grad
 $string['noattemptsonly'] = 'Show / download $a with no attempts only';
 $string['onlyoneattemptallowed'] = 'Only one attempt per user allowed on this quiz.';
 $string['optallattempts'] = 'all attempts';
-$string['optallstudents'] = 'all \'$a\'';
-$string['optattemptsonly'] = '\'$a\' with attempts only';
-$string['optnoattemptsonly'] = '\'$a\' with no attempts only';
+$string['optallstudents'] = 'all $a who have or have not attempted the quiz';
+$string['optattemptsonly'] = '$a who have attempted the quiz';
+$string['optnoattemptsonly'] = '$a who have not attempted the quiz';
 $string['optonlygradedattempts'] = 'only the attempt that is graded for each user ($a)';
 $string['overview'] = 'Grades';
 $string['overviewdownload'] = 'Overview download';
@@ -28,4 +28,5 @@ $string['show'] = 'Show / download';
 $string['showinggraded'] = 'Showing only the attempt graded for each user.';
 $string['showinggradedandungraded'] = 'Showing graded and ungraded attempts for each user. The one attempt for each user that is graded is highlighted. The grading method for this quiz is $a.';
 $string['showdetailedmarks'] = 'Show / download marks for each question';
+$string['studentingroup'] = '\'$a->coursestudent\' in group \'$a->groupname\'';
 ?>
index c67d49acf1f506e8acb4a36f51b119cfe8fb2103..e250e0aa67593ece0e2f6080deaea13d5600f97a 100644 (file)
@@ -8,13 +8,23 @@ class mod_quiz_report_overview_settings extends moodleform {
 //-------------------------------------------------------------------------------
         $mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
 
+        if (!$this->_customdata['currentgroup']){
+            $studentsstring = "'".$COURSE->students."'";
+        } else {
+            $a = new object();
+            $a->coursestudent = $COURSE->students;
+            $a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
+            $studentsstring = get_string('studentingroup', 'quiz_overview', $a);
+        }
         $options = array();
-        $options[QUIZ_REPORT_ATTEMPTS_ALL] = get_string('optallattempts','quiz_overview');
-        if ($COURSE->id != SITEID) {
-            $options[QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS] = get_string('optallstudents','quiz_overview', $COURSE->students);
+        if (!$this->_customdata['currentgroup']){
+            $options[QUIZ_REPORT_ATTEMPTS_ALL] = get_string('optallattempts','quiz_overview');
+        }
+        if ($this->_customdata['currentgroup'] || $COURSE->id != SITEID) {
+            $options[QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS] = get_string('optallstudents','quiz_overview', $studentsstring);
             $options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH] =
-                     get_string('optattemptsonly','quiz_overview', $COURSE->students);
-            $options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO] = get_string('optnoattemptsonly', 'quiz_overview', $COURSE->students);
+                     get_string('optattemptsonly','quiz_overview', $studentsstring);
+            $options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO] = get_string('optnoattemptsonly', 'quiz_overview', $studentsstring);
         }
         $mform->addElement('select', 'attemptsmode', get_string('show', 'quiz_overview'), $options);
         if ($this->_customdata['qmsubselect']){
index ae4f17537a3132db9cf76875fa01dd0a82f79331..95b44fb13d28bcfff55048eb3b51f5a3d97ff533 100644 (file)
@@ -55,7 +55,10 @@ class quiz_overview_report extends quiz_default_report {
         $reporturl = new moodle_url($CFG->wwwroot.'/mod/quiz/report.php', $pageoptions);
         $qmsubselect = quiz_report_qm_filter_subselect($quiz); // careful: these are named params in $params!!
 
-        $mform = new mod_quiz_report_overview_settings($reporturl, array('qmsubselect'=> $qmsubselect, 'quiz'=>$quiz));
+        /// find out current groups mode
+        $currentgroup = groups_get_activity_group($cm, true);
+
+        $mform = new mod_quiz_report_overview_settings($reporturl, array('qmsubselect'=> $qmsubselect, 'quiz'=>$quiz, 'currentgroup'=>$currentgroup));
         if ($fromform = $mform->get_data()){
             $attemptsmode = $fromform->attemptsmode;
             if ($qmsubselect){
@@ -72,7 +75,19 @@ class quiz_overview_report extends quiz_default_report {
             $pagesize = $fromform->pagesize;
         } else {
             $qmfilter = optional_param('qmfilter', 0, PARAM_INT);
-            $attemptsmode = optional_param('attemptsmode', QUIZ_REPORT_ATTEMPTS_ALL, PARAM_INT);
+            $attemptsmode = optional_param('attemptsmode', null, PARAM_INT);
+            if ($attemptsmode === null){
+                //default
+                $attemptsmode = QUIZ_REPORT_ATTEMPTS_ALL;
+            } else if ($currentgroup){
+                //default for when a group is selected
+                if ($attemptsmode === null  || $attemptsmode == QUIZ_REPORT_ATTEMPTS_ALL){
+                    $attemptsmode = QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH;
+                }
+            } else if (!$currentgroup && $course->id == SITEID) {
+                //force report on front page to show all, unless a group is selected.
+                $attemptsmode = QUIZ_REPORT_ATTEMPTS_ALL;
+            }
             $detailedmarks = get_user_preferences('quiz_report_overview_detailedmarks', 1);
             $pagesize = get_user_preferences('quiz_report_pagesize', 0);
         }
@@ -92,9 +107,6 @@ class quiz_overview_report extends quiz_default_report {
         $displayoptions['attemptsmode'] = $attemptsmode;
         $displayoptions['qmfilter'] = $qmfilter;
 
-        /// find out current groups mode
-        $currentgroup = groups_get_activity_group($cm, true);
-
         //work out the sql for this table.
         if (!$students = get_users_by_capability($context, 'mod/quiz:attempt','','','','','','',false)){
             $students = array();