From 3ab269ed442a21e3e7f3df2be0f2e7a3c60f8fc4 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Thu, 20 Aug 2009 08:45:33 +0000 Subject: [PATCH] MDL-19812 upgraded calls to print_table, print_single_button, print_user_picture, print_container* and notice_yesno --- mod/lesson/action/confirmdelete.php | 4 ++-- mod/lesson/edit.php | 4 ++-- mod/lesson/essay.php | 32 ++++++++++++++--------------- mod/lesson/highscores.php | 4 ++-- mod/lesson/index.php | 4 ++-- mod/lesson/lib.php | 3 ++- mod/lesson/report.php | 17 +++++++-------- 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/mod/lesson/action/confirmdelete.php b/mod/lesson/action/confirmdelete.php index 3e1608c6b5..0005cba643 100644 --- a/mod/lesson/action/confirmdelete.php +++ b/mod/lesson/action/confirmdelete.php @@ -25,7 +25,7 @@ echo $title."
\n"; } } - notice_yesno(get_string("confirmdeletionofthispage","lesson"), - "lesson.php?action=delete&id=$cm->id&pageid=$pageid&sesskey=".sesskey(), + echo $OUTPUT->confirm(get_string("confirmdeletionofthispage","lesson"), + "lesson.php?action=delete&id=$cm->id&pageid=$pageid", "view.php?id=$cm->id"); ?> diff --git a/mod/lesson/edit.php b/mod/lesson/edit.php index 308606ee4e..cdf71fdaac 100644 --- a/mod/lesson/edit.php +++ b/mod/lesson/edit.php @@ -62,7 +62,7 @@ switch ($mode) { case 'collapsed': - $table = new stdClass; + $table = new html_table(); $table->head = array(get_string('pagetitle', 'lesson'), get_string('qtype', 'lesson'), get_string('jumps', 'lesson'), get_string('actions', 'lesson')); $table->align = array('left', 'left', 'left', 'center'); $table->wrap = array('', 'nowrap', '', 'nowrap'); @@ -98,7 +98,7 @@ $pageid = $page->nextpageid; } - print_table($table); + echo $OUTPUT->table($table); break; case 'single': diff --git a/mod/lesson/essay.php b/mod/lesson/essay.php index a72a769363..d4f55a31c1 100644 --- a/mod/lesson/essay.php +++ b/mod/lesson/essay.php @@ -257,7 +257,7 @@ } // Setup table - $table = new stdClass; + $table = new html_table(); $table->head = array(get_string('name'), get_string('essays', 'lesson'), get_string('email', 'lesson')); $table->align = array('left', 'left', 'left'); $table->wrap = array('nowrap', 'nowrap', 'nowrap'); @@ -309,14 +309,14 @@ // email link for this user $emaillink = "wwwroot/mod/lesson/essay.php?id=$cm->id&mode=email&userid=$userid&sesskey=".sesskey().'">'.get_string('emailgradedessays', 'lesson').''; - $table->data[] = array(print_user_picture($userid, $course->id, $users[$userid]->picture, 0, true).$studentname, implode("
\n", $essaylinks), $emaillink); + $table->data[] = array($OUTPUT->user_picture(moodle_user_picture::make($users[$userid], $course->id)).$studentname, implode("
\n", $essaylinks), $emaillink); } // email link for all users $emailalllink = "wwwroot/mod/lesson/essay.php?id=$cm->id&mode=email&sesskey=".sesskey().'">'.get_string('emailallgradedessays', 'lesson').''; $table->data[] = array(' ', ' ', $emailalllink); - print_table($table); + echo $OUTPUT->table($table); break; case 'grade': // Grading form @@ -330,34 +330,34 @@ '; // All tables will have these settings - $table = new stdClass; - $table->align = array('left'); - $table->wrap = array(); - $table->width = '50%'; - $table->size = array('100%'); - $table->class = 'generaltable gradetable'; + $originaltable = new html_table(); + $originaltable->align = array('left'); + $originaltable->wrap = array(); + $originaltable->width = '50%'; + $originaltable->size = array('100%'); + $originaltable->add_class('generaltable gradetable'); // Print the question + $table = clone($originaltable); $table->head = array(get_string('question', 'lesson')); $options = new stdClass; $options->noclean = true; $table->data[] = array(format_text($page->contents, FORMAT_MOODLE, $options)); - print_table($table); - - unset($table->data); + echo $OUTPUT->table($table); // Now the user's answer $essayinfo = unserialize($attempt->useranswer); + $table = clone($originaltable); + $table = new html_table(); $table->head = array(get_string('studentresponse', 'lesson', fullname($user, true))); $table->data[] = array(s($essayinfo->answer)); - print_table($table); - - unset($table->data); + echo $OUTPUT->table($table); // Now a response box and grade drop-down for grader + $table = clone($originaltable); $table->head = array(get_string('comments', 'lesson')); $table->data[] = array(print_textarea(false, 15, 60, 0, 0, 'response', $essayinfo->response, $course->id, true)); $options = array(); @@ -373,7 +373,7 @@ $select->nothingvalue = ''; $table->data[] = array(get_string('essayscore', 'lesson').': '.$OUTPUT->select($select)); - print_table($table); + echo $OUTPUT->table($table); echo '
diff --git a/mod/lesson/highscores.php b/mod/lesson/highscores.php index 7a5a9c8097..d0569c4fd9 100644 --- a/mod/lesson/highscores.php +++ b/mod/lesson/highscores.php @@ -165,7 +165,7 @@ } krsort($topscores); - $table = new stdClass; + $table = new html_table(); $table->align = array('center', 'left', 'right'); $table->wrap = array(); $table->width = "30%"; @@ -188,7 +188,7 @@ break; } } - print_table($table); + echo $OUTPUT->table($table); } if (!has_capability('mod/lesson:manage', $context)) { // teachers don't need the links diff --git a/mod/lesson/index.php b/mod/lesson/index.php index b4a347576e..f81bf85c74 100644 --- a/mod/lesson/index.php +++ b/mod/lesson/index.php @@ -52,7 +52,7 @@ $strweek = get_string("week"); $strtopic = get_string("topic"); $strnodeadline = get_string("nodeadline", "lesson"); - $table = new stdClass; + $table = new html_table(); if ($course->format == "weeks") { $table->head = array ($strweek, $strname, $strgrade, $strdeadline); @@ -102,7 +102,7 @@ echo "
"; - print_table($table); + echo $OUTPUT->table($table); /// Finish the page diff --git a/mod/lesson/lib.php b/mod/lesson/lib.php index 024d1eef05..678c6ad94c 100644 --- a/mod/lesson/lib.php +++ b/mod/lesson/lib.php @@ -219,6 +219,7 @@ function lesson_user_complete($course, $user, $mod, $lesson) { if ($attempts = $DB->get_records_select("lesson_attempts", "lessonid = :lessonid AND userid = :userid", $params, "retry, timeseen")) { echo $OUTPUT->box_start(); + $table = new html_table(); $table->head = array (get_string("attempt", "lesson"), get_string("numberofpagesviewed", "lesson"), get_string("numberofcorrectanswers", "lesson"), get_string("time")); $table->width = "100%"; @@ -252,7 +253,7 @@ function lesson_user_complete($course, $user, $mod, $lesson) { if ($npages) { $table->data[] = array($retry + 1, $npages, $ncorrect, userdate($timeseen)); } - print_table($table); + echo $OUTPUT->table($table); echo $OUTPUT->box_end(); // also print grade summary $params = array ("lessonid" => $lesson->id, "userid" => $user->id); diff --git a/mod/lesson/report.php b/mod/lesson/report.php index fcf7f0092c..03f4103dd4 100644 --- a/mod/lesson/report.php +++ b/mod/lesson/report.php @@ -185,7 +185,8 @@ $lowscore = NULL; $hightime = NULL; $lowtime = NULL; - $table = new stdClass; + + $table = new html_table(); // set up the table object $table->head = array(get_string('name'), get_string('attempts', 'lesson'), get_string('highscore', 'lesson')); @@ -268,7 +269,7 @@ id\" />\n id\" />\n"; } - print_table($table); + echo $OUTPUT->table($table); if (has_capability('mod/lesson:edit', $context)) { echo '
'. @@ -325,7 +326,7 @@ $stattable->width = "90%"; $stattable->data[] = array($avescore.'%', $avetime, $highscore.'%', $lowscore.'%', $hightime, $lowtime); - print_table($stattable); + echo $OUTPUT->table($stattable); } /************************************************************************** this action is for a student detailed view and for the general detailed view @@ -822,7 +823,7 @@ } /// actually start printing something - $table = new stdClass; + $table = new html_table(); $table->wrap = array(); $table->width = "60%"; @@ -866,16 +867,16 @@ $gradeinfo = lesson_grade($lesson, $try, $user->id); - $table->data[] = array(get_string('name').':', print_user_picture($user->id, $course->id, $user->picture, 0, true).fullname($user, true)); + $table->data[] = array(get_string('name').':', $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id)).fullname($user, true)); $table->data[] = array(get_string("timetaken", "lesson").":", format_time($timetotake)); $table->data[] = array(get_string("completed", "lesson").":", userdate($completed)); $table->data[] = array(get_string('rawgrade', 'lesson').':', $gradeinfo->earned.'/'.$gradeinfo->total); $table->data[] = array(get_string("grade", "lesson").":", $grade."%"); } - print_table($table); + echo $OUTPUT->table($table); // Don't want this class for later tables - unset($table->class); + $table->set_classes(); echo "
"; } @@ -913,7 +914,7 @@ $table->data[] = array($fontstart.get_string("response", "lesson").":
".$fontend.$fontstart2.format_text($page->answerdata->response,FORMAT_MOODLE,$formattextdefoptions).$fontend2, " "); } $table->data[] = array($page->answerdata->score, " "); - print_table($table); + echo $OUTPUT->table($table); echo "
"; } } -- 2.39.5