Merged from 1.9 branch.
$string['allattempts'] = 'Show all attempts';
+$string['allattemptscontributetograde'] = 'All attempts contribute to final grade for user.';
$string['allstudents'] = 'Show all $a';
$string['attemptsonly'] = 'Show $a with attempts only';
$string['attemptsprepage'] = 'Attempts shown per page';
$string['deleteselected'] = 'Delete selected attempts';
+$string['highlightinggraded'] = 'The user attempt that contributes to final grade is highlighted.';
$string['noattemptsonly'] = 'Show $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['preferencessave'] = 'Save preferences';
$string['preferencesuser'] = 'Your preferences for this report';
$string['show'] = 'Show';
+$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 marks for each question';
?>
$pageoptions['mode'] = 'overview';
$reporturl = new moodle_url($CFG->wwwroot.'/mod/quiz/report.php', $pageoptions);
- $qmsubselect = quiz_report_qm_filter_subselect($quiz->grademethod);
+ $qmsubselect = quiz_report_qm_filter_subselect($quiz);
$mform = new mod_quiz_report_overview_settings($reporturl, compact('qmsubselect'));
if ($fromform = $mform->get_data()){
$attemptsmode = $fromform->attemptsmode;
}
}
+ // Print information on the grading method and whether we are displaying
+ //
+ if (!$download) { //do not print notices when downloading
+ if ($strattempthighlight = quiz_report_highlighting_grading_method($quiz, $qmsubselect, $qmfilter)) {
+ echo '<div class="quizattemptcounts">' . $strattempthighlight . '</div>';
+ }
+ }
+
// Now check if asked download of data
if ($download) {
$filename = clean_filename("$course->shortname ".format_string($quiz->name,true));
* one attempt that will be graded for each user. Or return
* empty string if all attempts contribute to final grade.
*/
-function quiz_report_qm_filter_subselect($quizgrademethod){
+function quiz_report_qm_filter_subselect($quiz){
global $CFG;
+ if ($quiz->attempts == 1) {//only one attempt allowed on this quiz
+ return '';
+ }
$qmfilterattempts = true;
- switch ($quizgrademethod) {
+ switch ($quiz->grademethod) {
case QUIZ_GRADEHIGHEST :
$qmorderby = 'sumgrades DESC, timestart ASC';
break;
ksort($data);
return $data;
}
-
+function quiz_report_highlighting_grading_method($quiz, $qmsubselect, $qmfilter){
+ if ($quiz->attempts == 1) {//only one attempt allowed on this quiz
+ return "<p>".get_string('onlyoneattemptallowed', "quiz_overview")."</p>";
+ } else if (!$qmsubselect){
+ return "<p>".get_string('allattemptscontributetograde', "quiz_overview")."</p>";
+ } else if ($qmfilter){
+ return "<p>".get_string('showinggraded', "quiz_overview")."</p>";
+ }else {
+ return "<p>".get_string('showinggradedandungraded', "quiz_overview",
+ ('<span class="highlight">'.quiz_get_grading_option_name($quiz->grademethod).'</span>'))."</p>";
+ }
+}
?>
\ No newline at end of file