diff --git a/mod/quiz/view.php b/mod/quiz/view.php
index 1a3831027a2..3d9034e4cee 100644
--- a/mod/quiz/view.php
+++ b/mod/quiz/view.php
@@ -4,9 +4,11 @@
require_once("../../config.php");
require_once("locallib.php");
+ require_once($CFG->dirroot.'/lib/blocklib.php');
optional_variable($id); // Course Module ID, or
optional_variable($q); // quiz ID
+ $edit = optional_param('edit', '');
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
@@ -44,18 +46,45 @@
$timenow = time();
+// Initialize $PAGE, compute blocks
+
+ $PAGE = page_create_object(PAGE_QUIZ_VIEW, $quiz->id);
+
+ if (!empty($blockaction)) {
+ $pageblocks = blocks_get_by_page($PAGE);
+ blocks_execute_url_action($PAGE, $pageblocks);
+ }
+
+ $pageblocks = blocks_get_by_page($PAGE);
+ $missingblocks = blocks_get_missing($PAGE, $pageblocks);
+
+ $blocks_preferred_width = blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]);
+ $blocks_preferred_width = max($blocks_preferred_width, 180);
+ $blocks_preferred_width = min($blocks_preferred_width, 210);
// Print the page header
+ if (!empty($edit) && $PAGE->user_allowed_editing()) {
+ if ($edit == 'on') {
+ $USER->editing = true;
+ } else if ($edit == 'off') {
+ $USER->editing = false;
+ }
+ }
+
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
$stredit = get_string('editquestions', 'quiz');
- if (isteacheredit($course->id)) {
+ if ($PAGE->user_allowed_editing()) {
$buttons = "
| ".
update_module_button($cm->id, $course->id, $strquiz).
- ' |
';
+ ''.
+ ' | ';
} else {
$buttons = '';
}
@@ -64,6 +93,20 @@
"id\">$strquizzes -> $quiz->name",
"", "", true, $buttons, navmenu($course, $cm));
+ echo '';
+ echo '';
+
+ if(blocks_have_content($pageblocks[BLOCK_POS_LEFT]) || $PAGE->user_is_editing()) {
+ echo '| ';
+ blocks_print_group($PAGE, $pageblocks[BLOCK_POS_LEFT]);
+ if (isediting($course->id) && !empty($missingblocks)) {
+ blocks_print_adminblock($PAGE, $missingblocks);
+ }
+ echo ' | ';
+ }
+
+ echo '';
+
if (isteacher($course->id)) {
$attemptcount = count_records_select("quiz_attempts", "quiz = '$quiz->id' AND timefinish > 0");
$usercount = count_records("quiz_grades", "quiz", "$quiz->id");
@@ -192,6 +235,8 @@
}
// Finish the page
+ echo ' |
';
+
print_footer($course);
function quiz_review_allowed($quiz) {