MDL-10234
[moodle-linuxchix.git] / mod / lesson / action / editpage.php
blobdbf47605934ab50cef071d8d72007b2322b22f34
1 <?php // $Id$
2 /**
3 * Action for editing a page. Prints an HTML form.
5 * @version $Id$
6 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
7 * @package lesson
8 **/
10 // get the page
11 $pageid = required_param('pageid', PARAM_INT);
12 $redirect = optional_param('redirect', '', PARAM_ALPHA);
14 if (!$page = get_record("lesson_pages", "id", $pageid)) {
15 error("Edit page: page record not found");
18 $page->qtype = optional_param('qtype', $page->qtype, PARAM_INT);
20 // set of jump array
21 $jump = array();
22 $jump[0] = get_string("thispage", "lesson");
23 $jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");
24 $jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");
25 if(lesson_display_branch_jumps($lesson->id, $page->id)) {
26 $jump[LESSON_UNSEENBRANCHPAGE] = get_string("unseenpageinbranch", "lesson");
27 $jump[LESSON_RANDOMPAGE] = get_string("randompageinbranch", "lesson");
29 if ($page->qtype == LESSON_ENDOFBRANCH || $page->qtype == LESSON_BRANCHTABLE) {
30 $jump[LESSON_RANDOMBRANCH] = get_string("randombranch", "lesson");
32 if(lesson_display_cluster_jump($lesson->id, $page->id) && $page->qtype != LESSON_BRANCHTABLE && $page->qtype != LESSON_ENDOFCLUSTER) {
33 $jump[LESSON_CLUSTERJUMP] = get_string("clusterjump", "lesson");
35 $jump[LESSON_EOL] = get_string("endoflesson", "lesson");
36 if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
37 error("Edit page: first page not found");
39 while (true) {
40 if ($apageid) {
41 if (!$apage = get_record("lesson_pages", "id", $apageid)) {
42 error("Edit page: apage record not found");
44 // removed != LESSON_ENDOFBRANCH...
45 if (trim($page->title)) { // ...nor nuffin pages
46 $jump[$apageid] = strip_tags(format_string($apage->title,true));
48 $apageid = $apage->nextpageid;
49 } else {
50 // last page reached
51 break;
54 // give teacher a proforma
56 <form id="editpage" method="post" action="lesson.php">
57 <fieldset class="invisiblefieldset fieldsetfix">
58 <input type="hidden" name="id" value="<?php echo $cm->id ?>" />
59 <input type="hidden" name="action" value="updatepage" />
60 <input type="hidden" name="pageid" value="<?php echo $pageid ?>" />
61 <input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
62 <input type="hidden" name="redirect" value="<?php echo $redirect ?>" />
63 <input type="hidden" name="redisplay" value="0" />
64 <center>
65 <?php
66 switch ($page->qtype) {
67 case LESSON_MULTICHOICE :
68 echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
69 echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br />";
70 lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
71 "lesson.php?id=$cm->id&amp;action=editpage&amp;pageid=$page->id",
72 "getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();");
73 echo "<p><b><label for=\"qoption\">".get_string('multianswer', 'lesson').":</label></b> \n";
74 if ($page->qoption) {
75 echo "<input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\" />";
76 } else {
77 echo "<input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" />";
79 helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
80 echo "</p>\n";
81 break;
82 case LESSON_SHORTANSWER :
83 echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
84 echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br />";
85 lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
86 "lesson.php?id=$cm->id&amp;action=editpage&amp;pageid=$page->id",
87 "getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();");
88 echo "<p><b><label for=\"qoption\">".get_string('casesensitive', 'lesson').":</label></b> \n";
89 if ($page->qoption) {
90 echo "<input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\" />";
91 } else {
92 echo "<input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" />";
94 helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
95 echo "</p>\n";
96 break;
97 case LESSON_TRUEFALSE :
98 case LESSON_ESSAY :
99 case LESSON_MATCHING :
100 case LESSON_NUMERICAL :
101 echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
102 echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br />";
103 lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
104 "lesson.php?id=$cm->id&amp;action=editpage&amp;pageid=$page->id",
105 "getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();");
106 break;
109 <table cellpadding="5" class="generalbox" border="1">
110 <tr valign="top">
111 <td><b><label for="title"><?php print_string('pagetitle', 'lesson'); ?>:</label></b><br />
112 <input type="text" id="title" name="title" size="80" maxsize="255" value="<?php p($page->title) ?>" /></td>
113 </tr>
114 <?PHP
115 echo "<tr><td><b>";
116 echo get_string("pagecontents", "lesson").":</b><br />\n";
117 print_textarea($usehtmleditor, 25, 70, 630, 400, "contents", $page->contents);
118 if ($usehtmleditor) {
119 use_html_editor("contents");
121 echo "</td></tr>\n";
122 $n = 0;
123 switch ($page->qtype) {
124 case LESSON_BRANCHTABLE :
125 echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";
126 echo "<tr><td>\n";
127 echo "<center>";
128 if ($page->layout) {
129 echo "<input checked=\"checked\" name=\"layout\" type=\"checkbox\" value=\"1\" />";
130 } else {
131 echo "<input name=\"layout\" type=\"checkbox\" value=\"1\" />";
133 echo get_string("arrangebuttonshorizontally", "lesson")."\n";
134 echo "<br />";
135 if ($page->display) {
136 echo "<input name=\"display\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";
137 } else {
138 echo "<input name=\"display\" type=\"checkbox\" value=\"1\" />";
140 echo get_string("displayinleftmenu", "lesson")."\n";
141 echo "</center></td></tr>\n";
142 echo "<tr><td><b>".get_string("branchtable", "lesson")."</b> \n";
143 break;
144 case LESSON_CLUSTER :
145 echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";
146 echo "<tr><td><b>".get_string("clustertitle", "lesson")."</b> \n";
147 break;
148 case LESSON_ENDOFCLUSTER :
149 echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";
150 echo "<tr><td><b>".get_string("endofclustertitle", "lesson")."</b> \n";
151 break;
152 case LESSON_ENDOFBRANCH :
153 echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\" />\n";
154 echo "<tr><td><b>".get_string("endofbranch", "lesson")."</b> \n";
155 break;
156 default :
157 echo "<tr><td>";
158 break;
161 echo "</td></tr>\n";
162 // get the answers in a set order, the id order
164 if ($answers = get_records("lesson_answers", "pageid", $page->id, "id")) {
165 foreach ($answers as $answer) {
166 $flags = intval($answer->flags); // force into an integer
167 $nplus1 = $n + 1;
168 echo "<input type=\"hidden\" name=\"answerid[$n]\" value=\"$answer->id\" />\n";
169 switch ($page->qtype) {
170 case LESSON_MATCHING:
171 if ($n == 0) {
172 echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string('correctresponse', 'lesson').":</label></b>\n";
173 if ($flags & LESSON_ANSWER_EDITOR) {
174 echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
175 "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" checked=\"checked\" />";
176 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
177 echo "]<br />\n";
178 print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
179 use_html_editor("answer[$n]"); // switch on the editor
180 } else {
181 echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
182 "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" />";
183 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
184 echo "]<br />\n";
185 print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
187 } elseif ($n == 1) {
188 echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string('wrongresponse', 'lesson').":</label></b>\n";
189 if ($flags & LESSON_ANSWER_EDITOR) {
190 echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
191 "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" checked=\"checked\" />";
192 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
193 echo "]<br />\n";
194 print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
195 use_html_editor("answer[$n]"); // switch on the editor
196 } else {
197 echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
198 "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" />";
199 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
200 echo "]<br />\n";
201 print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
203 } else {
204 $ncorrected = $n - 1;
205 echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string('answer', 'lesson')." $ncorrected:</label></b>\n";
206 if ($flags & LESSON_ANSWER_EDITOR) {
207 echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
208 "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" checked=\"checked\" />";
209 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
210 echo "]<br />\n";
211 print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
212 use_html_editor("answer[$n]"); // switch on the editor
213 } else {
214 echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
215 "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" />";
216 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
217 echo "]<br />\n";
218 print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
220 echo "</td></tr>\n";
221 echo "<tr><td><b><label for=\"edit-response[$n]\">".get_string('matchesanswer', 'lesson')." $ncorrected:</label></b>\n";
222 if ($flags & LESSON_RESPONSE_EDITOR) {
223 echo " [<label for=\"responseeditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
224 "<input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\" checked=\"checked\" />";
225 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
226 echo "]<br />\n";
227 print_textarea($usehtmleditor, 20, 70, 630, 300, "response[$n]", $answer->response);
228 use_html_editor("response[$n]"); // switch on the editor
229 } else {
230 echo " [<label for=\"responseeditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
231 "<input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\" />";
232 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
233 echo "]<br />\n";
234 print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response);
237 echo "</td></tr>\n";
238 break;
239 case LESSON_TRUEFALSE:
240 case LESSON_MULTICHOICE:
241 case LESSON_SHORTANSWER:
242 case LESSON_NUMERICAL:
243 echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string('answer', 'lesson')." $nplus1:</label></b>\n";
244 if ($flags & LESSON_ANSWER_EDITOR and $page->qtype != LESSON_SHORTANSWER and $page->qtype != LESSON_NUMERICAL) {
245 echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
246 "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" checked=\"checked\" />";
247 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
248 echo "]<br />\n";
249 print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
250 use_html_editor("answer[$n]"); // switch on the editor
251 } else {
252 if ($page->qtype != LESSON_SHORTANSWER and $page->qtype != LESSON_NUMERICAL) {
253 echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
254 "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" />";
255 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
256 echo "]<br />\n";
257 print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
258 } else {
259 echo "<br />\n";
260 print_textarea(false, 1, 70, 630, 300, "answer[$n]", $answer->answer);
263 echo "</td></tr>\n";
264 echo "<tr><td><b><label for=\"edit-response[$n]\">".get_string('response', 'lesson')." $nplus1:</label></b>\n";
265 if ($flags & LESSON_RESPONSE_EDITOR) {
266 echo " [<label for=\"responseeditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
267 "<input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\" checked=\"checked\" />";
268 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
269 echo "]<br />\n";
270 print_textarea($usehtmleditor, 20, 70, 630, 300, "response[$n]", $answer->response);
271 use_html_editor("response[$n]"); // switch on the editor
272 } else {
273 echo " [<label for=\"responseeditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
274 "<input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\" />";
275 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
276 echo "]<br />\n";
277 print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response);
279 echo "</td></tr>\n";
280 break;
281 case LESSON_BRANCHTABLE:
282 echo "<tr><td><b><label for=\"edit-answer[$n]\">".get_string("description", "lesson")." $nplus1:</label></b>\n";
283 if ($flags & LESSON_ANSWER_EDITOR) {
284 echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
285 "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" checked=\"checked\" />";
286 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
287 echo "]<br />\n";
288 print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
289 use_html_editor("answer[$n]"); // switch on the editor
290 } else {
291 echo " [<label for=\"answereditor[$n]\">".get_string("useeditor", "lesson")."</label>: ".
292 "<input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\" />";
293 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
294 echo "]<br />\n";
295 print_textarea(false, 10, 70, 630, 300, "answer[$n]", $answer->answer);
297 echo "</td></tr>\n";
298 break;
300 switch ($page->qtype) {
301 case LESSON_MATCHING :
302 if ($n == 2) {
303 echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
304 choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
305 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
306 if($lesson->custom)
307 echo get_string("correctanswerscore", "lesson").": <input type=\"text\" name=\"score[$n]\" value=\"$answer->score\" size=\"5\" />";
308 echo "</td></tr>\n";
310 if ($n == 3) {
311 echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
312 choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
313 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
314 if($lesson->custom)
315 echo get_string("wronganswerscore", "lesson").": <input type=\"text\" name=\"score[$n]\" value=\"$answer->score\" size=\"5\" />";
316 echo "</td></tr>\n";
318 //echo "</td></tr>\n";
319 break;
320 case LESSON_ESSAY :
321 echo "<tr><td><b>".get_string("jump", "lesson").":</b> \n";
322 choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
323 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
324 if($lesson->custom) {
325 echo get_string("score", "lesson").": <input type=\"text\" name=\"score[$n]\" value=\"$answer->score\" size=\"5\" />";
327 echo "</td></tr>\n";
328 break;
329 case LESSON_TRUEFALSE:
330 case LESSON_MULTICHOICE:
331 case LESSON_SHORTANSWER:
332 case LESSON_NUMERICAL:
333 echo "<tr><td><b>".get_string("jump", "lesson")." $nplus1:</b> \n";
334 choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
335 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
336 if($lesson->custom) {
337 echo get_string("score", "lesson")." $nplus1: <input type=\"text\" name=\"score[$n]\" value=\"$answer->score\" size=\"5\" />";
339 echo "</td></tr>\n";
340 break;
341 case LESSON_BRANCHTABLE:
342 case LESSON_CLUSTER:
343 case LESSON_ENDOFCLUSTER:
344 case LESSON_ENDOFBRANCH:
345 echo "<tr><td><b>".get_string("jump", "lesson")." $nplus1:</b> \n";
346 choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
347 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
348 echo "</td></tr>\n";
349 break;
351 $n++;
352 if ($page->qtype == LESSON_ESSAY) {
353 break; // only one answer for essays
357 if ($page->qtype != LESSON_ENDOFBRANCH && $page->qtype != LESSON_CLUSTER && $page->qtype != LESSON_ENDOFCLUSTER) {
358 if ($page->qtype == LESSON_MATCHING) {
359 $maxanswers = $lesson->maxanswers + 2;
360 } else {
361 $maxanswers = $lesson->maxanswers;
363 for ($i = $n; $i < $maxanswers; $i++) {
364 if ($page->qtype == LESSON_TRUEFALSE && $i > 1) {
365 break; // stop printing answers... only need two for true/false
367 $iplus1 = $i + 1;
368 echo "<input type=\"hidden\" name=\"answerid[$i]\" value=\"0\" />\n";
369 switch ($page->qtype) {
370 case LESSON_MATCHING:
371 $icorrected = $i - 1;
372 echo "<tr><td><b>".get_string("answer", "lesson")." $icorrected:</b>\n";
373 echo " [".get_string("useeditor", "lesson").": ".
374 "<input type=\"checkbox\" name=\"answereditor[$i]\" value=\"1\" />";
375 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
376 echo "]<br />\n";
377 print_textarea(false, 10, 70, 630, 300, "answer[$i]");
378 echo "</td></tr>\n";
379 echo "<tr><td><b>".get_string("matchesanswer", "lesson")." $icorrected:</b>\n";
380 echo " [".get_string("useeditor", "lesson").": ".
381 "<input type=\"checkbox\" name=\"responseeditor[$i]\" value=\"1\" />";
382 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
383 echo "]<br />\n";
384 print_textarea(false, 10, 70, 630, 300, "response[$i]");
385 echo "</td></tr>\n";
386 break;
387 case LESSON_TRUEFALSE:
388 case LESSON_MULTICHOICE:
389 case LESSON_SHORTANSWER:
390 case LESSON_NUMERICAL:
391 echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b>\n";
392 if ($page->qtype != LESSON_SHORTANSWER and $page->qtype != LESSON_NUMERICAL) {
393 echo " [".get_string("useeditor", "lesson").": ".
394 "<input type=\"checkbox\" name=\"answereditor[$i]\" value=\"1\" />";
395 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
396 echo "]<br />\n";
397 print_textarea(false, 10, 70, 630, 300, "answer[$i]");
398 } else {
399 echo "<br />\n";
400 print_textarea(false, 1, 70, 630, 300, "answer[$i]");
402 echo "</td></tr>\n";
403 echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b>\n";
404 echo " [".get_string("useeditor", "lesson").": ".
405 "<input type=\"checkbox\" name=\"responseeditor[$i]\" value=\"1\" />";
406 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
407 echo "]<br />\n";
408 print_textarea(false, 10, 70, 630, 300, "response[$i]");
409 echo "</td></tr>\n";
410 break;
411 case LESSON_BRANCHTABLE:
412 echo "<tr><td><b>".get_string("description", "lesson")." $iplus1:</b>\n";
413 echo " [".get_string("useeditor", "lesson").": ".
414 "<input type=\"checkbox\" name=\"answereditor[$i]\" value=\"1\" />";
415 helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
416 echo "]<br />\n";
417 print_textarea(false, 10, 70, 630, 300, "answer[$i]");
418 echo "</td></tr>\n";
419 break;
421 switch ($page->qtype) {
422 case LESSON_ESSAY :
423 if ($i < 1) {
424 echo "<tr><td><b>".get_string("jump", "lesson").":</b> \n";
425 choose_from_menu($jump, "jumpto[$i]", 0, "");
426 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
427 if($lesson->custom) {
428 echo get_string("score", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\" />";
430 echo "</td></tr>\n";
432 break;
433 case LESSON_MATCHING :
434 if ($i == 2) {
435 echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
436 choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, "");
437 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
438 if ($lesson->custom) {
439 echo get_string("correctanswerscore", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"$answer->score\" size=\"5\" />";
441 echo "</td></tr>\n";
443 if ($i == 3) {
444 echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
445 choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, "");
446 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
447 if ($lesson->custom) {
448 echo get_string("wronganswerscore", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"$answer->score\" size=\"5\" />";
450 echo "</td></tr>\n";
453 break;
454 case LESSON_TRUEFALSE:
455 case LESSON_MULTICHOICE:
456 case LESSON_SHORTANSWER:
457 case LESSON_NUMERICAL:
458 echo "<tr><td><b>".get_string("jump", "lesson")." $iplus1:</b> \n";
459 choose_from_menu($jump, "jumpto[$i]", 0, "");
460 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
461 if($lesson->custom) {
462 echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"0\" size=\"5\" />";
464 echo "</td></tr>\n";
465 break;
466 case LESSON_BRANCHTABLE :
467 echo "<tr><td><b>".get_string("jump", "lesson")." $iplus1:</b> \n";
468 choose_from_menu($jump, "jumpto[$i]", 0, "");
469 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
470 echo "</td></tr>\n";
471 break;
475 // close table and form
477 </table><br />
478 <input type="button" value="<?php print_string("redisplaypage", "lesson") ?>"
479 onclick="getElementById('editpage').redisplay.value=1;getElementById('editpage').submit();" />
480 <input type="submit" value="<?php print_string("savepage", "lesson") ?>" />
481 <input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
482 </center>
483 </fieldset>
484 </form>