MDL-15622 - Add the quiz navigation panel to the review page
Also, improve the styling a bit.
This commit is contained in:
@@ -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 '<div class="finishreview">';
|
||||
$output .= '<div class="finishreview">';
|
||||
if ($this->securewindow_required($canpreview)) {
|
||||
$url = addslashes_js(htmlspecialchars($url));
|
||||
echo '<input type="button" value="' . get_string('finishreview', 'quiz') . '" ' .
|
||||
$output .= '<input type="button" value="' . get_string('finishreview', 'quiz') . '" ' .
|
||||
"onclick=\"quiz_secure_window.close('$url', 0)\" />\n";
|
||||
} else {
|
||||
echo '<a href="' . $url . '">' . get_string('finishreview', 'quiz') . "</a>\n";
|
||||
$output .= '<a href="' . $url . '">' . get_string('finishreview', 'quiz') . "</a>\n";
|
||||
}
|
||||
$output .= "</div>\n";
|
||||
if ($return) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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() . '<div class="othernav">' .
|
||||
$this->get_end_bits() . '</div>';
|
||||
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 = '<a href="' . $this->attemptobj->review_url(0, 0, true) . '">' .
|
||||
get_string('showall', 'quiz') . '</a>';
|
||||
$html .= '<a href="' . $this->attemptobj->view_url() . '">' .
|
||||
get_string('finishreview', 'quiz') . '</a>';
|
||||
$html .= $accessmanager->print_finish_review_link($this->attemptobj->is_preview_user(), true);
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
+31
-15
@@ -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 '<div id="left-column">';
|
||||
$attemptobj->print_navigation_panel('quiz_review_nav_panel', $page);
|
||||
echo '</div>';
|
||||
print_container_end();
|
||||
|
||||
/// Start the main column.
|
||||
echo '<div id="middle-column">';
|
||||
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 '<div class="controls"><a href="review.php?attempt='.$attempt->id.'&showall=true">';
|
||||
print_string('showall', 'quiz');
|
||||
echo '</a></div>';
|
||||
|
||||
/// 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 '<div class="submitbtns">';
|
||||
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 "</div>";
|
||||
|
||||
// End middle column.
|
||||
print_container_end();
|
||||
echo '</div>';
|
||||
|
||||
echo '</div>';
|
||||
echo '<div class="clearer"></div>';
|
||||
|
||||
// Finish the page
|
||||
if ($accessmanager->securewindow_required($attemptobj->is_preview_user())) {
|
||||
print_footer('empty');
|
||||
} else {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user