Lesson/MDL-13311: make it possible to have a short answer question using 0 as answer. (backport)

This commit is contained in:
scyrma
2008-10-07 05:18:08 +00:00
parent e875530645
commit ebf0aeec86
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -84,7 +84,9 @@
$studentanswer = s(stripslashes_safe($useranswer));
break;
case LESSON_SHORTANSWER :
if (!$useranswer = $_POST['answer']) {
if (isset($_POST['answer'])) {
$useranswer = $_POST['answer'];
} else {
$noanswer = true;
break;
}
+1 -1
View File
@@ -83,7 +83,7 @@
for ($i = 0; $i < $lesson->maxanswers; $i++) {
// strip tags because the editor gives <p><br />...
// also save any answers where the editor is (going to be) used
if ((!empty($form->answer[$i]) and trim(strip_tags($form->answer[$i]))) or isset($form->answereditor[$i]) or isset($form->responseeditor[$i])) {
if ((isset($form->answer[$i]) and (trim(strip_tags($form->answer[$i]))) != '') or isset($form->answereditor[$i]) or isset($form->responseeditor[$i])) {
if ($form->answerid[$i]) {
$oldanswer = new stdClass;
$oldanswer->id = clean_param($form->answerid[$i], PARAM_INT);