3 * Action for adding a branch table. Prints an HTML form.
6 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
10 $CFG->pagepath
= 'mod/lesson/addbranchtable';
12 // first get the preceeding page
13 $pageid = required_param('pageid', PARAM_INT
);
17 $jump[0] = get_string("thispage", "lesson");
18 $jump[LESSON_NEXTPAGE
] = get_string("nextpage", "lesson");
19 $jump[LESSON_PREVIOUSPAGE
] = get_string("previouspage", "lesson");
20 $jump[LESSON_EOL
] = get_string("endoflesson", "lesson");
21 if (!optional_param('firstpage', 0, PARAM_INT
)) {
22 if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id
, "prevpageid", 0)) {
23 error("Add page: first page not found");
27 $title = get_field("lesson_pages", "title", "id", $apageid);
28 $jump[$apageid] = $title;
29 $apageid = get_field("lesson_pages", "nextpageid", "id", $apageid);
36 // give teacher a blank proforma
37 print_heading_with_help(get_string("addabranchtable", "lesson"), "overview", "lesson");
39 <form id
="form" method
="post" action
="lesson.php" class="addform">
40 <fieldset
class="invisiblefieldset fieldsetfix">
41 <input type
="hidden" name
="id" value
="<?PHP echo $cm->id ?>" />
42 <input type
="hidden" name
="action" value
="insertpage" />
43 <input type
="hidden" name
="pageid" value
="<?PHP echo $pageid ?>" />
44 <input type
="hidden" name
="qtype" value
="<?PHP echo LESSON_BRANCHTABLE ?>" />
45 <input type
="hidden" name
="sesskey" value
="<?PHP echo $USER->sesskey ?>" />
46 <table
class="generalbox boxaligncenter" cellpadding
="5" border
="1">
48 <td
><strong
><label
for="title"><?php
print_string("pagetitle", "lesson"); ?
>:</label
></strong
><br
/>
49 <input type
="text" id
="title" name
="title" size
="80" value
="" /></td
></tr
>
51 echo "<tr><td><strong>";
52 echo get_string("pagecontents", "lesson").":</strong><br />\n";
53 print_textarea($usehtmleditor, 25,70, 0, 0, "contents");
55 use_html_editor("contents");
59 echo "<div class=\"boxaligncenter addform\"><input name=\"layout\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";
60 echo get_string("arrangebuttonshorizontally", "lesson")."\n";
61 echo "<br /><input name=\"display\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";
62 echo get_string("displayinleftmenu", "lesson");
65 for ($i = 0; $i < $lesson->maxanswers
; $i++
) {
67 echo "<tr><td><strong>".get_string("description", "lesson")." $iplus1:</strong><br />\n";
68 print_textarea(false, 10, 70, 630, 300, "answer[$i]"); // made the default set to off also removed use_html_editor(); line from down below, which made all textareas turn into html editors
70 echo "<tr><td><strong>".get_string("jump", "lesson")." $iplus1:</strong> \n";
72 // answers 2, 3, 4... jumpto this page
73 choose_from_menu($jump, "jumpto[$i]", 0, "");
75 // answer 1 jumpto next page
76 choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE
, "");
78 helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
81 // close table and form
84 <input type
="submit" value
="<?php print_string("addabranchtable
", "lesson
") ?>" />
85 <input type
="submit" name
="cancel" value
="<?php print_string("cancel
") ?>" />