diff --git a/mod/lesson/format.php b/mod/lesson/format.php index 34bc2523bf5..e40dcebc233 100644 --- a/mod/lesson/format.php +++ b/mod/lesson/format.php @@ -51,7 +51,7 @@ class quiz_default_format { $count++; echo "
$count. ".stripslashes($question->questiontext)."
"; - unset($newpage); + $newpage = new stdClass; $newpage->lessonid = $lesson->id; $newpage->qtype = $question->qtype; switch ($question->qtype) { diff --git a/mod/lesson/index.php b/mod/lesson/index.php index 2838cfc68d3..ba5641d2bf2 100644 --- a/mod/lesson/index.php +++ b/mod/lesson/index.php @@ -45,6 +45,7 @@ $strdeadline = get_string("deadline", "lesson"); $strweek = get_string("week"); $strtopic = get_string("topic"); + $table = new stdClass; if ($course->format == "weeks") { $table->head = array ($strweek, $strname, $strgrade, $strdeadline); diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index ba990c378f8..af921766379 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -137,7 +137,7 @@ function lesson_save_question_options($question) { // Insert all the new answers foreach ($question->answer as $key => $dataanswer) { if ($dataanswer != "") { - unset($answer); + $answer = new stdClass; $answer->lessonid = $question->lessonid; $answer->pageid = $question->id; if ($question->fraction[$key] >=0.5) { @@ -176,7 +176,7 @@ function lesson_save_question_options($question) { // for each answer store the pair of min and max values even if they are the same foreach ($question->answer as $key => $dataanswer) { if ($dataanswer != "") { - unset($answer); + $answer = new stdClass; $answer->lessonid = $question->lessonid; $answer->pageid = $question->id; $answer->jumpto = LESSON_NEXTPAGE; @@ -225,7 +225,7 @@ function lesson_save_question_options($question) { } // the lie - unset($answer); + $answer = new stdClass; $answer->lessonid = $question->lessonid; $answer->pageid = $question->id; $answer->timecreated = $timenow; @@ -255,7 +255,7 @@ function lesson_save_question_options($question) { // Insert all the new answers foreach ($question->answer as $key => $dataanswer) { if ($dataanswer != "") { - unset($answer); + $answer = new stdClass; $answer->lessonid = $question->lessonid; $answer->pageid = $question->id; $answer->timecreated = $timenow; @@ -313,7 +313,7 @@ function lesson_save_question_options($question) { foreach ($question->subquestions as $key => $questiontext) { $answertext = $question->subanswers[$key]; echo $answertext; echo "