Incorrect variable name used for parameter.
[moodle-linuxchix.git] / mod / lesson / mod.html
blob533dfef13d088f7d3ad46eeed2fdba9a76678eb4
1 <!-- define a new instance of lesson -->
2 <!-- It is used from /course/mod.php. The whole instance is available as $form. -->
3 <?php
4 require("$CFG->dirroot/mod/lesson/locallib.php"); // for parameter array
5 if ($form->mode == "add") {
6 if ($defaults = get_record("lesson_default", "course", $form->course)) {
7 foreach ($defaults as $name => $value) {
8 if (!is_numeric($name)) {
9 $form->$name = $value;
15 // set the defaults
16 if (empty($form->name)) {
17 $form->name = "";
19 if (!isset($form->grade)) {
20 $form->grade = 0;
22 if (!isset($form->usemaxgrade)) {
23 $form->usemaxgrade = 0;
25 if (!isset($form->maxanswers)) {
26 $form->maxanswers = 4;
28 if (!isset($form->maxattempts)) {
29 $form->maxattempts = 1;
31 if (!isset($form->nextpagedefault)) {
32 $form->nextpagedefault = 0;
34 if (!isset($form->minquestions)) {
35 $form->minquestions = 0;
37 if (!isset($form->maxpages)) {
38 $form->maxpages = 0;
40 if (!isset($form->retake)) {
41 $form->retake = 0;
43 if (!isset($form->available)) {
44 $form->available = 0;
46 if (!isset($form->deadline)) {
47 $currentdate = usergetdate(time());
48 $form->deadline = gmmktime($currentdate["hours"], $currentdate["minutes"], $currentdate["seconds"], $currentdate["mon"]+1, $currentdate["mday"], $currentdate["year"]);
50 /// CDC-FLAG ///
51 if (!isset($form->usepassword)) {
52 $form->usepassword = 0;
54 if (!isset($form->custom)) {
55 $form->custom = 1;
57 if (!isset($form->ongoing)) {
58 $form->ongoing = 0;
60 if (!isset($form->timed)) {
61 $form->timed = 0;
63 if (!isset($form->maxtime)) {
64 $form->maxtime = 20;
66 if (!isset($form->tree)) {
67 $form->tree = 0;
69 if (!isset($form->slideshow)) {
70 $form->slideshow = 0;
72 if (!isset($form->width)) {
73 $form->width = 640;
75 if (!isset($form->height)) {
76 $form->height = 400;
78 if (!isset($form->bgcolor)) {
79 $form->bgcolor = "#FFFFFF";
81 if (!isset($form->displayleft)) {
82 $form->displayleft = 0;
84 if (!isset($form->highscores)) {
85 $form->highscores = 0;
87 if (!isset($form->maxhighscores)) {
88 $form->maxhighscores = 10;
90 if (!isset($form->practice)) {
91 $form->practice = 0;
93 if (!isset($form->review)) {
94 $form->review = 0;
96 if (!isset($form->lessondefault)) {
97 $form->lessondefault = 0;
99 if (!isset($form->modattempts)) {
100 $form->modattempts = 0;
104 $form->deleteattempts = "";
106 /// CDC-FLAG ///
108 <div class="mod-lesson">
109 <form name="form" method="post" action="mod.php">
110 <center>
112 <table cellpadding="5">
114 <tr>
115 <td>
116 <?php print_heading(get_string("general", "lesson"), "left", 4); ?>
117 </td><td></td>
118 </tr>
120 <tr valign="top">
121 <td align="right"><b><?php print_string("name") ?>:</b></td>
122 <td>
123 <!-- //CDC hidden label added. --><label for="name" class="hidden-label">Name</label><input type="text" id="name" name="name" size="30" value="<?php p($form->name) ?>" />
124 </td>
125 </tr>
127 <tr>
128 <td align="right"><b><?php print_string("timed", "lesson"); ?>:</b></td>
129 <td>
130 <?PHP
131 $options = array();
132 $options[0] = get_string("no"); $options[1] = get_string("yes");
133 choose_from_menu($options, "timed", $form->timed, "");
134 helpbutton("timed", get_string("timed", "lesson"), "lesson");
136 </td>
137 </tr>
139 <tr>
140 <td align="right"><b><?php print_string("maxtime", "lesson"); ?>:</b></td>
141 <td>
142 <input type="text" name="maxtime" maxlength="7" size="7" value="<?php p($form->maxtime) ?>" />
143 <?php helpbutton("maxtime", get_string("maxtime", "lesson"), "lesson"); ?>
144 </td>
145 </tr>
147 <tr valign="top">
148 <td align="right"><b><?php print_string("maximumnumberofanswersbranches", "lesson") ?>:</b></td>
149 <td>
150 <?php
151 $numbers = array();
152 for ($i=20; $i>1; $i--) {
153 $numbers[$i] = $i;
155 choose_from_menu($numbers, "maxanswers", "$form->maxanswers", "");
156 helpbutton("maxanswers", get_string("maximumnumberofanswersbranches", "lesson"), "lesson");
158 </td>
159 </tr>
161 <tr>
162 <td>
163 <br/><?php print_heading(get_string("gradeoptions", "lesson"), "left", 4); ?>
164 </td><td></td>
165 </tr>
167 <tr>
168 <td align="right"><b><?php print_string("practice", "lesson"); ?>:</b></td>
169 <td>
170 <?PHP
171 $options = array();
172 $options[0] = get_string("no"); $options[1] = get_string("yes");
173 choose_from_menu($options, "practice", $form->practice, "");
174 helpbutton("practice", get_string("practice", "lesson"), "lesson");
176 </td>
177 </tr>
179 <tr>
180 <td align="right"><b><?php print_string("customscoring", "lesson"); ?>:</b></td>
181 <td>
182 <?PHP
183 $options = array();
184 $options[0] = get_string("no"); $options[1] = get_string("yes");
185 choose_from_menu($options, "custom", $form->custom, "");
186 helpbutton("custom", get_string("customscoring", "lesson"), "lesson");
188 </td>
189 </tr>
191 <tr valign="top">
192 <td align="right"><b><?php print_string("maximumgrade") ?>:</b></td>
193 <td>
194 <?php
195 $grades = array();
196 for ($i=100; $i>=0; $i--) {
197 $grades[$i] = $i;
199 choose_from_menu($grades, "grade", "$form->grade", "");
200 helpbutton("grade", get_string("maximumgrade", "lesson"), "lesson");
202 </td>
203 </tr>
205 <tr>
206 <td align="right"><b><?php print_string("canretake", "lesson", $course->student) ?>:</b></td>
207 <td>
208 <?PHP
209 $options = array();
210 $options[0] = get_string("no"); $options[1] = get_string("yes");
211 choose_from_menu($options, "retake", $form->retake, "");
212 helpbutton("retake", get_string("canretake", "lesson", $course->student), "lesson");
214 </td>
215 </tr>
217 <tr>
218 <td align="right"><b><?php print_string("handlingofretakes", "lesson") ?>:</b></td>
219 <td>
220 <?PHP
221 $options = array();
222 $options[0] = get_string("usemean", "lesson"); $options[1] = get_string("usemaximum", "lesson");
223 choose_from_menu($options, "usemaxgrade", $form->usemaxgrade, "");
224 helpbutton("handlingofretakes", get_string("handlingofretakes", "lesson"), "lesson");
226 </td>
227 </tr>
229 <tr>
230 <td align="right"><b><?php print_string("ongoing", "lesson"); ?>:</b></td>
231 <td>
232 <?php
233 $options = array();
234 $options[0] = get_string("no"); $options[1] = get_string("yes");
235 choose_from_menu($options, "ongoing", $form->ongoing, "");
236 helpbutton("ongoing", get_string("ongoing", "lesson"), "lesson");
238 </td>
239 </tr>
241 <tr>
242 <td>
243 <br/><?php print_heading(get_string("flowcontrol", "lesson"), "left", 4); ?>
244 </td><td></td>
245 </tr>
247 <tr>
248 <td align="right"><b><?php print_string("modattempts", "lesson"); ?>:</b></td>
249 <td>
250 <?PHP
251 $options = array();
252 $options[0] = get_string("no"); $options[1] = get_string("yes");
253 choose_from_menu($options, "modattempts", $form->modattempts, "");
254 helpbutton("modattempts", get_string("modattempts", "lesson"), "lesson");
256 </td>
257 </tr>
259 <tr>
260 <td align="right"><b><?php print_string("displayreview", "lesson"); ?>:</b></td>
261 <td>
262 <?php
263 $options = array();
264 $options[0] = get_string("no"); $options[1] = get_string("yes");
265 choose_from_menu($options, "review", $form->review, "");
266 helpbutton("review", get_string("displayreview", "lesson"), "lesson");
268 </td>
269 </tr>
271 <tr valign="top">
272 <td align="right"><b><?php print_string("maximumnumberofattempts", "lesson") ?>:</b></td>
273 <td>
274 <?php
275 $numbers = array();
276 for ($i=10; $i>0; $i--) {
277 $numbers[$i] = $i;
279 choose_from_menu($numbers, "maxattempts", "$form->maxattempts", "");
280 helpbutton("maxattempts", get_string("maximumnumberofattempts", "lesson"), "lesson");
282 </td>
283 </tr>
285 <tr>
286 <td align="right"><b><?php print_string("actionaftercorrectanswer", "lesson") ?>:</b></td>
287 <td>
288 <?php
289 choose_from_menu($LESSON_NEXTPAGE_ACTION, "nextpagedefault", $form->nextpagedefault, "");
290 helpbutton("nextpageaction", get_string("actionaftercorrectanswer", "lesson"), "lesson");
292 </td>
293 </tr>
295 <tr valign="top">
296 <td align="right"><b><?php print_string("minimumnumberofquestions", "lesson") ?>:</b></td>
297 <td>
298 <?php
299 $numbers = array();
300 for ($i=100; $i>=0; $i--) {
301 $numbers[$i] = $i;
303 choose_from_menu($numbers, "minquestions", "$form->minquestions", "");
304 helpbutton("minquestions", get_string("minimumnumberofquestions", "lesson"), "lesson");
306 </td>
307 </tr>
309 <tr valign="top">
310 <td align="right"><b><?php print_string("numberofpagestoshow", "lesson") ?>:</b></td>
311 <td>
312 <?php
313 $numbers = array();
314 for ($i=100; $i>=0; $i--) {
315 $numbers[$i] = $i;
317 choose_from_menu($numbers, "maxpages", "$form->maxpages", "");
318 helpbutton("maxpages", get_string("numberofpagestoshow", "lesson"), "lesson");
320 </td>
321 </tr>
323 <tr>
324 <td>
325 <br/><?php print_heading(get_string("lessonformating", "lesson"), "left", 4); ?>
326 </td><td></td>
327 </tr>
329 <tr>
330 <td align="right"><b><?php print_string("slideshow", "lesson"); ?>:</b></td>
331 <td>
332 <?PHP
333 $options = array();
334 $options[0] = get_string("no"); $options[1] = get_string("yes");
335 choose_from_menu($options, "slideshow", $form->slideshow, "");
336 helpbutton("slideshow", get_string("slideshow", "lesson"), "lesson");
338 </td>
339 </tr>
341 <tr>
342 <td align="right"><b><?php print_string("slideshowwidth", "lesson"); ?>:</b></td>
343 <td>
344 <input type="text" name="width" maxlength="7" size="7" value="<?php p($form->width) ?>" />px
345 <?php helpbutton("width", get_string("slideshowwidth", "lesson"), "lesson"); ?>
346 </td>
347 </tr>
349 <tr>
350 <td align="right"><b><?php print_string("slideshowheight", "lesson"); ?>:</b></td>
351 <td>
352 <input type="text" name="height" maxlength="7" size="7" value="<?php p($form->height) ?>" />px
353 <?php helpbutton("height", get_string("slideshowheight", "lesson"), "lesson"); ?>
354 </td>
355 </tr>
357 <tr>
358 <td align="right"><b><?php print_string("slideshowbgcolor", "lesson"); ?>:</b></td>
359 <td>
360 <input type="text" name="bgcolor" maxlength="7" size="7" value="<?php p($form->bgcolor) ?>" />
361 <?php helpbutton("bgcolor", get_string("slideshowbgcolor", "lesson"), "lesson"); ?>
363 </td>
364 </tr>
366 <tr>
367 <td align="right"><b><?php print_string("displayleftmenu", "lesson"); ?>:</b></td>
368 <td>
369 <?PHP
370 $options = array();
371 $options[0] = get_string("no"); $options[1] = get_string("yes");
372 choose_from_menu($options, "displayleft", $form->displayleft, "");
373 helpbutton("displayleft", get_string("displayleftmenu", "lesson"), "lesson");
375 </td>
376 </tr>
378 <tr>
379 <td>
380 <br/><?php print_heading(get_string("accesscontrol", "lesson"), "left", 4); ?>
381 </td><td></td>
382 </tr>
384 <tr>
385 <td align="right"><b><?php print_string("usepassword", "lesson"); ?>:</b></td>
386 <td>
387 <?PHP
388 $options = array();
389 $options[0] = get_string("no"); $options[1] = get_string("yes");
390 choose_from_menu($options, "usepassword", $form->usepassword, "");
391 helpbutton("usepassword", get_string("usepassword", "lesson"), "lesson");
393 </td>
394 </tr>
396 <tr>
397 <td align="right"><b><?php print_string("password", "lesson"); ?>:</b></td>
398 <td>
399 <input type="text" name="password" size="7" value="" /> <?php echo " (".get_string("leavetokeep").")"; ?>
400 <?php helpbutton("password", get_string("password", "lesson"), "lesson"); ?>
401 </td>
402 </tr>
404 <tr valign="top">
405 <td align="right"><b><?php print_string("available", "lesson") ?>:</b></td>
406 <td><?php
407 print_date_selector("availableday", "availablemonth", "availableyear", $form->available);
408 echo "&nbsp;-&nbsp;";
409 print_time_selector("availablehour", "availableminute", $form->available);
410 ?></td>
411 </tr>
413 <tr valign="top">
414 <td align="right"><b><?php print_string("deadline", "lesson") ?>:</b></td>
415 <td><?php
416 print_date_selector("deadlineday", "deadlinemonth", "deadlineyear", $form->deadline);
417 echo "&nbsp;-&nbsp;";
418 print_time_selector("deadlinehour", "deadlineminute", $form->deadline);
419 ?></td>
420 </tr>
422 <tr>
423 <td>
424 <br/><?php print_heading(get_string("other", "lesson"), "left", 4); ?>
425 </td><td></td>
426 </tr>
428 <tr>
429 <td align="right"><b><?php print_string("treeview", "lesson"); ?>:</b></td>
430 <td>
431 <?PHP
432 $options = array();
433 $options[0] = get_string("no"); $options[1] = get_string("yes");
434 choose_from_menu($options, "tree", $form->tree, "");
435 helpbutton("tree", get_string("treeview", "lesson"), "lesson");
437 </td>
438 </tr>
440 <tr>
441 <td align="right"><b><?php print_string("displayhighscores", "lesson"); ?>:</b></td>
442 <td>
443 <?PHP
444 $options = array();
445 $options[0] = get_string("no"); $options[1] = get_string("yes");
446 choose_from_menu($options, "highscores", $form->highscores, "");
447 helpbutton("highscores", get_string("displayhighscores", "lesson"), "lesson");
449 </td>
450 </tr>
452 <tr>
453 <td align="right"><b><?php print_string("maxhighscores", "lesson"); ?>:</b></td>
454 <td>
455 <input type="text" name="maxhighscores" maxlength="7" size="7" value="<?php p($form->maxhighscores) ?>" />
456 <?php helpbutton("maxhighscores", get_string("maxhighscores", "lesson"), "lesson"); ?>
457 </td>
458 </tr>
460 <tr>
461 <td align="right"><b><?php print_string("lessondefault", "lesson"); ?>:</b></td>
462 <td>
463 <?PHP
464 $options = array();
465 $options[0] = get_string("no"); $options[1] = get_string("yes");
466 choose_from_menu($options, "lessondefault", $form->lessondefault, "");
467 helpbutton("lessondefault", get_string("lessondefault", "lesson"), "lesson");
469 </td>
470 </tr>
471 <?php
472 if ($form->mode != "add") {
474 <tr>
475 <td align="right"><b><?php print_string("deleteattempts", "lesson"); ?>:</b></td>
476 <td>
477 <input type="text" name="deleteattempts" size="7" value="" />
478 <?php helpbutton("deleteattempts", get_string("deleteattempts", "lesson"), "lesson"); ?>
479 <input type="hidden" name="deleteattemptsid" value="<?php echo $USER->id; ?>" />
480 </td>
481 </tr>
482 <?php
483 } // end if statement if ($form->mode != "add") {
485 <?php print_visible_setting($form); ?>
486 </table>
487 <!-- These hidden variables are always the same -->
488 <input type="hidden" name="course" value="<?php p($form->course) ?>" />
489 <input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" />
490 <input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
491 <input type="hidden" name="section" value="<?php p($form->section) ?>" />
492 <input type="hidden" name="module" value="<?php p($form->module) ?>" />
493 <input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
494 <input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
495 <input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
496 <input type="submit" value="<?php print_string("savechanges") ?>" />
497 </center>
498 </form>
499 </div> <!-- ends class mod-lesson -->