From: tjhunt Date: Thu, 11 Oct 2007 11:42:49 +0000 (+0000) Subject: MDL-9542 - Show final grades from new gradebook in Quiz UI - with help from Petr... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=14e66f3bebac8c587d08e14f92d6f8332c26161d;p=moodle.git MDL-9542 - Show final grades from new gradebook in Quiz UI - with help from Petr. Merged from MOODLE_19_STABLE. --- diff --git a/lang/en_utf8/grades.php b/lang/en_utf8/grades.php index 42dd9f36f8..0462ad9312 100644 --- a/lang/en_utf8/grades.php +++ b/lang/en_utf8/grades.php @@ -320,6 +320,7 @@ $string['overridesitedefaultgradedisplaytype'] = 'Override site defaults'; $string['overridesitedefaultgradedisplaytypehelp'] = 'Tick this checkbox to enable the overriding of the site defaults for the display of grades in the gradebook. This activates form elements allowing you to define the grade letters and boundaries of your choice.'; $string['overridden'] = 'Overridden'; $string['overriddenhelp'] = 'When on, the overridden flag prevents any future attempts to automatically adjust the value of the grade. This flag is often set internally by the gradebook, but can be switched on and off manually using this form element.'; +$string['overriddennotice'] = 'Your final grade from this activity was manually adjusted.'; $string['overallavg'] = 'Overall average'; $string['pctoftotalgrade'] = '%% of total grade'; $string['percent'] = 'Percent'; diff --git a/lang/en_utf8/quiz.php b/lang/en_utf8/quiz.php index c9b76e09e9..85a7159226 100644 --- a/lang/en_utf8/quiz.php +++ b/lang/en_utf8/quiz.php @@ -542,6 +542,7 @@ $string['stoponerror'] = 'Stop on error'; $string['subneterror'] = 'Sorry, this quiz has been locked so that it is only accessible from certain locations. Currently your computer is not one of those allowed to use this quiz.'; $string['subnetnotice'] = 'This quiz has been locked so that it is only accessible from certain locations. Your computer is not on an allowed subnet. As teacher you are allowed to preview anyway.'; $string['substitutedby'] = 'will be substituted by'; +$string['summaryofattempts'] = 'Summary of your previous attempts'; $string['temporaryblocked'] = 'You are temporarily not allowed to re-attempt the quiz.
You will be able to take another attempt on:'; $string['time'] = 'Time'; $string['timecompleted'] = 'Completed'; diff --git a/mod/quiz/styles.php b/mod/quiz/styles.php deleted file mode 100644 index 861647d565..0000000000 --- a/mod/quiz/styles.php +++ /dev/null @@ -1,102 +0,0 @@ -body#mod-quiz-report table#itemanalysis { - margin: 20px auto; -} -body#mod-quiz-report table#itemanalysis .header, -body#mod-quiz-report table#itemanalysis .cell -{ - padding: 4px; -} -body#mod-quiz-report table#itemanalysis .header .commands { - display: inline; -} -body#mod-quiz-report table#itemanalysis td { - border-width: 1px; - border-style: solid; -} -body#mod-quiz-report table#itemanalysis .header { - text-align: left; -} -body#mod-quiz-report table#itemanalysis .numcol { - text-align: center; - vertical-align : middle !important; -} - -body#mod-quiz-report table#itemanalysis .uncorrect { - color: red; -} - -body#mod-quiz-report table#itemanalysis .correct { - color: blue; - font-weight : bold; -} - -body#mod-quiz-report table#itemanalysis .partialcorrect { - color: green !important; -} - -body#mod-quiz-report table#itemanalysis .qname { - color: green !important; -} - -/* manual grading */ -body#mod-quiz-grading table#grading -{ - width: 80%; - margin: auto; -} - -body#mod-quiz-grading table#grading -{ - margin: 20px auto; -} - -body#mod-quiz-grading table#grading .header, -body#mod-quiz-grading table#grading .cell -{ - padding: 4px; -} - -body#mod-quiz-grading table#grading .header .commands -{ - display: inline; -} - -body#mod-quiz-grading table#grading .picture -{ - width: 40px; -} - -body#mod-quiz-grading table#grading td -{ - border-left-width: 1px; - border-right-width: 1px; - border-left-style: solid; - border-right-style: solid; - vertical-align: bottom; -} - -.mod-quiz .quiz-report-title { - text-align: center; - font-weight : bold; -} - -.mod-quiz .gradingdetails { - font-size: small; -} - -#mod-quiz-attempt #page { - text-align: center; -} - -#mod-quiz-attempt #timer .generalbox { - width:150px -} - -#mod-quiz-attempt #timer { - position:absolute; - /*top:100px; is set by js*/ - left:10px -} -#question-preview .essay .answer textarea { - width: 400px; -} diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 36cf5bc041..0c80da7525 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -3,10 +3,11 @@ // This page prints a particular instance of quiz require_once("../../config.php"); - require_once("locallib.php"); require_once($CFG->libdir.'/blocklib.php'); - require_once('pagelib.php'); - + require_once($CFG->libdir.'/gradelib.php'); + require_once($CFG->dirroot.'/mod/quiz/locallib.php'); + require_once($CFG->dirroot.'/mod/quiz/pagelib.php'); + if (!empty($THEME->customcorners)) { require_once($CFG->dirroot.'/lib/custom_corners_lib.php'); } @@ -160,12 +161,27 @@ } $numattempts = count($attempts); + // Work out the final grade, checking whether it was overridden in the gradebook. $mygrade = quiz_get_best_grade($quiz, $USER->id); + $mygradeoverridden = false; + $gradebookfeedback = ''; + + $grading_info = grade_get_grades($course->id, 'mod', 'quiz', $quiz->id, $USER->id); + $item = $grading_info->items[0]; + $grade = $item->grades[$USER->id]; + if ($grade->overridden) { + $mygrade = $grade->grade + 0; // Convert to number. + $mygradeoverridden = true; + } + if (!empty($grade->str_feedback)) { + $gradebookfeedback = $grade->str_feedback; + } + // Print table with existing attempts if ($attempts) { - print_heading('Summary of your previous attempts'); + print_heading(get_string('summaryofattempts', 'quiz')); // Get some strings. $strattempt = get_string("attempt", "quiz"); @@ -294,23 +310,39 @@ } if ($numattempts && $quiz->sumgrades && !is_null($mygrade)) { + $resultinfo = ''; + if ($overallstats) { if ($available && $moreattempts) { $a = new stdClass; $a->method = quiz_get_grading_option_name($quiz->grademethod); $a->mygrade = $mygrade; $a->quizgrade = $quiz->grade; - print_heading(get_string('gradesofar', 'quiz', $a)); + $resultinfo .= print_heading(get_string('gradesofar', 'quiz', $a), '', 2, 'main', true); } else { - print_heading(get_string('yourfinalgradeis', 'quiz', "$mygrade / $quiz->grade")); + $resultinfo .= print_heading(get_string('yourfinalgradeis', 'quiz', "$mygrade / $quiz->grade"), '', 2, 'main', true); + if ($mygradeoverridden) { + $resultinfo .= '

'.get_string('overriddennotice', 'grades').'

'; + } } } + if ($gradebookfeedback) { + $resultinfo .= print_heading(get_string('comment', 'quiz'), '', 3, 'main', true); + $resultinfo .= '

'.$gradebookfeedback.'

'; + } if ($overallfeedback) { - echo '

'.quiz_feedback_for_grade($mygrade, $quiz->id).'

'; + $resultinfo .= print_heading(get_string('overallfeedback', 'quiz'), '', 3, 'main', true); + $resultinfo .= '

'.quiz_feedback_for_grade($mygrade, $quiz->id).'

'; + } + + if ($resultinfo) { + print_box($resultinfo, 'generalbox', 'feedback'); } } + + // Print a button to start/continue an attempt, if appropriate. if (!$quiz->questions) { print_heading(get_string("noquestions", "quiz")); diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 1ef3987f42..850cf1de55 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -3799,6 +3799,25 @@ body#mod-forum-search .introcontent { { text-align: center; } +#mod-quiz-view #page .quizattemptsummary td p { + margin-top: 0; +} +#mod-quiz-view .generalbox#feedback { + width:70%; + margin-left:auto; + margin-right:auto; + padding-bottom:15px; +} +#mod-quiz-view .generalbox#feedback h2 { + margin: 0 0; +} +body#mod-quiz-view .generalbox#feedback .overriddennotice { + text-align: center; + font-size: 0.7em; +} +#mod-quiz-view .generalbox#feedback h3 { + text-align: left; +} .generalbox#passwordbox { /* Should probably match .generalbox#intro above */ width:70%; @@ -3814,6 +3833,19 @@ body#mod-forum-search .introcontent { #mod-quiz-attempt .pagingbar { margin: 1.5em auto; } +#mod-quiz-attempt #page { + text-align: center; +} + +#mod-quiz-attempt #timer .generalbox { + width:150px +} + +#mod-quiz-attempt #timer { + position:absolute; + /*top:100px; is set by js*/ + left:10px +} body#question-preview .quemodname, body#question-preview .controls @@ -3888,48 +3920,128 @@ table.quizreviewsummary td.cell { text-align: center; } -body#mod-quiz-report table#attempts, -body#mod-quiz-report table#commands, -body#mod-quiz-report table#itemanalysis +#mod-quiz-report table#attempts, +#mod-quiz-report table#commands, +#mod-quiz-report table#itemanalysis { width: 80%; margin: auto; } -body#mod-quiz-report table#attempts, -body#mod-quiz-report h2.main { +#mod-quiz-report table#attempts, +#mod-quiz-report h2.main { clear: both; } -body#mod-quiz-report table#attempts { +#mod-quiz-report table#attempts { margin: 20px auto; } -body#mod-quiz-report table#attempts .header, -body#mod-quiz-report table#attempts .cell +#mod-quiz-report table#attempts .header, +#mod-quiz-report table#attempts .cell { padding: 4px; } -body#mod-quiz-report table#attempts .header .commands { +#mod-quiz-report table#attempts .header .commands { display: inline; } -body#mod-quiz-report table#attempts .picture { +#mod-quiz-report table#attempts .picture { width: 40px; } -body#mod-quiz-report table#attempts td { +#mod-quiz-report table#attempts td { border-left-width: 1px; border-right-width: 1px; border-left-style: solid; border-right-style: solid; vertical-align: middle; } -body#mod-quiz-report table#attempts .header { +#mod-quiz-report table#attempts .header { text-align: left; } -body#mod-quiz-report table#attempts .picture { +#mod-quiz-report table#attempts .picture { text-align: center !important; } -body#mod-quiz-report .controls { +#mod-quiz-report .controls { text-align: center; } +#mod-quiz-report table#itemanalysis { + margin: 20px auto; +} +#mod-quiz-report table#itemanalysis .header, +#mod-quiz-report table#itemanalysis .cell +{ + padding: 4px; +} +#mod-quiz-report table#itemanalysis .header .commands { + display: inline; +} +#mod-quiz-report table#itemanalysis td { + border-width: 1px; + border-style: solid; +} +#mod-quiz-report table#itemanalysis .header { + text-align: left; +} +#mod-quiz-report table#itemanalysis .numcol { + text-align: center; + vertical-align : middle !important; +} + +#mod-quiz-report table#itemanalysis .uncorrect { + color: red; +} + +#mod-quiz-report table#itemanalysis .correct { + color: blue; + font-weight : bold; +} + +#mod-quiz-report table#itemanalysis .partialcorrect { + color: green !important; +} + +#mod-quiz-report table#itemanalysis .qname { + color: green !important; +} + +/* manual grading */ +#mod-quiz-grading table#grading +{ + width: 80%; + margin: auto; +} + +#mod-quiz-grading table#grading +{ + margin: 20px auto; +} + +#mod-quiz-grading table#grading .header, +#mod-quiz-grading table#grading .cell +{ + padding: 4px; +} + +#mod-quiz-grading table#grading .header .commands +{ + display: inline; +} + +#mod-quiz-grading table#grading .picture +{ + width: 40px; +} + +#mod-quiz-grading table#grading td +{ + border-left-width: 1px; + border-right-width: 1px; + border-left-style: solid; + border-right-style: solid; + vertical-align: bottom; +} + +.mod-quiz .gradingdetails { + font-size: small; +} /*** *** Modules: Resource ***/