From baef998bb99d63075fc4f276ce0abc13781b4182 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 14 Jul 2008 15:40:24 +0000 Subject: [PATCH] MDL-15622 - Add the quiz navigation panel to the review page Also, improve the styling a bit. --- mod/quiz/accessrules.php | 16 ++++++---- mod/quiz/attemptlib.php | 9 +++--- mod/quiz/review.php | 46 ++++++++++++++++++---------- theme/standard/styles_layout.css | 51 +++++++++++++++++++------------- 4 files changed, 77 insertions(+), 45 deletions(-) diff --git a/mod/quiz/accessrules.php b/mod/quiz/accessrules.php index 3c20926c85..82a8e40ee1 100644 --- a/mod/quiz/accessrules.php +++ b/mod/quiz/accessrules.php @@ -268,18 +268,24 @@ class quiz_access_manager { * * @param boolean $canpreview This affects whether we have to worry about secure window stuff. */ - public function print_finish_review_link($canpreview) { + public function print_finish_review_link($canpreview, $return = false) { global $CFG; + $output = ''; $url = $this->_quizobj->view_url(); - echo '
'; + $output .= '
'; if ($this->securewindow_required($canpreview)) { $url = addslashes_js(htmlspecialchars($url)); - echo '\n"; } else { - echo '' . get_string('finishreview', 'quiz') . "\n"; + $output .= '' . get_string('finishreview', 'quiz') . "\n"; + } + $output .= "
\n"; + if ($return) { + return $output; + } else { + echo $output; } - echo "
\n"; } /** diff --git a/mod/quiz/attemptlib.php b/mod/quiz/attemptlib.php index ac5d693f7a..b972db1522 100644 --- a/mod/quiz/attemptlib.php +++ b/mod/quiz/attemptlib.php @@ -615,7 +615,7 @@ class quiz_attempt extends quiz { } public function print_navigation_panel($panelclass, $page) { - $panel = new quiz_attempt_nav_panel($this, $this->get_review_options(), $page); + $panel = new $panelclass($this, $this->get_review_options(), $page); $panel->display(); } @@ -759,7 +759,8 @@ abstract class quiz_nav_panel_base { public function display() { $strquiznavigation = get_string('quiznavigation', 'quiz'); - $content = $this->get_question_buttons() . $this->get_end_bits(); + $content = $this->get_question_buttons() . '
' . + $this->get_end_bits() . '
'; print_side_block($strquiznavigation, $content, NULL, NULL, '', array('id' => 'quiznavigation'), $strquiznavigation); } } @@ -799,10 +800,10 @@ class quiz_review_nav_panel extends quiz_nav_panel_base { } protected function get_end_bits() { + $accessmanager = $this->attemptobj->get_access_manager(time()); $html = '' . get_string('showall', 'quiz') . ''; - $html .= '' . - get_string('finishreview', 'quiz') . ''; + $html .= $accessmanager->print_finish_review_link($this->attemptobj->is_preview_user(), true); return $html; } } diff --git a/mod/quiz/review.php b/mod/quiz/review.php index 2891daa15b..b5fd3f9071 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -94,10 +94,17 @@ } print_heading($strreviewtitle); -/// Finish review link. - if ($reviewofownattempt) { - $accessmanager->print_finish_review_link($attemptobj->is_preview_user()); - } +/// Print the navigation panel in a left column. + print_container_start(); + echo '
'; + $attemptobj->print_navigation_panel('quiz_review_nav_panel', $page); + echo '
'; + print_container_end(); + +/// Start the main column. + echo '
'; + print_container_start(); + echo skip_main_destination(); /// Summary table start ============================================================================ @@ -205,26 +212,35 @@ /// Summary table end ============================================================================== -/// Print the navigation panel if required - // TODO!!! - print_paging_bar($attemptobj->get_num_pages(), $page, 1, 'review.php?attempt='.$attempt->id.'&'); - echo ''; - /// Print all the questions if ($showall) { - $page = 'all'; + $thispage = 'all'; + $lastpage = true; + } else { + $thispage = $page; + $lastpage = $attemptobj->is_last_page($page); } - foreach ($attemptobj->get_question_ids($page) as $id) { + foreach ($attemptobj->get_question_ids($thispage) as $id) { $attemptobj->print_question($id); } - // print javascript button to close the window, if necessary - if ($reviewofownattempt) { +/// Print a link to the next page. + echo '
'; + if ($lastpage) { $accessmanager->print_finish_review_link($attemptobj->is_preview_user()); + } else { + link_arrow_right(get_string('next'), $attemptobj->review_url(0, $page + 1)); } + echo "
"; + + // End middle column. + print_container_end(); + echo '
'; + + echo ''; + echo '
'; + // Finish the page if ($accessmanager->securewindow_required($attemptobj->is_preview_user())) { print_footer('empty'); } else { diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 5df23df9e0..416fa34bf3 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -3817,22 +3817,23 @@ body#mod-forum-search .introcontent { #passwordform { margin: 1em 0; } -#mod-quiz-attempt #middle-column { +#mod-quiz-attempt #middle-column, +#mod-quiz-review #middle-column { text-align: center; -} -#mod-quiz-attempt .pagingbar { - margin: 1.5em auto; -} -#mod-quiz-attempt #middle-column { margin: 0 0 0 12.5em; } -#mod-quiz-attempt #left-column { +#mod-quiz-attempt #left-column, +#mod-quiz-review #left-column { width: 11.5em; float: left; } -#mod-quiz-attempt .submitbtns { +#mod-quiz-attempt .submitbtns, +#mod-quiz-review .submitbtns { text-align: left; } +#mod-quiz-summary .submitbtns { + margin-top: 1.5em; +} #mod-quiz-attempt #quiz-timer-outer { position: absolute; @@ -3858,8 +3859,8 @@ body#question-preview .quemodname, body#question-preview .controls { } #mod-quiz-attempt #page .controls, -#mod-quiz-review #page .controls, -#mod-quiz-review #page .finishreview { +#mod-quiz-summary #page .controls, +#mod-quiz-review #page .controls { text-align: center; margin: 8px auto; } @@ -3870,7 +3871,6 @@ body#question-preview .quemodname, body#question-preview .controls { margin: 1.5em auto; } table.quizreviewsummary { - margin-bottom: 1.8em; width: 100%; } table.quizreviewsummary tr { @@ -3883,6 +3883,7 @@ table.quizreviewsummary th.cell { } table.quizreviewsummary td.cell { padding: 1px 1em 1px 0.5em; + text-align: left; } #mod-quiz-mod #reviewoptionshdr .fitem { @@ -4055,24 +4056,32 @@ table.quizreviewsummary td.cell { margin: 6px 0; } -#quiznavigation input.qnbutton { +#quiznavigation .qnbutton { + float: left; + width: 1.5em; + height: 1.5em; + margin: 0.3em 0.3em 0.3em 0; border: 1px solid grey; background: white; font-weight: bold; - width: 1.5em; - height: 1.5em; - margin-right: 0.3em; - text-align: middle; + text-align: center; + vertical-align: middle; } -#quiznavigation input.qnbutton:hover { +#quiznavigation .qnbutton:hover { background: silver; + text-decoration: underline; } -#quiznavigation .qn_buttons { - margin: 0.2em; -} -#quiznavigation input.qnbutton.thispage { +#quiznavigation .qnbutton.thispage { background: #eee; } +#quiznavigation .othernav { + clear: both; +} +#quiznavigation .othernav a, +#quiznavigation .othernav input { + display: block; + margin: 0.5em 0; +} /*** *** Modules: Resource -- 2.39.5