1 <!-- define a new instance of lesson -->
2 <!-- It is used from /course/mod.php. The whole instance is available as $form. -->
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)) {
16 if (empty($form->name
)) {
19 if (!isset($form->grade
)) {
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
)) {
40 if (!isset($form->retake
)) {
43 if (!isset($form->available
)) {
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"]);
51 if (!isset($form->usepassword
)) {
52 $form->usepassword
= 0;
54 if (!isset($form->custom
)) {
57 if (!isset($form->ongoing
)) {
60 if (!isset($form->timed
)) {
63 if (!isset($form->maxtime
)) {
66 if (!isset($form->tree
)) {
69 if (!isset($form->slideshow
)) {
72 if (!isset($form->width
)) {
75 if (!isset($form->height
)) {
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
)) {
93 if (!isset($form->review
)) {
96 if (!isset($form->lessondefault
)) {
97 $form->lessondefault
= 0;
99 if (!isset($form->modattempts
)) {
100 $form->modattempts
= 0;
104 $form->deleteattempts
= "";
108 <div class=
"mod-lesson">
109 <form name=
"form" method=
"post" action=
"mod.php">
112 <table cellpadding=
"5">
116 <?php print_heading(get_string("general", "lesson"), "left", 4); ?>
121 <td align=
"right"><b><?php print_string("name") ?>:
</b></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) ?>" />
128 <td align
="right"><b
><?php
print_string("timed", "lesson"); ?>:
</b></td>
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");
140 <td align=
"right"><b><?php print_string("maxtime", "lesson"); ?>:
</b></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"); ?>
148 <td align=
"right"><b><?php print_string("maximumnumberofanswersbranches", "lesson") ?>:
</b></td>
152 for ($i=20; $i>1; $i--) {
155 choose_from_menu($numbers, "maxanswers", "$form->maxanswers", "");
156 helpbutton("maxanswers", get_string("maximumnumberofanswersbranches", "lesson"), "lesson");
163 <br/><?php print_heading(get_string("gradeoptions", "lesson"), "left", 4); ?>
168 <td align=
"right"><b><?php print_string("practice", "lesson"); ?>:
</b></td>
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");
180 <td align=
"right"><b><?php print_string("customscoring", "lesson"); ?>:
</b></td>
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");
192 <td align=
"right"><b><?php print_string("maximumgrade") ?>:
</b></td>
196 for ($i=100; $i>=0; $i--) {
199 choose_from_menu($grades, "grade", "$form->grade", "");
200 helpbutton("grade", get_string("maximumgrade", "lesson"), "lesson");
206 <td align=
"right"><b><?php print_string("canretake", "lesson", $course->student
) ?>:
</b></td>
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");
218 <td align=
"right"><b><?php print_string("handlingofretakes", "lesson") ?>:
</b></td>
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");
230 <td align=
"right"><b><?php print_string("ongoing", "lesson"); ?>:
</b></td>
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");
243 <br/><?php print_heading(get_string("flowcontrol", "lesson"), "left", 4); ?>
248 <td align=
"right"><b><?php print_string("modattempts", "lesson"); ?>:
</b></td>
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");
260 <td align=
"right"><b><?php print_string("displayreview", "lesson"); ?>:
</b></td>
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");
272 <td align=
"right"><b><?php print_string("maximumnumberofattempts", "lesson") ?>:
</b></td>
276 for ($i=10; $i>0; $i--) {
279 choose_from_menu($numbers, "maxattempts", "$form->maxattempts", "");
280 helpbutton("maxattempts", get_string("maximumnumberofattempts", "lesson"), "lesson");
286 <td align=
"right"><b><?php print_string("actionaftercorrectanswer", "lesson") ?>:
</b></td>
289 choose_from_menu($LESSON_NEXTPAGE_ACTION, "nextpagedefault", $form->nextpagedefault
, "");
290 helpbutton("nextpageaction", get_string("actionaftercorrectanswer", "lesson"), "lesson");
296 <td align=
"right"><b><?php print_string("minimumnumberofquestions", "lesson") ?>:
</b></td>
300 for ($i=100; $i>=0; $i--) {
303 choose_from_menu($numbers, "minquestions", "$form->minquestions", "");
304 helpbutton("minquestions", get_string("minimumnumberofquestions", "lesson"), "lesson");
310 <td align=
"right"><b><?php print_string("numberofpagestoshow", "lesson") ?>:
</b></td>
314 for ($i=100; $i>=0; $i--) {
317 choose_from_menu($numbers, "maxpages", "$form->maxpages", "");
318 helpbutton("maxpages", get_string("numberofpagestoshow", "lesson"), "lesson");
325 <br/><?php print_heading(get_string("lessonformating", "lesson"), "left", 4); ?>
330 <td align=
"right"><b><?php print_string("slideshow", "lesson"); ?>:
</b></td>
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");
342 <td align=
"right"><b><?php print_string("slideshowwidth", "lesson"); ?>:
</b></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"); ?>
350 <td align=
"right"><b><?php print_string("slideshowheight", "lesson"); ?>:
</b></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"); ?>
358 <td align=
"right"><b><?php print_string("slideshowbgcolor", "lesson"); ?>:
</b></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"); ?>
367 <td align=
"right"><b><?php print_string("displayleftmenu", "lesson"); ?>:
</b></td>
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");
380 <br/><?php print_heading(get_string("accesscontrol", "lesson"), "left", 4); ?>
385 <td align=
"right"><b><?php print_string("usepassword", "lesson"); ?>:
</b></td>
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");
397 <td align=
"right"><b><?php print_string("password", "lesson"); ?>:
</b></td>
399 <input type=
"text" name=
"password" size=
"7" value=
"" /> <?php echo " (".get_string("leavetokeep").")"; ?>
400 <?php helpbutton("password", get_string("password", "lesson"), "lesson"); ?>
405 <td align=
"right"><b><?php print_string("available", "lesson") ?>:
</b></td>
407 print_date_selector("availableday", "availablemonth", "availableyear", $form->available
);
408 echo " - ";
409 print_time_selector("availablehour", "availableminute", $form->available
);
414 <td align=
"right"><b><?php print_string("deadline", "lesson") ?>:
</b></td>
416 print_date_selector("deadlineday", "deadlinemonth", "deadlineyear", $form->deadline
);
417 echo " - ";
418 print_time_selector("deadlinehour", "deadlineminute", $form->deadline
);
424 <br/><?php print_heading(get_string("other", "lesson"), "left", 4); ?>
429 <td align=
"right"><b><?php print_string("treeview", "lesson"); ?>:
</b></td>
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");
441 <td align=
"right"><b><?php print_string("displayhighscores", "lesson"); ?>:
</b></td>
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");
453 <td align=
"right"><b><?php print_string("maxhighscores", "lesson"); ?>:
</b></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"); ?>
461 <td align=
"right"><b><?php print_string("lessondefault", "lesson"); ?>:
</b></td>
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");
472 if ($form->mode
!= "add") {
475 <td align=
"right"><b><?php print_string("deleteattempts", "lesson"); ?>:
</b></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; ?>" />
483 } // end if statement if ($form->mode != "add") {
485 <?php print_visible_setting($form); ?>
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
") ?>" />
499 </div
> <!-- ends
class mod
-lesson
-->