mod-quiz MDL-19813 Updated print_header and build_navigation to OUTPUT and PAGE equivalents

This commit is contained in:
samhemelryk 2009-09-07 02:11:54 +00:00
parent 105ce17ab6
commit 2698e9c1ac
9 changed files with 24 additions and 19 deletions

View File

@ -226,7 +226,7 @@ class quiz_access_manager {
global $CFG, $OUTPUT;
$url = $this->_quizobj->view_url();
if ($this->securewindow_required($canpreview)) {
print_header();
echo $OUTPUT->header();
echo $OUTPUT->box_start();
if ($message) {
echo '<p>' . $message . '</p><p>' . get_string('windowclosing', 'quiz') . '</p>';
@ -599,7 +599,7 @@ class password_access_rule extends quiz_access_rule_base {
* @return mixed return null, unless $return is true, and a form needs to be displayed.
*/
public function do_password_check($canpreview, $accessmanager, $return = false) {
global $CFG, $SESSION, $OUTPUT;
global $CFG, $SESSION, $OUTPUT, $PAGE;
/// We have already checked the password for this quiz this session, so don't ask again.
if (!empty($SESSION->passwordcheckedquizzes[$this->_quiz->id])) {
@ -623,7 +623,8 @@ class password_access_rule extends quiz_access_rule_base {
/// Start the page and print the quiz intro, if any.
if (!$return) {
print_header('', '', '', 'quizpassword');
$PAGE->set_focuscontrol('quizpassword');
echo $OUTPUT->header();
}
if (trim(strip_tags($this->_quiz->intro))) {
$cm = get_coursemodule_from_id('quiz', $this->_quiz->id);
@ -744,11 +745,15 @@ class securewindow_access_rule extends quiz_access_rule_base {
*
* @param string $title HTML title tag content, passed to printheader.
* @param string $headtags extra stuff to go in the HTML head tag, passed to printheader.
* $headtags has been deprectaed since Moodle 2.0
*/
public function setup_secure_page($title, $headtags) {
public function setup_secure_page($title, $headtags=null) {
global $OUTPUT, $PAGE;
/// This prevents the message window coming up.
define('MESSAGE_WINDOW', true);
print_header($title, '', '', '', $headtags, false, '', '', false, '');
$PAGE->set_title($title);
$PAGE->set_cacheable(false);
echo $OUTPUT->header();
echo "\n\n", '<script type="text/javascript">';
/// This used to be in protect_js.php. I really don't understand this bit.
/// I have just moved it here for cleanliness reasons.

View File

@ -71,7 +71,7 @@ $strupdatemodule = '';
if (has_capability('moodle/course:manageactivities', $contexts->lowest())) {
$strupdatemodule = update_module_button($cm->id, $course->id, get_string('modulename', 'quiz'));
}
$navigation = build_navigation($streditingquiz, $cm);
$PAGE->navbar->add($streditingquiz);
print_header_simple($streditingquiz, '', $navigation, '', '', true, $strupdatemodule);
if (!$quizname = $DB->get_field($cm->modname, 'name', array('id' => $cm->instance))) {

View File

@ -334,7 +334,9 @@ class quiz {
* parameter.
*/
public function navigation($title) {
return build_navigation($title, $this->cm);
global $PAGE;
$PAGE->navbar->add($title);
return '';
}
// Private methods =====================================================================

View File

@ -35,7 +35,7 @@
$attemptobj->get_quizid(), $attemptobj->get_cmid());
/// Print the page header
print_header();
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($attemptobj->get_question($questionid)->name));
/// Process any data that was submitted.

View File

@ -443,8 +443,8 @@ $strupdatemodule = has_capability('moodle/course:manageactivities',
update_module_button($cm->id, $course->id,
get_string('modulename', 'quiz')) :
"";
$navigation = build_navigation($pagetitle, $cm);
$PAGE->navbar->add($pagetitle);
$PAGE->requires->skip_link_to('questionbank', get_string('skipto', 'access', get_string('questionbank', 'question')));
$PAGE->requires->skip_link_to('quizcontentsblock', get_string('skipto', 'access', get_string('questionsinthisquiz', 'quiz')));

View File

@ -30,10 +30,7 @@
</div>
</form>";
}
$navlinks = array();
$navlinks[] = array('name' => $strquizzes, 'link' => '', 'type' => 'activity');
$navigation = build_navigation($navlinks);
$PAGE->navbar->add($strquizzes);
print_header_simple($strquizzes, '', $navigation,
'', '', true, $streditquestions, navmenu($course));

View File

@ -27,7 +27,6 @@ class quiz_default_report {
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
/// Print the page header
$navigation = build_navigation('', $cm);
print_header_simple(format_string($quiz->name), "", $navigation,
'', '', true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));

View File

@ -62,9 +62,9 @@
$attemptobj->get_quizid(), $attemptobj->get_cmid());
/// Print the page header
$headtags = $attemptobj->get_question_html_head_contributions($questionid);
print_header('', '', '', '', $headtags);
$attemptobj->get_question_html_head_contributions($questionid);
echo $OUTPUT->header();
echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
/// Print infobox

View File

@ -83,8 +83,10 @@
}
$buttons .= '</tr></table>';
$navigation = build_navigation(array(), $cm);
print_header($title, $course->fullname, $navigation, '', '', true, $buttons, navmenu($course, $cm), false, $bodytags);
$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);
$PAGE->set_button($buttons);
echo $OUTPUT->header();
/// Print heading and tabs (if there is more than one).
$currenttab = 'info';