From: tjhunt Date: Fri, 6 Jul 2007 16:37:06 +0000 (+0000) Subject: MDL-10374 - Quiz layout improvements, selectively merged from OU-moodle. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=99a1bf3d9c59b06e0081114999afa862c892f9ce;p=moodle.git MDL-10374 - Quiz layout improvements, selectively merged from OU-moodle. --- diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index 367c3d7a47..51d2b41983 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -467,7 +467,6 @@ \n"; } /// Print all the questions @@ -479,9 +478,6 @@ foreach ($pagequestions as $i) { $options = quiz_get_renderoptions($quiz->review, $states[$i]); // Print the question - if ($i > 0) { - echo "
\n"; - } print_question($questions[$i], $states[$i], $number, $quiz, $options); save_question_session($questions[$i], $states[$i]); $number += $questions[$i]->length; @@ -503,9 +499,7 @@ // Print the navigation panel if required if ($numpages > 1) { - echo "
\n"; quiz_print_navigation_panel($page, $numpages); - echo '
'; } // Finish the form diff --git a/mod/quiz/attempt_close_js.php b/mod/quiz/attempt_close_js.php index 1d33058a80..3ba2d5b6dc 100644 --- a/mod/quiz/attempt_close_js.php +++ b/mod/quiz/attempt_close_js.php @@ -1,6 +1,6 @@ -
+
diff --git a/mod/quiz/review.php b/mod/quiz/review.php index c47b2dd6e3..fc60e8bb3f 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -148,6 +148,22 @@ } else { print_heading(format_string($quiz->name)); } + if ($isteacher and $attempt->userid == $USER->id) { + // the teacher is at the end of a preview. Print button to start new preview + unset($buttonoptions); + $buttonoptions['q'] = $quiz->id; + $buttonoptions['forcenew'] = true; + echo '
'; + print_single_button($CFG->wwwroot.'/mod/quiz/attempt.php', $buttonoptions, get_string('startagain', 'quiz')); + echo '
'; + } else { // print number of the attempt + print_heading(get_string('reviewofattempt', 'quiz', $attempt->attempt)); + } + + // print javascript button to close the window, if necessary + if (!$isteacher) { + include('attempt_close_js.php'); + } /// Print infobox @@ -167,14 +183,16 @@ } else { $timetaken = get_string('unfinished', 'quiz'); } - - $table->align = array("right", "left"); + echo ''; if ($attempt->userid <> $USER->id) { - $student = get_record('user', 'id', $attempt->userid); - $picture = print_user_picture($student->id, $course->id, $student->picture, false, true); - $table->data[] = array($picture, ''.fullname($student, true).''); + $student = get_record('user', 'id', $attempt->userid); + $picture = print_user_picture($student->id, $course->id, $student->picture, false, true); + echo ''; } - if (has_capability('mod/quiz:grade', $context) and count($attempts = get_records_select('quiz_attempts', "quiz = '$quiz->id' AND userid = '$attempt->userid'", 'attempt ASC')) > 1) { + if (has_capability('mod/quiz:grade', $context) and + count($attempts = get_records_select('quiz_attempts', "quiz = '$quiz->id' AND userid = '$attempt->userid'", 'attempt ASC')) > 1) { // print list of attempts $attemptlist = ''; foreach ($attempts as $at) { @@ -182,16 +200,20 @@ ? ''.$at->attempt.', ' : ''.$at->attempt.', '; } - $table->data[] = array(get_string('attempts', 'quiz').':', trim($attemptlist, ' ,')); + echo ''; } - $table->data[] = array(get_string('startedon', 'quiz').':', userdate($attempt->timestart)); + echo ''; if ($attempt->timefinish) { - $table->data[] = array("$strtimecompleted:", userdate($attempt->timefinish)); - $table->data[] = array("$strtimetaken:", $timetaken); + echo ''; + echo ''; } if (!empty($overtime)) { - $table->data[] = array("$stroverdue:", $overtime); + echo ''; } //if the student is allowed to see their score if ($options->scores) { @@ -206,30 +228,17 @@ $a->grade = $grade; $a->maxgrade = $quiz->grade; $rawscore = round($attempt->sumgrades, $CFG->quiz_decimalpoints); - $table->data[] = array("$strscore:", "$rawscore/$quiz->sumgrades ($percentage %)"); - $table->data[] = array("$strgrade:", get_string('outof', 'quiz', $a)); + echo ''; + echo ''; } } if ($options->overallfeedback && $feedback) { - $table->data[] = array(get_string('feedback', 'quiz'), $feedback); - } - if ($isteacher and $attempt->userid == $USER->id) { - // the teacher is at the end of a preview. Print button to start new preview - unset($buttonoptions); - $buttonoptions['q'] = $quiz->id; - $buttonoptions['forcenew'] = true; - echo '
'; - print_single_button($CFG->wwwroot.'/mod/quiz/attempt.php', $buttonoptions, get_string('startagain', 'quiz')); - echo '
'; - } else { // print number of the attempt - print_heading(get_string('reviewofattempt', 'quiz', $attempt->attempt)); - } - print_table($table); - - // print javascript button to close the window, if necessary - if (!$isteacher) { - include('attempt_close_js.php'); + echo ''; } + echo '
', $picture, '', + fullname($student, true), '
', get_string('attempts', 'quiz'), '', + trim($attemptlist, ' ,'), '
', get_string('startedon', 'quiz'), '', + userdate($attempt->timestart), '
', $strtimecompleted, '', + userdate($attempt->timefinish), '
', $strtimetaken, '', + $timetaken, '
', $stroverdue, '',$overtime, '
', $strscore, '', + "$rawscore/$quiz->sumgrades ($percentage %)", '
', $strgrade, '', + get_string('outof', 'quiz', $a), '
', get_string('feedback', 'quiz'), '', + $feedback, '
'; /// Print the navigation panel if required $numpages = quiz_number_of_pages($attempt->layout); @@ -255,9 +264,6 @@ $options->validation = QUESTION_EVENTVALIDATE === $states[$i]->event; $options->history = ($isteacher and !$attempt->preview) ? 'all' : 'graded'; // Print the question - if ($i > 0) { - echo "
\n"; - } print_question($questions[$i], $states[$i], $number, $quiz, $options); $number += $questions[$i]->length; } diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 0163650147..118627a64e 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -175,6 +175,8 @@ // Print table with existing attempts if ($attempts) { + print_heading('Summary of your previous attempts'); + // Work out which columns we need, taking account what data is available in each attempt. list($someoptions, $alloptions) = quiz_get_combined_reviewoptions($quiz, $attempts, $context); @@ -186,17 +188,18 @@ $overallfeedback = $feedbackcolumn && $alloptions->overallfeedback; // prepare table header + $table->class = 'generaltable quizattemptsummary'; $table->head = array($strattempt, $strtimecompleted); $table->align = array("center", "left"); $table->size = array("", ""); if ($markcolumn) { $table->head[] = "$strmarks / $quiz->sumgrades"; - $table->align[] = 'right'; + $table->align[] = 'center'; $table->size[] = ''; } if ($gradecolumn) { $table->head[] = "$strgrade / $quiz->grade"; - $table->align[] = 'right'; + $table->align[] = 'center'; $table->size[] = ''; } if ($feedbackcolumn) { @@ -216,7 +219,7 @@ $row = array(); // Add the attempt number, making it a link, if appropriate. - $row[] = make_review_link('#' . $attempt->attempt, $quiz, $attempt); + $row[] = make_review_link($attempt->attempt, $quiz, $attempt); // prepare strings for time taken and date completed $timetaken = ''; @@ -253,11 +256,10 @@ if ($gradecolumn) { if ($attemptoptions->scores) { + $formattedgrade = $attemptgrade; // highlight the highest grade if appropriate - if ($overallstats && !is_null($mygrade) && $attemptgrade == $mygrade && $quiz->grademethod == QUIZ_GRADEHIGHEST) { - $formattedgrade = "$attemptgrade"; - } else { - $formattedgrade = $attemptgrade; + if ($overallstats && $numattempts > 1 && !is_null($mygrade) && $attemptgrade == $mygrade && $quiz->grademethod == QUIZ_GRADEHIGHEST) { + $table->rowclass[$attempt->attempt] = 'bestrow'; } $row[] = make_review_link($formattedgrade, $quiz, $attempt); @@ -278,7 +280,7 @@ $row[] = $timetaken; } - $table->data[] = $row; + $table->data[$attempt->attempt] = $row; } // End of loop over attempts. print_table($table); } diff --git a/question/type/question.html b/question/type/question.html index 0ca5bbbe58..416e9ddede 100644 --- a/question/type/question.html +++ b/question/type/question.html @@ -16,11 +16,13 @@
- print_question_formulation_and_controls($question, $state, $cmoptions, $options); ?> -
- print_question_grading_details($question, $state, $cmoptions, $options); ?> -
- + print_question_formulation_and_controls($question, $state, $cmoptions, $options); + if ($generalfeedback) { ?> +
+ +
+
-
- -
- +
+ print_question_grading_details($question, $state, $cmoptions, $options); ?> +
- > + > - > + > diff --git a/theme/standard/styles_color.css b/theme/standard/styles_color.css index 5283681ebd..e1ffefd12e 100644 --- a/theme/standard/styles_color.css +++ b/theme/standard/styles_color.css @@ -761,8 +761,7 @@ table.message_search_results td { } .calculated .answer, .numerical .answer, -.shortanswer .answer, -.truefalse .answer { +.shortanswer .answer { background-color: #EEE; } .que .feedback { @@ -963,13 +962,16 @@ table.message_search_results td { *** Modules: Quiz ***/ -/* body#mod-quiz-report table#attempts td { - border-color: #dddddd; +table.quizattemptsummary .bestrow td { + background-color: #e8e8e8; } -body#mod-quiz-report table#attempts .r1 { - background-color: #eeeeee; + +table.quizreviewsummary th.cell { + background: #f0f0f0; +} +table.quizreviewsummary td.cell { + background: #fafafa; } - */ /*** *** Modules: Resource diff --git a/theme/standard/styles_ie6.css b/theme/standard/styles_ie6.css index 8f2d85dd43..72c7fd451f 100755 --- a/theme/standard/styles_ie6.css +++ b/theme/standard/styles_ie6.css @@ -47,4 +47,8 @@ form.mform input { form.mform textarea { margin-left: -10px; -} \ No newline at end of file +} + +.que .info { + margin-left: 0.6em; +} diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 400132642f..6e8b04055a 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -2418,22 +2418,27 @@ body#message-messages { .que { text-align: left; - margin: 10px auto 15px auto; + margin: 0 auto 1.8em auto; border: 1px solid; clear: both; } .que .info { float: left; - margin: 5px 0 5px 5px; + margin: 0.5em 0 0.5em 1.2em; width: 8%; } -.que .grade { - margin-top: 0.5em; -} .que .content { float: left; - margin: 5px 0 5px 5px; - width: 88%; + margin: 0.5em 1.2em 0.5em 0; + width: 85%; +} +.que.description .info { + display: none; +} +.que.description .content { + margin-left: 1.2em; + float: none; + width: auto; } .que .qtext { margin-bottom: 1.5em; @@ -2492,19 +2497,15 @@ body#message-messages { } .calculated .answer, .numerical .answer, -.shortanswer .answer, -.truefalse .answer { - padding: 0.3em 0 0.3em 0.3em; -} -.calculated .answer input, -.numerical .answer input, -.shortanswer .answer input { - width: 85%; +.shortanswer .answer { + padding: 0.3em; + width: auto; } .truefalse .answer span { float: left; clear: left; - padding: 0.2em 0; + padding: 0.3em; + width: 100%; } .que .grading, .que .comment, @@ -2513,6 +2514,9 @@ body#message-messages { .que .history { margin-top: 0.5em; } +.que .grade { + margin-top: 0.5em; +} .importerror { margin-top: 10px; @@ -3343,10 +3347,57 @@ body#mod-forum-search .introcontent { *** Modules: Quiz ***/ +#mod-quiz-view .quizinfo { + text-align: center; +} +#mod-quiz-view #page .quizgradefeedback, +#mod-quiz-view #page .quizattempt +{ + text-align: center; +} #mod-quiz-attempt #page { text-align: center; } +#mod-quiz-attempt .pagingbar { + margin: 1.5em auto; +} + +body#question-preview .quemodname, +body#question-preview .controls +{ + text-align: center; +} +body#question-preview .quemodname, body#question-preview .controls { + text-align: center; +} + +#mod-quiz-review #page .controls { + text-align: center; + margin: 1.5em auto; +} +#mod-quiz-review .pagingbar { + margin: 1.5em auto; +} +#mod-quiz-review .pagingbar { + margin: 1.5em auto; +} +table.quizreviewsummary { + margin-bottom: 1.8em; + width: 100%; +} +table.quizreviewsummary tr { +} +table.quizreviewsummary th.cell { + padding: 1px 0.5em 1px 1em; + font-weight: bold; + text-align: right; + width: 10em; +} +table.quizreviewsummary td.cell { + padding: 1px 1em 1px 0.5em; +} + #mod-quiz-edit #page .controls, #mod-quiz-edit #page .attemptsnotice { @@ -3358,11 +3409,10 @@ body#mod-forum-search .introcontent { #mod-quiz-edit #showbreaks { margin-top: 0.7em; } -body#question-preview .quemodname, -body#question-preview .controls -{ +.quizquestionlistcontrols { text-align: center; } + body#mod-quiz-report table#attempts, body#mod-quiz-report table#commands, body#mod-quiz-report table#itemanalysis @@ -3404,23 +3454,6 @@ body#mod-quiz-report table#attempts .picture { body#mod-quiz-report .controls { text-align: center; } -#mod-quiz-review #page .controls { - text-align: center; -} -#mod-quiz-view .quizinfo { - text-align: center; -} -#mod-quiz-view #page .quizgradefeedback, -#mod-quiz-view #page .quizattempt -{ - text-align: center; -} -.quizquestionlistcontrols { - text-align: center; -} -body#question-preview .quemodname, body#question-preview .controls { - text-align: center; -} /*** *** Modules: Resource