From b621e1a006d4d858ecc14f121878310cd410bbf3 Mon Sep 17 00:00:00 2001 From: jamiesensei Date: Thu, 8 May 2008 09:35:08 +0000 Subject: [PATCH] MDL-14198 "Make it clear which student attempt gives the final grade, if the scoring method is first, last or highest score" adding a message about the highlighting above the table. Merged from 1.9 branch. --- lang/en_utf8/quiz_overview.php | 5 +++++ mod/quiz/report/overview/report.php | 10 +++++++++- mod/quiz/report/reportlib.php | 20 +++++++++++++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/lang/en_utf8/quiz_overview.php b/lang/en_utf8/quiz_overview.php index 0fa8ca95ab..1bb41d4156 100644 --- a/lang/en_utf8/quiz_overview.php +++ b/lang/en_utf8/quiz_overview.php @@ -3,11 +3,14 @@ $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'; @@ -22,5 +25,7 @@ $string['preferencespage'] = 'Preferences just for this page'; $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'; ?> diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 181c282c47..8b22adf37b 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -65,7 +65,7 @@ class quiz_report extends quiz_default_report { $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; @@ -117,6 +117,14 @@ class quiz_report extends quiz_default_report { } } + // 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 '
' . $strattempthighlight . '
'; + } + } + // Now check if asked download of data if ($download) { $filename = clean_filename("$course->shortname ".format_string($quiz->name,true)); diff --git a/mod/quiz/report/reportlib.php b/mod/quiz/report/reportlib.php index b6d069edfd..0ece6be428 100644 --- a/mod/quiz/report/reportlib.php +++ b/mod/quiz/report/reportlib.php @@ -78,10 +78,13 @@ function quiz_report_load_questions($quiz){ * 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; @@ -119,5 +122,16 @@ function quiz_report_grade_bands($bands, $quizid, $useridlist){ 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 "

".get_string('onlyoneattemptallowed', "quiz_overview")."

"; + } else if (!$qmsubselect){ + return "

".get_string('allattemptscontributetograde', "quiz_overview")."

"; + } else if ($qmfilter){ + return "

".get_string('showinggraded', "quiz_overview")."

"; + }else { + return "

".get_string('showinggradedandungraded', "quiz_overview", + (''.quiz_get_grading_option_name($quiz->grademethod).''))."

"; + } +} ?> \ No newline at end of file -- 2.39.5