qtype = optional_param('qtype', $page->qtype, PARAM_INT); // set of jump array $jump = array(); $jump[0] = get_string("thispage", "lesson"); $jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson"); $jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson"); if(lesson_display_branch_jumps($lesson->id, $page->id)) { $jump[LESSON_UNSEENBRANCHPAGE] = get_string("unseenpageinbranch", "lesson"); $jump[LESSON_RANDOMPAGE] = get_string("randompageinbranch", "lesson"); } if ($page->qtype == LESSON_ENDOFBRANCH || $page->qtype == LESSON_BRANCHTABLE) { $jump[LESSON_RANDOMBRANCH] = get_string("randombranch", "lesson"); } if(lesson_display_cluster_jump($lesson->id, $page->id) && $page->qtype != LESSON_BRANCHTABLE && $page->qtype != LESSON_ENDOFCLUSTER) { $jump[LESSON_CLUSTERJUMP] = get_string("clusterjump", "lesson"); } $jump[LESSON_EOL] = get_string("endoflesson", "lesson"); if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) { error("Edit page: first page not found"); } while (true) { if ($apageid) { if (!$apage = get_record("lesson_pages", "id", $apageid)) { error("Edit page: apage record not found"); } // removed != LESSON_ENDOFBRANCH... if (trim($page->title)) { // ...nor nuffin pages $jump[$apageid] = strip_tags(format_string($apage->title,true)); } $apageid = $apage->nextpageid; } else { // last page reached break; } } // give teacher a proforma ?>
qtype) { case LESSON_MULTICHOICE : echo ''.get_string("questiontype", "lesson").": \n"; echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."
"; lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype, "lesson.php?id=$cm->id&action=editpage&pageid=$page->id", "getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();"); echo "

\n"; if ($page->qoption) { echo ""; } else { echo ""; } helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson"); echo "

\n"; break; case LESSON_SHORTANSWER : echo ''.get_string("questiontype", "lesson").": \n"; echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."
"; lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype, "lesson.php?id=$cm->id&action=editpage&pageid=$page->id", "getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();"); echo "

\n"; if ($page->qoption) { echo ""; } else { echo ""; } helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson"); echo "

\n"; break; case LESSON_TRUEFALSE : case LESSON_ESSAY : case LESSON_MATCHING : case LESSON_NUMERICAL : echo ''.get_string("questiontype", "lesson").": \n"; echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."
"; lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype, "lesson.php?id=$cm->id&action=editpage&pageid=$page->id", "getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();"); break; } ?> \n"; $n = 0; switch ($page->qtype) { case LESSON_BRANCHTABLE : echo "qtype\" />\n"; echo "\n"; echo "\n"; // get the answers in a set order, the id order if ($answers = get_records("lesson_answers", "pageid", $page->id, "id")) { foreach ($answers as $answer) { $flags = intval($answer->flags); // force into an integer $nplus1 = $n + 1; echo "id\" />\n"; switch ($page->qtype) { case LESSON_MATCHING: if ($n == 0) { echo "\n"; echo "\n"; break; case LESSON_TRUEFALSE: case LESSON_MULTICHOICE: case LESSON_SHORTANSWER: case LESSON_NUMERICAL: echo "\n"; echo "\n"; break; case LESSON_BRANCHTABLE: echo "\n"; break; } switch ($page->qtype) { case LESSON_MATCHING : if ($n == 2) { echo "\n"; } if ($n == 3) { echo "\n"; } //echo "\n"; break; case LESSON_ESSAY : echo "\n"; break; case LESSON_TRUEFALSE: case LESSON_MULTICHOICE: case LESSON_SHORTANSWER: case LESSON_NUMERICAL: echo "\n"; break; case LESSON_BRANCHTABLE: case LESSON_CLUSTER: case LESSON_ENDOFCLUSTER: case LESSON_ENDOFBRANCH: echo "\n"; break; } $n++; if ($page->qtype == LESSON_ESSAY) { break; // only one answer for essays } } } if ($page->qtype != LESSON_ENDOFBRANCH && $page->qtype != LESSON_CLUSTER && $page->qtype != LESSON_ENDOFCLUSTER) { if ($page->qtype == LESSON_MATCHING) { $maxanswers = $lesson->maxanswers + 2; } else { $maxanswers = $lesson->maxanswers; } for ($i = $n; $i < $maxanswers; $i++) { if ($page->qtype == LESSON_TRUEFALSE && $i > 1) { break; // stop printing answers... only need two for true/false } $iplus1 = $i + 1; echo "\n"; switch ($page->qtype) { case LESSON_MATCHING: $icorrected = $i - 1; echo "\n"; echo "\n"; break; case LESSON_TRUEFALSE: case LESSON_MULTICHOICE: case LESSON_SHORTANSWER: case LESSON_NUMERICAL: echo "\n"; echo "\n"; break; case LESSON_BRANCHTABLE: echo "\n"; break; } switch ($page->qtype) { case LESSON_ESSAY : if ($i < 1) { echo "\n"; } break; case LESSON_MATCHING : if ($i == 2) { echo "\n"; } if ($i == 3) { echo "\n"; } break; case LESSON_TRUEFALSE: case LESSON_MULTICHOICE: case LESSON_SHORTANSWER: case LESSON_NUMERICAL: echo "\n"; break; case LESSON_BRANCHTABLE : echo "\n"; break; } } } // close table and form ?>

"; echo get_string("pagecontents", "lesson").":
\n"; print_textarea($usehtmleditor, 25, 70, 630, 400, "contents", $page->contents); if ($usehtmleditor) { use_html_editor("contents"); } echo "
\n"; echo "
"; if ($page->layout) { echo ""; } else { echo ""; } echo get_string("arrangebuttonshorizontally", "lesson")."\n"; echo "
"; if ($page->display) { echo ""; } else { echo ""; } echo get_string("displayinleftmenu", "lesson")."\n"; echo "
".get_string("branchtable", "lesson")." \n"; break; case LESSON_CLUSTER : echo "qtype\" />\n"; echo "
".get_string("clustertitle", "lesson")." \n"; break; case LESSON_ENDOFCLUSTER : echo "qtype\" />\n"; echo "
".get_string("endofclustertitle", "lesson")." \n"; break; case LESSON_ENDOFBRANCH : echo "qtype\" />\n"; echo "
".get_string("endofbranch", "lesson")." \n"; break; default : echo "
"; break; } echo "
\n"; if ($flags & LESSON_ANSWER_EDITOR) { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer); use_html_editor("answer[$n]"); // switch on the editor } else { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer); } } elseif ($n == 1) { echo "
\n"; if ($flags & LESSON_ANSWER_EDITOR) { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer); use_html_editor("answer[$n]"); // switch on the editor } else { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer); } } else { $ncorrected = $n - 1; echo "
\n"; if ($flags & LESSON_ANSWER_EDITOR) { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer); use_html_editor("answer[$n]"); // switch on the editor } else { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer); } echo "
\n"; if ($flags & LESSON_RESPONSE_EDITOR) { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea($usehtmleditor, 20, 70, 630, 300, "response[$n]", $answer->response); use_html_editor("response[$n]"); // switch on the editor } else { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response); } } echo "
\n"; if ($flags & LESSON_ANSWER_EDITOR and $page->qtype != LESSON_SHORTANSWER and $page->qtype != LESSON_NUMERICAL) { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer); use_html_editor("answer[$n]"); // switch on the editor } else { if ($page->qtype != LESSON_SHORTANSWER and $page->qtype != LESSON_NUMERICAL) { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer); } else { echo "
\n"; print_textarea(false, 1, 70, 630, 300, "answer[$n]", $answer->answer); } } echo "
\n"; if ($flags & LESSON_RESPONSE_EDITOR) { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea($usehtmleditor, 20, 70, 630, 300, "response[$n]", $answer->response); use_html_editor("response[$n]"); // switch on the editor } else { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response); } echo "
\n"; if ($flags & LESSON_ANSWER_EDITOR) { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer); use_html_editor("answer[$n]"); // switch on the editor } else { echo " [: ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 10, 70, 630, 300, "answer[$n]", $answer->answer); } echo "
".get_string("correctanswerjump", "lesson").": \n"; choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, ""); helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); if($lesson->custom) echo get_string("correctanswerscore", "lesson").": score\" size=\"5\" />"; echo "
".get_string("wronganswerjump", "lesson").": \n"; choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, ""); helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); if($lesson->custom) echo get_string("wronganswerscore", "lesson").": score\" size=\"5\" />"; echo "
".get_string("jump", "lesson").": \n"; choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, ""); helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); if($lesson->custom) { echo get_string("score", "lesson").": score\" size=\"5\" />"; } echo "
".get_string("jump", "lesson")." $nplus1: \n"; choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, ""); helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); if($lesson->custom) { echo get_string("score", "lesson")." $nplus1: score\" size=\"5\" />"; } echo "
".get_string("jump", "lesson")." $nplus1: \n"; choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, ""); helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); echo "
".get_string("answer", "lesson")." $icorrected:\n"; echo " [".get_string("useeditor", "lesson").": ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 10, 70, 630, 300, "answer[$i]"); echo "
".get_string("matchesanswer", "lesson")." $icorrected:\n"; echo " [".get_string("useeditor", "lesson").": ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 10, 70, 630, 300, "response[$i]"); echo "
".get_string("answer", "lesson")." $iplus1:\n"; if ($page->qtype != LESSON_SHORTANSWER and $page->qtype != LESSON_NUMERICAL) { echo " [".get_string("useeditor", "lesson").": ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 10, 70, 630, 300, "answer[$i]"); } else { echo "
\n"; print_textarea(false, 1, 70, 630, 300, "answer[$i]"); } echo "
".get_string("response", "lesson")." $iplus1:\n"; echo " [".get_string("useeditor", "lesson").": ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 10, 70, 630, 300, "response[$i]"); echo "
".get_string("description", "lesson")." $iplus1:\n"; echo " [".get_string("useeditor", "lesson").": ". ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\n"; print_textarea(false, 10, 70, 630, 300, "answer[$i]"); echo "
".get_string("jump", "lesson").": \n"; choose_from_menu($jump, "jumpto[$i]", 0, ""); helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); if($lesson->custom) { echo get_string("score", "lesson").": "; } echo "
".get_string("correctanswerjump", "lesson").": \n"; choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, ""); helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); if ($lesson->custom) { echo get_string("correctanswerscore", "lesson").": score\" size=\"5\" />"; } echo "
".get_string("wronganswerjump", "lesson").": \n"; choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, ""); helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); if ($lesson->custom) { echo get_string("wronganswerscore", "lesson").": score\" size=\"5\" />"; } echo "
".get_string("jump", "lesson")." $iplus1: \n"; choose_from_menu($jump, "jumpto[$i]", 0, ""); helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); if($lesson->custom) { echo get_string("score", "lesson")." $iplus1: "; } echo "
".get_string("jump", "lesson")." $iplus1: \n"; choose_from_menu($jump, "jumpto[$i]", 0, ""); helpbutton("jumpto", get_string("jump", "lesson"), "lesson"); echo "

" onclick="getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();" /> " /> " />