moodle/mod/lesson/mod.html
michaelpenne 62eda6ea18 NEW: Progress bar option. Now a progress bar can be optionally displayed at the bottom of the lesson page.
NEW: Display Left Menu IF.  The left menu will only display if the student has a grade better than the one set in the lesson settings.  This is nice to allow only students who are reviewing the lesson to have access to the left menu.

BUG FIX: In Windows IE, the content was being aligned center.  Now, the content is explicitly aligned to left as default.
BUG FIX: High Scores variable was not spelled correctly at the End of Lesson.

ADDED: Div tags around branch tables.  This will allow users to choose to display them or not or move them around

CHANGED: converted more of the links to the stylized button.  Also, removed a lot of forms and javascript and replaced it with links with the variables in the href.
CHANGED: the slide show styles have been moved to the style sheet.
CHANGED: removed the CDC comments

Other minor changes have been made to the code as well.
2005-10-24 23:06:43 +00:00

601 lines
19 KiB
HTML

<!-- define a new instance of lesson -->
<!-- It is used from /course/mod.php. The whole instance is available as $form. -->
<?php
require("$CFG->dirroot/mod/lesson/locallib.php"); // for parameter array
if ($form->mode == "add") {
if ($defaults = get_record("lesson_default", "course", $form->course)) {
foreach ($defaults as $name => $value) {
if (!is_numeric($name)) {
$form->$name = $value;
}
}
}
}
// set the defaults
if (empty($form->name)) {
$form->name = "";
}
if (!isset($form->grade)) {
$form->grade = 0;
}
if (!isset($form->usemaxgrade)) {
$form->usemaxgrade = 0;
}
if (!isset($form->maxanswers)) {
$form->maxanswers = 4;
}
if (!isset($form->maxattempts)) {
$form->maxattempts = 1;
}
if (!isset($form->nextpagedefault)) {
$form->nextpagedefault = 0;
}
if (!isset($form->minquestions)) {
$form->minquestions = 0;
}
if (!isset($form->maxpages)) {
$form->maxpages = 0;
}
if (!isset($form->retake)) {
$form->retake = 0;
}
if (!isset($form->available)) {
$form->available = 0;
}
if (!isset($form->deadline)) {
$currentdate = usergetdate(time());
$form->deadline = gmmktime($currentdate["hours"], $currentdate["minutes"], $currentdate["seconds"], $currentdate["mon"]+1, $currentdate["mday"], $currentdate["year"]);
}
if (!isset($form->usepassword)) {
$form->usepassword = 0;
}
if (!isset($form->custom)) {
$form->custom = 1;
}
if (!isset($form->ongoing)) {
$form->ongoing = 0;
}
if (!isset($form->timed)) {
$form->timed = 0;
}
if (!isset($form->maxtime)) {
$form->maxtime = 20;
}
if (!isset($form->tree)) {
$form->tree = 0;
}
if (!isset($form->slideshow)) {
$form->slideshow = 0;
}
if (!isset($form->width)) {
$form->width = 640;
}
if (!isset($form->height)) {
$form->height = 400;
}
if (!isset($form->bgcolor)) {
$form->bgcolor = "#FFFFFF";
}
if (!isset($form->displayleft)) {
$form->displayleft = 0;
}
if (!isset($form->displayleftif)) {
$form->displayleftif = 0;
}
if (!isset($form->progressbar)) {
$form->progressbar = 0;
}
if (!isset($form->highscores)) {
$form->highscores = 0;
}
if (!isset($form->maxhighscores)) {
$form->maxhighscores = 10;
}
if (!isset($form->practice)) {
$form->practice = 0;
}
if (!isset($form->review)) {
$form->review = 0;
}
if (!isset($form->lessondefault)) {
$form->lessondefault = 0;
}
if (!isset($form->modattempts)) {
$form->modattempts = 0;
}
if (!isset($form->mediafile)) {
$form->mediafile = '';
}
if (!isset($form->dependency)) {
$form->dependency = 0;
}
if (!isset($form->conditions)) {
$form->timespent = 0;
$form->completed = 0;
$form->gradebetterthan = 0;
} else {
$conditions = unserialize($form->conditions);
$form->timespent = $conditions->timespent;
$form->completed = $conditions->completed;
$form->gradebetterthan = $conditions->gradebetterthan;
}
$form->deleteattempts = "";
?>
<div class="mod-lesson">
<form name="form" method="post" action="mod.php">
<center>
<table cellpadding="5">
<tr>
<td>
<?php print_heading(get_string("general", "lesson"), "left", 4); ?>
</td><td></td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("name") ?>:</b></td>
<td>
<!-- 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) ?>" />
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("timed", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "timed", $form->timed, "");
helpbutton("timed", get_string("timed", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("maxtime", "lesson"); ?>:</b></td>
<td>
<input type="text" name="maxtime" maxlength="7" size="7" value="<?php p($form->maxtime) ?>" />
<?php helpbutton("maxtime", get_string("maxtime", "lesson"), "lesson"); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("maximumnumberofanswersbranches", "lesson") ?>:</b></td>
<td>
<?php
$numbers = array();
for ($i=20; $i>1; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "maxanswers", "$form->maxanswers", "");
helpbutton("maxanswers", get_string("maximumnumberofanswersbranches", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td>
<br/><?php print_heading(get_string("gradeoptions", "lesson"), "left", 4); ?>
</td><td></td>
</tr>
<tr>
<td align="right"><b><?php print_string("practice", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "practice", $form->practice, "");
helpbutton("practice", get_string("practice", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("customscoring", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "custom", $form->custom, "");
helpbutton("custom", get_string("customscoring", "lesson"), "lesson");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("maximumgrade") ?>:</b></td>
<td>
<?php
$grades = array();
for ($i=100; $i>=0; $i--) {
$grades[$i] = $i;
}
choose_from_menu($grades, "grade", "$form->grade", "");
helpbutton("grade", get_string("maximumgrade", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("canretake", "lesson", $course->student) ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "retake", $form->retake, "");
helpbutton("retake", get_string("canretake", "lesson", $course->student), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("handlingofretakes", "lesson") ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("usemean", "lesson"); $options[1] = get_string("usemaximum", "lesson");
choose_from_menu($options, "usemaxgrade", $form->usemaxgrade, "");
helpbutton("handlingofretakes", get_string("handlingofretakes", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("ongoing", "lesson"); ?>:</b></td>
<td>
<?php
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "ongoing", $form->ongoing, "");
helpbutton("ongoing", get_string("ongoing", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td>
<br/><?php print_heading(get_string("flowcontrol", "lesson"), "left", 4); ?>
</td><td></td>
</tr>
<tr>
<td align="right"><b><?php print_string("modattempts", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "modattempts", $form->modattempts, "");
helpbutton("modattempts", get_string("modattempts", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("displayreview", "lesson"); ?>:</b></td>
<td>
<?php
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "review", $form->review, "");
helpbutton("review", get_string("displayreview", "lesson"), "lesson");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("maximumnumberofattempts", "lesson") ?>:</b></td>
<td>
<?php
$numbers = array();
for ($i=10; $i>0; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "maxattempts", "$form->maxattempts", "");
helpbutton("maxattempts", get_string("maximumnumberofattempts", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("actionaftercorrectanswer", "lesson") ?>:</b></td>
<td>
<?php
choose_from_menu($LESSON_NEXTPAGE_ACTION, "nextpagedefault", $form->nextpagedefault, "");
helpbutton("nextpageaction", get_string("actionaftercorrectanswer", "lesson"), "lesson");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("minimumnumberofquestions", "lesson") ?>:</b></td>
<td>
<?php
$numbers = array();
for ($i=100; $i>=0; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "minquestions", "$form->minquestions", "");
helpbutton("minquestions", get_string("minimumnumberofquestions", "lesson"), "lesson");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("numberofpagestoshow", "lesson") ?>:</b></td>
<td>
<?php
$numbers = array();
for ($i=100; $i>=0; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "maxpages", "$form->maxpages", "");
helpbutton("maxpages", get_string("numberofpagestoshow", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td>
<br/><?php print_heading(get_string("lessonformating", "lesson"), "left", 4); ?>
</td><td></td>
</tr>
<tr>
<td align="right"><b><?php print_string("slideshow", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "slideshow", $form->slideshow, "");
helpbutton("slideshow", get_string("slideshow", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("slideshowwidth", "lesson"); ?>:</b></td>
<td>
<input type="text" name="width" maxlength="7" size="7" value="<?php p($form->width) ?>" />px
<?php helpbutton("width", get_string("slideshowwidth", "lesson"), "lesson"); ?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("slideshowheight", "lesson"); ?>:</b></td>
<td>
<input type="text" name="height" maxlength="7" size="7" value="<?php p($form->height) ?>" />px
<?php helpbutton("height", get_string("slideshowheight", "lesson"), "lesson"); ?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("slideshowbgcolor", "lesson"); ?>:</b></td>
<td>
<input type="text" name="bgcolor" maxlength="7" size="7" value="<?php p($form->bgcolor) ?>" />
<?php helpbutton("bgcolor", get_string("slideshowbgcolor", "lesson"), "lesson"); ?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("displayleftmenu", "lesson"); ?>:</b></td>
<td>
<?php
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "displayleft", $form->displayleft, "");
echo ' ';
print_string("displayleftif", "lesson", $course->student);
$options = array();
for($i = 100; $i >= 0; $i--) {
$options[$i] = $i.'%';
}
choose_from_menu($options, "displayleftif", $form->displayleftif, "");
helpbutton("displayleft", get_string("displayleftmenu", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("progressbar", "lesson"); ?>:</b></td>
<td>
<?php
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "progressbar", $form->progressbar, "");
helpbutton("progressbar", get_string("progressbar", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td>
<br/><?php print_heading(get_string("accesscontrol", "lesson"), "left", 4); ?>
</td><td></td>
</tr>
<tr>
<td align="right"><b><?php print_string("usepassword", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "usepassword", $form->usepassword, "");
helpbutton("usepassword", get_string("usepassword", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("password", "lesson"); ?>:</b></td>
<td>
<input type="text" name="password" size="7" value="" /> <?php echo " (".get_string("leavetokeep").")"; ?>
<?php helpbutton("password", get_string("password", "lesson"), "lesson"); ?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("dependencyon", "lesson"); ?>:</b></td>
<td>
<?php
$options = array();
$options[0] = get_string("none");
if (empty($form->instance)) {
$select = "course = $course->id";
} else {
$select = "course = $course->id AND id != $form->instance";
}
if ($lessons = get_records_select('lesson', $select, 'name ASC')) {
foreach($lessons as $lesson) {
$options[$lesson->id] = $lesson->name;
}
}
choose_from_menu($options, "dependency", $form->dependency, "");
?>
<?php helpbutton("password", get_string("dependency", "lesson"), "lesson"); ?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("conditionsfordependency", "lesson"); ?>:</b></td>
<td>
<table cellpadding="5px">
<tr align="center">
<td><?php print_string("timespentminutes", "lesson"); ?></td>
<td><?php print_string("completed", "lesson"); ?></td>
<td><?php print_string("gradebetterthan", "lesson"); ?></td>
</tr>
<tr align="center">
<td><input type="text" name="timespent" maxlength="7" size="7" value="<?php p($form->timespent) ?>" /></td>
<td>
<?php
if ($form->completed) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
?>
<input type="checkbox" name="completed" value="1" <?php echo $checked; ?> />
</td>
<td><input type="text" name="gradebetterthan" maxlength="7" size="7" value="<?php p($form->gradebetterthan) ?>" /></td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("available", "lesson") ?>:</b></td>
<td><?php
print_date_selector("availableday", "availablemonth", "availableyear", $form->available);
echo "&nbsp;-&nbsp;";
print_time_selector("availablehour", "availableminute", $form->available);
?></td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("deadline", "lesson") ?>:</b></td>
<td><?php
print_date_selector("deadlineday", "deadlinemonth", "deadlineyear", $form->deadline);
echo "&nbsp;-&nbsp;";
print_time_selector("deadlinehour", "deadlineminute", $form->deadline);
?></td>
</tr>
<tr>
<td>
<br/><?php print_heading(get_string("other", "lesson"), "left", 4); ?>
</td><td></td>
</tr>
<tr>
<td align="right"><b><?php print_string("treeview", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "tree", $form->tree, "");
helpbutton("tree", get_string("treeview", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("mediafile", "lesson"); ?>:</b></td>
<td>
<?PHP
$strchooseafile = get_string("chooseafile", "resource");
echo "<input name=\"mediafile\" size=\"50\" value=\"$form->mediafile\" /><br />";
button_to_popup_window ("/files/index.php?id=$course->id&choose=form.mediafile", "coursefiles", $strchooseafile, 500, 750, $strchooseafile);
helpbutton("mediafile", get_string("mediafile", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("displayhighscores", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "highscores", $form->highscores, "");
helpbutton("highscores", get_string("displayhighscores", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("maxhighscores", "lesson"); ?>:</b></td>
<td>
<input type="text" name="maxhighscores" maxlength="7" size="7" value="<?php p($form->maxhighscores) ?>" />
<?php helpbutton("maxhighscores", get_string("maxhighscores", "lesson"), "lesson"); ?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("lessondefault", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "lessondefault", $form->lessondefault, "");
helpbutton("lessondefault", get_string("lessondefault", "lesson"), "lesson");
?>
</td>
</tr>
<?php
if ($form->mode != "add") {
?>
<tr>
<td align="right"><b><?php print_string("deleteattempts", "lesson"); ?>:</b></td>
<td>
<input type="text" name="deleteattempts" size="7" value="" />
<?php helpbutton("deleteattempts", get_string("deleteattempts", "lesson"), "lesson"); ?>
<input type="hidden" name="deleteattemptsid" value="<?php echo $USER->id; ?>" />
</td>
</tr>
<?php
} // end if statement if ($form->mode != "add") {
?>
<?php print_visible_setting($form); ?>
</table>
<!-- These hidden variables are always the same -->
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" />
<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
<input type="hidden" name="section" value="<?php p($form->section) ?>" />
<input type="hidden" name="module" value="<?php p($form->module) ?>" />
<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
<input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
<input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
</center>
</form>
</div> <!-- ends class mod-lesson -->