mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
[Fix] Notices were being printed in PHP5 for NULL objects. Checking for NULL now before using in multichoice and truefalse questions
This commit is contained in:
parent
066c0af9bf
commit
718dbada67
@ -508,7 +508,11 @@
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_TRUEFALSE:
|
||||
if ($page->qoption) {
|
||||
$userresponse = explode(",", $useranswer->useranswer);
|
||||
if ($useranswer == NULL) {
|
||||
$userresponse = array();
|
||||
} else {
|
||||
$userresponse = explode(",", $useranswer->useranswer);
|
||||
}
|
||||
if (in_array($answer->id, $userresponse)) {
|
||||
// make checked
|
||||
$data = "<input readonly=\"readonly\" disabled=\"disabled\" name=\"answer[$i]\" checked=\"checked\" type=\"checkbox\" value=\"1\" />";
|
||||
@ -542,7 +546,7 @@
|
||||
$data .= format_text($answer->answer,FORMAT_MOODLE,$formattextdefoptions);
|
||||
}
|
||||
} else {
|
||||
if ($answer->id == $useranswer->answerid) {
|
||||
if ($useranswer != NULL and $answer->id == $useranswer->answerid) {
|
||||
// make checked
|
||||
$data = "<input readonly=\"readonly\" disabled=\"disabled\" name=\"answer[$i]\" checked=\"checked\" type=\"checkbox\" value=\"1\" />";
|
||||
if ($answer->response == NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user