mod_quiz / navigation MDL-20276 replace make_active with override_active_url
It doesn't work, but I am committing it, so Sam H can take a look.
This commit is contained in:
@@ -209,9 +209,7 @@ class quiz_access_manager {
|
||||
public function print_start_attempt_button($canpreview, $buttontext, $unfinished) {
|
||||
global $OUTPUT;
|
||||
|
||||
$url = new moodle_url($this->_quizobj->start_attempt_url(),
|
||||
array('cmid' => $this->_quizobj->get_cmid()));
|
||||
$button = new single_button($url, $buttontext);
|
||||
$button = new single_button($this->_quizobj->start_attempt_url(), $buttontext);
|
||||
$button->class .= ' quizstartbuttondiv';
|
||||
|
||||
if (!$unfinished) {
|
||||
|
||||
@@ -53,11 +53,9 @@
|
||||
if (empty($attemptobj->get_quiz()->showblocks)) {
|
||||
$PAGE->blocks->show_only_fake_blocks();
|
||||
}
|
||||
|
||||
} else {
|
||||
$node = $PAGE->settingsnav->find('mod_quiz_preview', navigation_node::TYPE_SETTING);
|
||||
if ($node) {
|
||||
$node->make_active();
|
||||
}
|
||||
$PAGE->settingsnav->override_active_url($attemptobj->start_attempt_url());
|
||||
}
|
||||
|
||||
/// If the attempt is already closed, send them to the review page.
|
||||
|
||||
@@ -327,8 +327,8 @@ class quiz {
|
||||
* @return string the URL of this quiz's edit page. Needs to be POSTed to with a cmid parameter.
|
||||
*/
|
||||
public function start_attempt_url() {
|
||||
global $CFG;
|
||||
return $CFG->wwwroot . '/mod/quiz/startattempt.php';
|
||||
return new moodle_url('/mod/quiz/startattempt.php',
|
||||
array('cmid' => $this->cm->id, 'sesskey' => sesskey()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -780,7 +780,7 @@ class quiz_attempt extends quiz {
|
||||
public function print_restart_preview_button() {
|
||||
global $CFG, $OUTPUT;
|
||||
echo $OUTPUT->container_start('controls');
|
||||
$url = new moodle_url($this->start_attempt_url(), array('cmid' => $this->cm->id, 'forcenew' => true));
|
||||
$url = new moodle_url($this->start_attempt_url(), array('forcenew' => true));
|
||||
echo $OUTPUT->single_button($url, get_string('startagain', 'quiz'));
|
||||
echo $OUTPUT->container_end();
|
||||
}
|
||||
|
||||
@@ -163,8 +163,8 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
}
|
||||
if (!$this->table->is_downloading()) {
|
||||
// Only print headers if not asked to download data
|
||||
$node = $PAGE->navigation->find('quiz_report_statistics', null);
|
||||
$node->make_active();
|
||||
$PAGE->navigation->override_active_url(
|
||||
new moodle_url('/mod/quiz/report.php', array('id' => $cm->id, 'mode' => 'statistics')));
|
||||
$PAGE->navbar->add($thisquestion->name);
|
||||
$this->print_header_and_tabs($cm, $course, $quiz, 'statistics');
|
||||
}
|
||||
|
||||
+1
-4
@@ -78,10 +78,7 @@
|
||||
// Normal blocks
|
||||
$strreviewtitle = get_string('reviewofpreview', 'quiz');
|
||||
|
||||
$node = $PAGE->settingsnav->find('mod_quiz_preview', navigation_node::TYPE_SETTING);
|
||||
if ($node) {
|
||||
$node->make_active();
|
||||
}
|
||||
$PAGE->settingsnav->override_active_url($attemptobj->start_attempt_url());
|
||||
|
||||
} else {
|
||||
$strreviewtitle = get_string('reviewofattempt', 'quiz', $attemptobj->get_attempt_number());
|
||||
|
||||
@@ -30,10 +30,7 @@ if ($attemptobj->is_finished()) {
|
||||
}
|
||||
|
||||
if ($attemptobj->is_preview_user()) {
|
||||
$node = $PAGE->settingsnav->find('mod_quiz_preview', navigation_node::TYPE_SETTING);
|
||||
if ($node) {
|
||||
$node->make_active();
|
||||
}
|
||||
$PAGE->settingsnav->override_active_url($attemptobj->start_attempt_url());
|
||||
}
|
||||
|
||||
/// Check access.
|
||||
|
||||
Reference in New Issue
Block a user