Skip to content

Commit

Permalink
quiz MDL-19813 Upgraded deprecated calls and called set_url with pre-…
Browse files Browse the repository at this point in the history
…generated var
  • Loading branch information
samhemelryk committed Oct 16, 2009
1 parent 261c6ef commit a09f21d
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 10 deletions.
9 changes: 9 additions & 0 deletions mod/quiz/addrandom.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
$quiz_page = optional_param('quiz_page', 0, PARAM_SEQUENCE);
$returnurl = optional_param('returnurl', 0, PARAM_LOCALURL);

$url = new moodle_url($CFG->wwwroot.'/mod/quiz/addrandom.php');
if ($quiz_page != 0) {
$url->param('quiz_page', $quiz_page);
}
if ($returnurl != 0) {
$url->param('returnurl', $returnurl);
}
$PAGE->set_url($url);

$strquizzes = get_string('modulenameplural', 'quiz');
$strquiz = get_string('modulename', 'quiz');
$streditingquestions = get_string('editquestions', 'quiz');
Expand Down
5 changes: 3 additions & 2 deletions mod/quiz/attempt.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@
$accessmanager->setup_secure_page($attemptobj->get_course()->shortname . ': ' .
format_string($attemptobj->get_quiz_name()), $headtags);
} elseif ($accessmanager->safebrowser_required($attemptobj->is_preview_user())) {
print_header($attemptobj->get_course()->shortname . ': '.
format_string($attemptobj->get_quiz_name()), '', '', '', $headtags, false, '', '', false, '');
$PAGE->set_title($attemptobj->get_course()->shortname . ': '.format_string($attemptobj->get_quiz_name()));
$PAGE->set_cacheable(false);
echo $OUTPUT->header();
} else {
$PAGE->set_title(format_string($attemptobj->get_quiz_name()));
$PAGE->set_button($attemptobj->update_module_button());
Expand Down
4 changes: 3 additions & 1 deletion mod/quiz/comment.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // $Id$
<?php
/**
* This page allows the teacher to enter a manual grade for a particular question.
* This page is expected to only be used in a popup window.
Expand All @@ -13,6 +13,8 @@
$attemptid = required_param('attempt', PARAM_INT); // attempt id
$questionid = required_param('question', PARAM_INT); // question id

$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/quiz/comment.php', array('attempt'=>$attemptid, 'question'=>$questionid)));

$attemptobj = new quiz_attempt($attemptid);

/// Can only grade finished attempts.
Expand Down
3 changes: 2 additions & 1 deletion mod/quiz/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // $Id$
<?php
/**
* This page lists all the instances of quiz in a particular course
*
Expand All @@ -10,6 +10,7 @@
require_once("locallib.php");

$id = required_param('id', PARAM_INT);
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/quiz/index.php', array('id'=>$id)));
if (!$course = $DB->get_record('course', array('id' => $id))) {
print_error('invalidcourseid');
}
Expand Down
4 changes: 3 additions & 1 deletion mod/quiz/review.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@
if ($accessmanager->securewindow_required($attemptobj->is_preview_user())) {
$accessmanager->setup_secure_page($attemptobj->get_course()->shortname.': '.format_string($attemptobj->get_quiz_name()), $headtags);
} elseif ($accessmanager->safebrowser_required($attemptobj->is_preview_user())) {
print_header($attemptobj->get_course()->shortname . ': '.format_string($attemptobj->get_quiz_name()), '', '', '', $headtags, false, '', '', false, '');
$PAGE->set_title($attemptobj->get_course()->shortname . ': '.format_string($attemptobj->get_quiz_name()));
$PAGE->set_cacheable(false);
echo $OUTPUT->header();
} else {
$attemptobj->navigation($strreviewtitle);
$PAGE->set_title(format_string($attemptobj->get_quiz_name()));
Expand Down
8 changes: 7 additions & 1 deletion mod/quiz/reviewquestion.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // $Id$
<?php
/**
* This page prints a review of a particular question attempt.
* This page is expected to only be used in a popup window.
Expand All @@ -15,6 +15,12 @@
$questionid = required_param('question', PARAM_INT); // question id
$stateid = optional_param('state', 0, PARAM_INT); // state id

$url = new moodle_url($CFG->wwwroot.'/mod/quiz/reviewquestion.php', array('attempt'=>$attemptid,'question'=>$questionid));
if ($stateid !== 0) {
$url->param('state', $stateid);
}
$PAGE->set_url($url);

$attemptobj = new quiz_attempt($attemptid);

/// Check login.
Expand Down
10 changes: 7 additions & 3 deletions mod/quiz/summary.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // $Id$
<?php
/**
* This page prints a summary of a quiz attempt before it is submitted.
*
Expand All @@ -11,6 +11,9 @@
require_once($CFG->dirroot . '/mod/quiz/locallib.php');

$attemptid = required_param('attempt', PARAM_INT); // The attempt to summarise.

$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/quiz/summary.php', array('attempt'=>$attemptid)));

$attemptobj = new quiz_attempt($attemptid);

/// Check login.
Expand Down Expand Up @@ -50,8 +53,9 @@
$accessmanager->setup_secure_page($attemptobj->get_course()->shortname . ': ' .
format_string($attemptobj->get_quiz_name()), '');
} elseif ($accessmanager->safebrowser_required($attemptobj->is_preview_user())) {
print_header($attemptobj->get_course()->shortname . ': '.
format_string($attemptobj->get_quiz_name()), '', '', '', '', false, '', '', false, '');
$PAGE->set_title($attemptobj->get_course()->shortname . ': '.format_string($attemptobj->get_quiz_name()));
$PAGE->set_cacheable(false);
echo $OUTPUT->header();
} else {
$attemptobj->navigation($title);
$PAGE->set_title(format_string($attemptobj->get_quiz_name()));
Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
// The code will be much nicer than this eventually.
$title = $course->shortname . ': ' . format_string($quiz->name);

$buttons = '<table><tr><td>'.update_module_button($cm->id, $course->id, get_string('modulename', 'quiz')).'</td>';
$buttons = '<table><tr><td>'.$OUTPUT->update_module_button($cm->id, $cm->modname).'</td>';
if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) {
$buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
'<input type="hidden" name="id" value="'.$cm->id.'" />'.
Expand Down

0 comments on commit a09f21d

Please sign in to comment.