diff --git a/mod/survey/index.php b/mod/survey/index.php index 034b1dbd5c5..51b0b7502ba 100644 --- a/mod/survey/index.php +++ b/mod/survey/index.php @@ -32,6 +32,8 @@ notice(get_string('thereareno', 'moodle', $strsurveys), "../../course/view.php?id=$course->id"); } + $table = new html_table(); + if ($course->format == "weeks") { $table->head = array ($strweek, $strname, $strstatus); $table->align = array ("CENTER", "LEFT", "LEFT"); @@ -78,7 +80,7 @@ } echo "
"; - print_table($table); + echo $OUTPUT->table($table); echo $OUTPUT->footer(); ?> diff --git a/mod/survey/lib.php b/mod/survey/lib.php index 34902e457dc..55515a62f7a 100644 --- a/mod/survey/lib.php +++ b/mod/survey/lib.php @@ -170,11 +170,11 @@ function survey_user_outline($course, $user, $mod, $survey) { * @param object $survey */ function survey_user_complete($course, $user, $mod, $survey) { - global $CFG, $DB; + global $CFG, $DB, $OUTPUT; if (survey_already_done($survey->id, $user->id)) { if ($survey->template == SURVEY_CIQ) { // print out answers for critical incidents - $table = NULL; + $table = new html_table(); $table->align = array("left", "left"); $questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions)); @@ -191,7 +191,7 @@ function survey_user_complete($course, $user, $mod, $survey) { } $table->data[] = array("$questiontext", $answertext); } - print_table($table); + echo $OUTPUT->table($table); } else { @@ -463,19 +463,19 @@ function survey_count_responses($surveyid, $groupid, $groupingid) { * @param int $courseid */ function survey_print_all_responses($cmid, $results, $courseid) { - - $table = new object(); + global $OUTPUT; + $table = new html_table(); $table->head = array ("", get_string("name"), get_string("time")); $table->align = array ("", "left", "left"); $table->size = array (35, "", "" ); foreach ($results as $a) { - $table->data[] = array(print_user_picture($a->id, $courseid, $a->picture, false, true, false), - "id&id=$cmid\">".fullname($a)."", + $table->data[] = array($OUTPUT->user_picture(moodle_user_picture::make($a, $courseid)), + $OUTPUT->link("report.php?action=student&student=$a->id&id=$cmid", fullname($a)), userdate($a->time)); } - print_table($table); + echo $OUTPUT->table($table); } /** diff --git a/mod/survey/report.php b/mod/survey/report.php index 2f0fdff5db4..64bfc955760 100644 --- a/mod/survey/report.php +++ b/mod/survey/report.php @@ -236,7 +236,7 @@ echo "

"; } else { - $table = NULL; + $table = new html_table(); $table->head = array($question->text); $table->align = array ("left"); @@ -254,7 +254,7 @@ $table->data[] = array($contents); - print_table($table); + echo $OUTPUT->table($table); print_spacer(30); } } @@ -279,7 +279,7 @@ $strpreferred = get_string("preferred", "survey"); $strdateformat = get_string("strftimedatetime"); - $table = NULL; + $table = new html_table(); $table->head = array("", $strname, $strtime, $stractual, $strpreferred); $table->align = array ("left", "left", "left", "left", "right"); $table->size = array (35, "", "", "", ""); @@ -296,9 +296,10 @@ } else { $answer2 = " "; } - + $userpic = moodle_user_picture::make($a, $course->id); + $userpic->link = true; $table->data[] = array( - print_user_picture($a->userid, $course->id, $a->picture, false, true, true), + $OUTPUT->user_picture($userpic), "userid\">".fullname($a)."", userdate($a->time), $answer1, $answer2); @@ -306,7 +307,7 @@ } } - print_table($table); + echo $OUTPUT->table($table); break; @@ -346,7 +347,7 @@ } echo "

"; - print_user_picture($user->id, $course->id, $user->picture, true); + echo $OUTPUT->user_picture(moodle_user_picture::make($user->id, $course->id)); echo "

"; $questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions)); @@ -388,12 +389,12 @@ $question = $questions[$val]; if ($question->type == 0 or $question->type == 1) { if ($answer = survey_get_user_answer($survey->id, $question->id, $user->id)) { - $table = NULL; + $table = new html_table(); $table->head = array(get_string($question->text, "survey")); $table->align = array ("left"); $table->data[] = array(s($answer->answer1)); // no html here, just plain text - print_table($table); - print_spacer(30); + echo $OUTPUT->table($table); + echo $OUTPUT->spacer(30); } } } @@ -430,20 +431,20 @@ echo '

'.get_string("downloadinfo", "survey").'

'; - echo '
'; - $optons = array(); + echo $OUTPUT->container_start('reportbuttons'); + $options = array(); $options["id"] = "$cm->id"; $options["group"] = $currentgroup; $options["type"] = "ods"; - print_single_button("download.php", $options, get_string("downloadods")); + echo $OUTPUT->button(html_form::make_button("download.php", $options, get_string("downloadods"))); $options["type"] = "xls"; - print_single_button("download.php", $options, get_string("downloadexcel")); + echo $OUTPUT->button(html_form::make_button("download.php", $options, get_string("downloadexcel"))); $options["type"] = "txt"; - print_single_button("download.php", $options, get_string("downloadtext")); - echo '
'; + echo $OUTPUT->button(html_form::make_button("download.php", $options, get_string("downloadtext"))); + echo $OUTPUT->container_end(); break; diff --git a/mod/survey/view.php b/mod/survey/view.php index 89bfc558055..44691a87b54 100644 --- a/mod/survey/view.php +++ b/mod/survey/view.php @@ -90,11 +90,11 @@ $question = $questions[$val]; if ($question->type == 0 or $question->type == 1) { if ($answer = survey_get_user_answer($survey->id, $question->id, $USER->id)) { - $table = NULL; + $table = new html_table(); $table->head = array(get_string($question->text, "survey")); $table->align = array ("left"); $table->data[] = array(s($answer->answer1));//no html here, just plain text - print_table($table); + echo $OUTPUT->table($table); echo $OUTPUT->spacer(clone($spacer)) . '
'; } }