* @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));
}
$table->data[] = array("<b>$questiontext</b>", $answertext);
}
- print_table($table);
+ echo $OUTPUT->table($table);
} else {
* @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),
- "<a href=\"report.php?action=student&student=$a->id&id=$cmid\">".fullname($a)."</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);
}
/**
echo "</a></p>";
} else {
- $table = NULL;
+ $table = new html_table();
$table->head = array($question->text);
$table->align = array ("left");
$table->data[] = array($contents);
- print_table($table);
+ echo $OUTPUT->table($table);
print_spacer(30);
}
}
$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, "", "", "", "");
} 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),
"<a href=\"report.php?id=$id&action=student&student=$a->userid\">".fullname($a)."</a>",
userdate($a->time),
$answer1, $answer2);
}
}
- print_table($table);
+ echo $OUTPUT->table($table);
break;
}
echo "<p <p class=\"centerpara\">";
- print_user_picture($user->id, $course->id, $user->picture, true);
+ echo $OUTPUT->user_picture(moodle_user_picture::make($user->id, $course->id));
echo "</p>";
$questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions));
$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);
}
}
}
echo '<p class="centerpara">'.get_string("downloadinfo", "survey").'</p>';
- echo '<div class="reportbuttons">';
- $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 '</div>';
+ echo $OUTPUT->button(html_form::make_button("download.php", $options, get_string("downloadtext")));
+ echo $OUTPUT->container_end();
break;