$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';
$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\'';
?>
//-------------------------------------------------------------------------------
$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']){
$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){
$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);
}
$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();