Permalink
Browse files

MDL-20636 Convverted html to html::writer and code checked

  • Loading branch information...
1 parent 88c7e2a commit 37015e0cd1f4e430ec59336aea2a3504c3129d65 Dean Lennard committed with timhunt May 9, 2011
Showing with 30 additions and 23 deletions.
  1. +20 −14 mod/quiz/renderer.php
  2. +10 −9 mod/quiz/view.php
View
@@ -422,22 +422,25 @@ public function view_page($course, $quiz, $cm, $context, $messages, $viewobj, $b
$output .= $this->view_attempt_button($course, $quiz, $cm, $context, $viewobj, $buttontext);
return $output;
}
-
- public function view_page_guest($course, $quiz, $cm, $context, $messages){
+
+ public function view_page_guest($course, $quiz, $cm, $context, $messages) {
$output = '';
$output .= $this->view_information($course, $quiz, $cm, $context, $messages);
- $output .= $this->confirm('<p>' . get_string('guestsno', 'quiz') . "</p>\n\n<p>" .
- get_string('liketologin') . "</p>\n", get_login_url(), get_referer(false));
+ $guestno = html_writer::tag('p', get_string('guestsno', 'quiz'));
+ $liketologin = html_writer::tag('p', get_string('liketologin'));
+ $output .= $this->confirm($guestno.'\n\n'.$liketologin.'\n', get_login_url(),
+ get_referer(false));
return $output;
}
-
- public function view_page_notenrolled($course, $quiz, $cm, $context, $messages){
+
+ public function view_page_notenrolled($course, $quiz, $cm, $context, $messages) {
global $CFG;
$output = '';
$output .= $this->view_information($course, $quiz, $cm, $context, $messages);
- $output .= $this->box('<p>' . get_string('youneedtoenrol', 'quiz') . "</p>\n\n<p>" .
- $this->continue_button($CFG->wwwroot . '/course/view.php?id=' . $course->id) .
- "</p>\n", 'generalbox', 'notice');
+ $youneedtoenrol = html_writer::tag('p', get_string('youneedtoenrol', 'quiz'));
+ $button = html_writer::tag('p',
+ $this->continue_button($CFG->wwwroot . '/course/view.php?id=' . $course->id));
+ $output .= $this->box($youneedtoenrol.'\n\n'.$button.'\n', 'generalbox', 'notice');
return $output;
}
@@ -459,7 +462,8 @@ private function view_information($course, $quiz, $cm, $context, $messages) {
if (has_capability('mod/quiz:viewreports', $context)) {
if ($strattemptnum = $this->quiz_attempt_summary_link_to_reports($quiz, $cm,
$context)) {
- $output .= '<div class="quizattemptcounts">' . $strattemptnum . "</div>\n";
+ $output .= html_writer::tag('div', $strattemptnum,
+ array('class' => 'quizattemptcounts'));
}
}
return $output;
@@ -636,8 +640,9 @@ private function view_result_info($quiz, $context, $cm, $viewobj) {
}
if ($viewobj->mygradeoverridden) {
- $resultinfo .= '<p class="overriddennotice">' .
- get_string('overriddennotice', 'grades') . "</p>\n";
+
+ $resultinfo .= html_writer::tag('p', get_string('overriddennotice', 'grades'),
+ array('class' => 'overriddennotice')).'\n';
}
if ($viewobj->gradebookfeedback) {
$resultinfo .= $this->heading(get_string('comment', 'quiz'), 3, 'main');
@@ -646,8 +651,9 @@ private function view_result_info($quiz, $context, $cm, $viewobj) {
}
if ($viewobj->feedbackcolumn) {
$resultinfo .= $this->heading(get_string('overallfeedback', 'quiz'), 3, 'main');
- $resultinfo .= '<p class="quizgradefeedback">' .
- quiz_feedback_for_grade($viewobj->mygrade, $quiz, $context, $cm)."</p>\n";
+ $resultinfo .= html_writer::tag('p',
+ quiz_feedback_for_grade($viewobj->mygrade, $quiz, $context, $cm),
+ array('class' => 'quizgradefeedback')).'\n';
}
if ($resultinfo) {
View
@@ -212,15 +212,16 @@
$output = $PAGE->get_renderer('mod_quiz');
echo $OUTPUT->header();
- // Guests can't do a quiz, so offer them a choice of logging in or going back.
- if (isguestuser()) {
- echo $output->view_page_guest($course, $quiz, $cm, $context, $messages, $viewobj);
- } elseif (!isguestuser() && !($viewobj->canattempt || $viewobj->canpreview || $viewobj->canreviewmine)) {
- // If they are not enrolled in this course in a good enough role, tell them to enrol.
- echo $output->view_page_notenrolled($course, $quiz, $cm, $context, $messages, $viewobj);
- } else {
- echo $output->view_page($course, $quiz, $cm, $context, $messages, $viewobj, $buttontext);
- }
+// Guests can't do a quiz, so offer them a choice of logging in or going back.
+if (isguestuser()) {
+ echo $output->view_page_guest($course, $quiz, $cm, $context, $messages, $viewobj);
+} else if (!isguestuser() && !($viewobj->canattempt || $viewobj->canpreview
+ || $viewobj->canreviewmine)) {
+ // If they are not enrolled in this course in a good enough role, tell them to enrol.
+ echo $output->view_page_notenrolled($course, $quiz, $cm, $context, $messages, $viewobj);
+} else {
+ echo $output->view_page($course, $quiz, $cm, $context, $messages, $viewobj, $buttontext);
+}
// Mark module as viewed (note, we do this here and not in finish_page,
// otherwise the 'not enrolled' error conditions would result in marking

0 comments on commit 37015e0

Please sign in to comment.