Some changes to add format_text() to answers
and feedback across all the module. Note: Essay questions and their teacher's feedback. I'm not pretty sure it they should support the format_text() too. And currently, they are cleaned at input, so it is impossible to write <lang> or <span> tags with them!
This commit is contained in:
+13
-10
@@ -270,6 +270,9 @@
|
||||
|
||||
**************************************************************************/
|
||||
else if ($action == 'detail') {
|
||||
|
||||
$formattextdefoptions->para = false; //I'll use it widely in this page
|
||||
|
||||
$userid = optional_param('userid', NULL, PARAM_INT); // if empty, then will display the general detailed view
|
||||
$try = optional_param('try', NULL, PARAM_INT);
|
||||
|
||||
@@ -407,7 +410,7 @@
|
||||
$answerdata = new stdClass;
|
||||
|
||||
$answerpage->title = format_string($page->title);
|
||||
$answerpage->contents = $page->contents;
|
||||
$answerpage->contents = format_text($page->contents);
|
||||
|
||||
// get the page qtype
|
||||
switch ($page->qtype) {
|
||||
@@ -517,9 +520,9 @@
|
||||
$data = "<input type=\"checkbox\" readonly=\"readonly\" name=\"answer[$i]\" value=\"0\" disabled=\"disabled\" />";
|
||||
}
|
||||
if (($answer->score > 0 && $lesson->custom) || (lesson_iscorrect($page->id, $answer->jumpto) && !$lesson->custom)) {
|
||||
$data .= "<font class=highlight>$answer->answer</font>";
|
||||
$data .= "<font class=highlight>".format_text($answer->answer,FORMAT_MOODLE,$formattextdefoptions)."</font>";
|
||||
} else {
|
||||
$data .= $answer->answer;
|
||||
$data .= format_text($answer->answer,FORMAT_MOODLE,$formattextdefoptions);
|
||||
}
|
||||
} else {
|
||||
if ($answer->id == $useranswer->answerid) {
|
||||
@@ -546,9 +549,9 @@
|
||||
$data = "<input type=\"checkbox\" readonly=\"readonly\" name=\"answer[$i]\" value=\"0\" disabled=\"disabled\" />";
|
||||
}
|
||||
if (($answer->score > 0 && $lesson->custom) || (lesson_iscorrect($page->id, $answer->jumpto) && !$lesson->custom)) {
|
||||
$data .= "<font class=\"highlight\">$answer->answer</font>";
|
||||
$data .= "<font class=\"highlight\">".format_text($answer->answer,FORMAT_MOODLE,$formattextdefoptions)."</font>";
|
||||
} else {
|
||||
$data .= $answer->answer;
|
||||
$data .= format_text($answer->answer,FORMAT_MOODLE,$formattextdefoptions);
|
||||
}
|
||||
}
|
||||
if (isset($pagestats[$page->id][$answer->id])) {
|
||||
@@ -655,12 +658,12 @@
|
||||
$answerdata->score = get_string("didnotreceivecredit", "lesson");
|
||||
}
|
||||
}
|
||||
$data = "<select disabled=\"disabled\"><option selected>$answer->answer</option></select>";
|
||||
$data = "<select disabled=\"disabled\"><option selected>".strip_tags(format_text($answer->answer,FORMAT_MOODLE,$formattextdefoptions))."</option></select>";
|
||||
if ($useranswer != NULL) {
|
||||
$userresponse = explode(",", $useranswer->useranswer);
|
||||
$data .= "<select disabled=\"disabled\"><option selected>".$answers[$userresponse[$i]]->response."</option></select>";
|
||||
$data .= "<select disabled=\"disabled\"><option selected>".strip_tags(format_string($answers[$userresponse[$i]]->response,FORMAT_PLAIN,$formattextdefoptions))."</option></select>";
|
||||
} else {
|
||||
$data .= "<select disabled=\"disabled\"><option selected>$answer->response</option></select>";
|
||||
$data .= "<select disabled=\"disabled\"><option selected>".strip_tags(format_string($answer->response,FORMAT_PLAIN,$formattextdefoptions))."</option></select>";
|
||||
}
|
||||
|
||||
if ($n == 2) {
|
||||
@@ -722,7 +725,7 @@
|
||||
$answerdata->answers[] = array($essayinfo->answer, $avescore);
|
||||
break;
|
||||
case LESSON_BRANCHTABLE :
|
||||
$data = "<input type=\"button\" name=\"$answer->id\" value=\"$answer->answer\" disabled=\"disabled\"> ";
|
||||
$data = "<input type=\"button\" name=\"$answer->id\" value=\"".strip_tags(format_text($answer->answer, FORMAT_MOODLE,$formattextdefoptions))."\" disabled=\"disabled\"> ";
|
||||
$data .= get_string("jumptsto", "lesson").": ";
|
||||
if ($answer->jumpto == 0) {
|
||||
$data .= get_string("thispage", "lesson");
|
||||
@@ -856,7 +859,7 @@
|
||||
$table->data[] = $modified;
|
||||
}
|
||||
if ($page->answerdata->response != NULL) {
|
||||
$table->data[] = array($fontstart.get_string("response", "lesson").": <br />".$fontend.$fontstart2.$page->answerdata->response.$fontend2, " ");
|
||||
$table->data[] = array($fontstart.get_string("response", "lesson").": <br />".$fontend.$fontstart2.format_text($page->answerdata->response,FORMAT_MOODLE,$formattextdefoptions).$fontend2, " ");
|
||||
}
|
||||
$table->data[] = array($page->answerdata->score, " ");
|
||||
print_table($table);
|
||||
|
||||
+13
-8
@@ -686,7 +686,8 @@
|
||||
foreach ($answers as $answer) {
|
||||
if ($answer->response != NULL) {
|
||||
echo "<tr><td align=\"right\">";
|
||||
echo "<b>$answer->answer: </b></td><td valign=\"bottom\">";
|
||||
$options->para = false;
|
||||
echo "<b>".format_text($answer->answer,FORMAT_MOODLE,$options).": </b></td><td valign=\"bottom\">";
|
||||
echo "<label for=\"response[$answer->id]\" class=\"hidden-label\">response[$answer->id]</label><select id=\"response[$answer->id]\" name=\"response[$answer->id]\">"; //CDC hidden label added.
|
||||
if (isset($USER->modattempts[$lesson->id])) {
|
||||
$selected = trim($answers[$useranswers[$t]]->response);
|
||||
@@ -743,9 +744,10 @@
|
||||
}
|
||||
}
|
||||
echo "<td align=\"center\"><table><tr>";
|
||||
$options->para=false;
|
||||
foreach ($otherjumps as $otherjump) {
|
||||
echo "<td><input type=\"button\" onclick=\"document.answerform.jumpto.value=$otherjump->jumpto;document.answerform.submit();\"".
|
||||
"value = \"$otherjump->answer\" /></td>";
|
||||
"value = \"".strip_tags(format_text($otherjump->answer,FORMAT_MOODLE,$options))."\" /></td>";
|
||||
}
|
||||
echo "</tr></table></td>";
|
||||
foreach ($nextprevious as $jump) {
|
||||
@@ -762,10 +764,11 @@
|
||||
echo "<tr><td><input type=\"button\" onclick=\"document.answerform.jumpto.value=$jump->jumpto;document.answerform.submit();\"".
|
||||
"value = \"$jump->answer\" /></td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$options->para = false;
|
||||
foreach ($otherjumps as $otherjump) {
|
||||
echo "<tr><td><input type=\"button\" onclick=\"document.answerform.jumpto.value=$otherjump->jumpto;document.answerform.submit();\"".
|
||||
"value = \"$otherjump->answer\" /></td></tr>";
|
||||
"value = \"".strip_tags(format_text($otherjump->answer,FORMAT_MOODLE,$options))."\" /></td></tr>";
|
||||
}
|
||||
foreach ($nextprevious as $jump) {
|
||||
if ($jump->jumpto == LESSON_PREVIOUSPAGE) {
|
||||
@@ -776,9 +779,10 @@
|
||||
}
|
||||
|
||||
/* if(!$lesson->slideshow) {
|
||||
$options->para = false;
|
||||
foreach ($answers as $answer) {
|
||||
echo "<tr><td align=\"center\">";
|
||||
echo "<input type=\"button\" value=\"$answer->answer\"";
|
||||
echo "<input type=\"button\" value=\"".strip_tags(format_text($answer->answer,FORMAT_MOODLE,$options))."\"";
|
||||
echo "onclick=\"document.answerform.jumpto.value=$answer->jumpto;document.answerform.submit();\" />";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
@@ -1411,6 +1415,7 @@
|
||||
$jumptitle = "<b>".get_string("notdefined", "lesson")."</b>";
|
||||
}
|
||||
}
|
||||
$jumptitle = format_string($jumptitle,true);
|
||||
/// CDC-FLAG ///
|
||||
if ($page->qtype == LESSON_MATCHING) {
|
||||
if ($i == 1) {
|
||||
@@ -1661,7 +1666,7 @@
|
||||
unset($table->data);
|
||||
|
||||
$table->head = array(get_string("comments", "lesson"));
|
||||
$table->data[] = array("<textarea id=\"answer\" name=\"response\" align=\"center\" rows=\"15\" cols=\"60\">".$essayinfo->response."</textarea>\n");
|
||||
$table->data[] = array("<textarea id=\"answer\" name=\"response\" rows=\"15\" cols=\"60\">".$essayinfo->response."</textarea>\n");
|
||||
if ($lesson->custom) {
|
||||
for ($i=$answer->score; $i>=0; $i--) {
|
||||
$options[$i] = $i;
|
||||
@@ -1779,10 +1784,10 @@
|
||||
$message .= $pages[$essay->pageid]->contents;
|
||||
$message .= "<br><br>";
|
||||
$message .= get_string('yourresponse', 'lesson').":<br>";
|
||||
$message .= $essayinfo->answer;
|
||||
$message .= format_text($essayinfo->answer);
|
||||
$message .= "<br><br>";
|
||||
$message .= get_string('commentswithname', 'lesson', $USER).":<br>";
|
||||
$message .= $essayinfo->response;
|
||||
$message .= format_text($essayinfo->response);
|
||||
$message .= "<br><br>";
|
||||
$grades = get_records_select("lesson_grades", "lessonid = $lesson->id and userid = $essay->userid", "completed", "*", $essay->retry, 1);
|
||||
$grade = current($grades);
|
||||
|
||||
Reference in New Issue
Block a user