Activities can now be hidden/shown from the activity editing page. Also for modules that know about groups the groupmode can be set from there. See bug 2533. This required adding to the mod.html files calls to new functions print_visible_setting() and print_groupmode_setting() which are combined in print_standard_coursemodule_settings().

The visibility of coursemodules is now always set through the function set_coursemodule_visible() in order to make sure that the associated events get updated in the calendar appropriately.

If moving a coursemodule to a hidden section then the module is set to hidden as well and its events are hidden in the calendar.

If deleting a coursemodule its events are deleted from the calendar.

The function choose_from_menu() has an extra optional argument $disabled which, when set to true, will disable the menu.

For the sake of consistency the function set_groupmode_for_module has been renamed to set_coursemodule_groupmode and the functions show_course_module() and hide_course_module() have been combined to set_coursemodule_visible().
This commit is contained in:
gustav_delius 2005-02-12 21:41:22 +00:00
parent 2fd4148763
commit 48e535bc35
23 changed files with 336 additions and 242 deletions

View File

@ -934,11 +934,7 @@ function set_section_visible($courseid, $sectionnumber, $visibility) {
if (!empty($section->sequence)) {
$modules = explode(",", $section->sequence);
foreach ($modules as $moduleid) {
if ($visibility) {
show_course_module($moduleid);
} else {
hide_course_module($moduleid);
}
set_coursemodule_visible($moduleid, $visibility);
}
}
rebuild_course_cache($courseid);
@ -1534,34 +1530,35 @@ function add_mod_to_section($mod, $beforemod=NULL) {
}
}
function set_groupmode_for_module($id, $groupmode) {
function set_coursemodule_groupmode($id, $groupmode) {
return set_field("course_modules", "groupmode", $groupmode, "id", $id);
}
function hide_course_module($mod) {
$cm = get_record('course_modules', 'id', $mod);
function set_coursemodule_visible($id, $visible) {
$cm = get_record('course_modules', 'id', $id);
$modulename = get_field('modules', 'name', 'id', $cm->module);
if ($events = get_records_select('event', "instance = '$cm->instance' AND modulename = '$modulename'")) {
foreach($events as $event) {
hide_event($event);
if ($visible) {
show_event($event);
} else {
hide_event($event);
}
}
}
return set_field("course_modules", "visible", 0, "id", $mod);
return set_field("course_modules", "visible", $visible, "id", $id);
}
function show_course_module($mod) {
$cm = get_record('course_modules', 'id', $mod);
function delete_course_module($id) {
$cm = get_record('course_modules', 'id', $id);
$modulename = get_field('modules', 'name', 'id', $cm->module);
if ($events = get_records_select('event', "instance = '$cm->instance' AND modulename = '$modulename'")) {
foreach($events as $event) {
show_event($event);
delete_event($event);
}
}
return set_field("course_modules", "visible", 1, "id", $mod);
}
function delete_course_module($mod) {
return set_field("course_modules", "deleted", 1, "id", $mod);
return set_field("course_modules", "visible", 0, "id", $id);
return set_field("course_modules", "deleted", 1, "id", $id);
}
function delete_mod_from_section($mod, $section) {
@ -1634,10 +1631,13 @@ function moveto_module($mod, $section, $beforemod=NULL) {
if ($mod->section != $section->id) {
$mod->section = $section->id;
if (!update_record("course_modules", $mod)) {
return false;
}
// if moving to a hidden section then hide module
if (!$section->visible) {
set_coursemodule_visible($mod->id, 0);
}
}
/// Add the module into the new section
@ -1776,4 +1776,73 @@ function course_in_meta ($course) {
return record_exists("course_meta","child_course",$course->id);
}
/**
* Print standard form elements on module setup forms in mod/.../mod.html
*/
function print_standard_coursemodule_settings($form) {
print_groupmode_setting($form);
print_visible_setting($form);
}
/**
* Print groupmode form element on module setup forms in mod/.../mod.html
*/
function print_groupmode_setting($form) {
if (! $course = get_record('course', 'id', $form->course)) {
error("This course doesn't exist");
}
if ($form->coursemodule) {
if (! $cm = get_record('course_modules', 'id', $form->coursemodule)) {
error("This course module doesn't exist");
}
} else {
$cm = null;
}
$groupmode = groupmode($course, $cm);
if ($course->groupmode or (!$course->groupmodeforce)) {
echo '<tr valign="top">';
echo '<td align="right"><b>'.get_string('groupmode').':</b></td>';
echo '<td>';
unset($choices);
$choices[NOGROUPS] = get_string('groupsnone');
$choices[SEPARATEGROUPS] = get_string('groupsseparate');
$choices[VISIBLEGROUPS] = get_string('groupsvisible');
choose_from_menu($choices, 'groupmode', $groupmode, '', '', 0, false, $course->groupmodeforce);
helpbutton('groupmode', get_string('groupmode'));
echo '</td></tr>';
}
}
/**
* Print visibility setting form element on module setup forms in mod/.../mod.html
*/
function print_visible_setting($form) {
if ($form->coursemodule) {
$visible = get_field('course_modules', 'visible', 'id', $form->coursemodule);
} else {
$visible = true;
}
if ($form->mode == 'add') { // in this case $form->section is the section number, not the id
$hiddensection = !get_field('course_sections', 'visible', 'section', $form->section, 'course', $form->course);
} else {
$hiddensection = !get_field('course_sections', 'visible', 'id', $form->section);
}
if ($hiddensection) {
$visible = false;
}
echo '<tr valign="top">';
echo '<td align="right"><b>'.get_string('showimmediately').':</b></td>';
echo '<td>';
unset($choices);
$choices[1] = get_string('yes');
$choices[0] = get_string('no');
choose_from_menu($choices, 'visible', $visible, '', '', 0, false, $hiddensection);
echo '</td></tr>';
}
?>

View File

@ -67,6 +67,20 @@
if (is_string($return)) {
error($return, "view.php?id=$course->id");
}
// to deal with pre-1.5 modules
if (!isset($mod->visible)) {
//We get the section's visible field status
$mod->visible = get_field("course_sections","visible","id",$sectionid);
}
if (!isset($mod->groupmode)) {
$course = get_record('course', 'id', $mod->course);
$cm = get_record('course_modules', 'id', $mod->coursemodule);
$mod->groupmode = groupmode($course, $cm);
}
set_coursemodule_visible($mod->coursemodule, $mod->visible);
set_coursemodule_groupmode($mod->coursemodule, $mod->groupmode);
if (isset($mod->redirect)) {
$SESSION->returnpage = $mod->redirecturl;
@ -113,12 +127,18 @@
if (! $sectionid = add_mod_to_section($mod) ) {
error("Could not add the new course module to that section");
}
//We get the section's visible field status
$visible = get_field("course_sections","visible","id",$sectionid);
if (! set_field("course_modules", "visible", $visible, "id", $mod->coursemodule)) {
error("Could not update the course module with the correct visibility");
}
// to deal with pre-1.5 modules
if (!isset($mod->visible)) {
//We get the section's visible field status
$mod->visible = get_field("course_sections","visible","id",$sectionid);
}
if (!isset($mod->groupmode)) {
$mod->groupmode = get_field('course', 'groupmode', 'id', $mod->course);
}
set_coursemodule_visible($mod->coursemodule, $mod->visible);
set_coursemodule_groupmode($mod->coursemodule, $mod->groupmode);
if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
error("Could not update the course module with the correct section");
@ -250,7 +270,7 @@
error("You can't modify this course!");
}
hide_course_module($cm->id);
set_coursemodule_visible($cm->id, 0);
rebuild_course_cache($cm->course);
@ -280,7 +300,7 @@
}
if ($module->visible and ($section->visible or (SITEID == $cm->course))) {
show_course_module($cm->id);
set_coursemodule_visible($cm->id, 1);
rebuild_course_cache($cm->course);
}
@ -301,7 +321,7 @@
error("You can't modify this course!");
}
set_groupmode_for_module($cm->id, $_GET['groupmode']);
set_coursemodule_groupmode($cm->id, $_GET['groupmode']);
rebuild_course_cache($cm->course);

View File

@ -916,6 +916,7 @@ $string['showalltopics'] = 'Show all topics';
$string['showallusers'] = 'Show all users';
$string['showallweeks'] = 'Show all weeks';
$string['showgrades'] = 'Show grades';
$string['showimmediately'] = 'Show immediately';
$string['showlistofcourses'] = 'Show list of courses';
$string['showonlytopic'] = 'Show only topic $a';
$string['showonlyweek'] = 'Show only week $a';

View File

@ -600,19 +600,18 @@ function close_window_button() {
* @param type description
* @todo Finish documenting this function
*/
function choose_from_menu ($options, $name, $selected='', $nothing='choose', $script='', $nothingvalue='0', $return=false) {
function choose_from_menu ($options, $name, $selected='', $nothing='choose', $script='', $nothingvalue='0', $return=false, $disabled=false) {
if ($nothing == 'choose') {
$nothing = get_string('choose') .'...';
}
if ($script) {
$javascript = 'onchange="'. $script .'"';
} else {
$javascript = '';
$attributes = ($script) ? 'onchange="'. $script .'"' : '';
if ($disabled) {
$attributes .= ' disabled="disabled"';
}
$output = '<select name="'. $name .'" '. $javascript .'>' . "\n";
$output = '<select name="'. $name .'" '. $attributes .'>' . "\n";
if ($nothing) {
$output .= ' <option value="'. $nothingvalue .'"'. "\n";
if ($nothingvalue === $selected) {

View File

@ -111,11 +111,11 @@
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("maximumsize", "assignment") ?>:</b></td>
<td><?php
<td><?php
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
choose_from_menu ($choices, "maxbytes", $form->maxbytes, "");
?>
</td>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("duedate", "assignment") ?>:</b></td>
@ -125,6 +125,7 @@
print_time_selector("duehour", "dueminute", $form->timedue);
?></td>
</tr>
<?php print_standard_coursemodule_settings($form); ?>
</table>
<br />
<center>

View File

@ -20,13 +20,13 @@ if (empty($form->grade)) {
// error_reporting(E_ALL);
// if we're adding a new instance
if (empty($form->id)) {
if (isset($CFG->attendance_dynsection) && ($CFG->attendance_dynsection == "1")) { $form->dynsection = 1; }
if (isset($CFG->attendance_autoattend) && ($CFG->attendance_autoattend == "1")) { $form->autoattend = 1; }
if (isset($CFG->attendance_grade) && ($CFG->attendance_grade == "1")) { $form->grade = 1; }
$form->maxgrade = isset($CFG->attendance_maxgrade)?$CFG->attendance_maxgrade:0;
$form->hours = isset($CFG->attendance_default_hours)?$CFG->attendance_default_hours:1;
$form->day = time();
$form->notes = "";
if (isset($CFG->attendance_dynsection) && ($CFG->attendance_dynsection == "1")) { $form->dynsection = 1; }
if (isset($CFG->attendance_autoattend) && ($CFG->attendance_autoattend == "1")) { $form->autoattend = 1; }
if (isset($CFG->attendance_grade) && ($CFG->attendance_grade == "1")) { $form->grade = 1; }
$form->maxgrade = isset($CFG->attendance_maxgrade)?$CFG->attendance_maxgrade:0;
$form->hours = isset($CFG->attendance_default_hours)?$CFG->attendance_default_hours:1;
$form->day = time();
$form->notes = "";
}
?>
<form name="form" method="post" action="<?php echo $ME ?>">
@ -44,7 +44,6 @@ if (empty($form->id)) {
<input type="text" name="name" size="60" value="<?php p($form->notes)?>" alt="<?php print_string("name") ?>" />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("dayofroll", "attendance") ?>:</b></td>
<td colspan="3"><?php print_date_selector("theday", "themonth", "theyear", $form->day) ?></td>
@ -106,7 +105,7 @@ for ($i=0;$i<=100;$i++){ $opt2[$i] = $i; } ?>
helpbutton("maxgrade", get_string("maxgradevalue","attendance"), "attendance");
?></td>
</tr>
<?php print_visible_setting($form); ?>
</table>
@ -120,7 +119,7 @@ for ($i=0;$i<=100;$i++){ $opt2[$i] = $i; } ?>
foreach ($rolls as $roll) {
$sroll[$roll->userid][$roll->hour]->status=$roll->status;
$sroll[$roll->userid][$roll->hour]->notes=$roll->notes;
}
}
}
// get the list of students along with student ID field
// get back array of stdclass objects in sorted order, with members:
@ -135,27 +134,27 @@ for ($i=0;$i<=100;$i++){ $opt2[$i] = $i; } ?>
echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ".
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
if ($form->hours >1) {
echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
"Hours:</th>\n";
for($i=1;$i<=$form->hours;$i++) {
echo "<th valign=\"top\" align=\"center\" colspan=\"3\" nowrap class=\"generaltableheader\">".
"$i</th>\n";
}
echo "</tr>\n";
echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
"Hours:</th>\n";
for($i=1;$i<=$form->hours;$i++) {
echo "<th valign=\"top\" align=\"center\" colspan=\"3\" nowrap class=\"generaltableheader\">".
"$i</th>\n";
}
echo "</tr>\n";
} // if more than one hour for each day
echo "<tr><th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">Last Name</th>\n";
echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">First Name</th>\n";
echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">ID</th>\n";
echo "<tr><th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">Last Name</th>\n";
echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">First Name</th>\n";
echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">ID</th>\n";
$P=get_string("presentshort","attendance");
$T=get_string("tardyshort","attendance");
$A=get_string("absentshort","attendance");
// generate the headers for the attendance hours
for($i=1;$i<=$form->hours;$i++) {
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$P."</th>\n";
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$T."</th>\n";
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$A."</th>\n";
}
echo "</tr>\n";
for($i=1;$i<=$form->hours;$i++) {
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$P."</th>\n";
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$T."</th>\n";
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$A."</th>\n";
}
echo "</tr>\n";
$table->head = array("Last Name","First Name","ID",
get_string("presentlong","attendance"),
get_string("tardylong","attendance"),
@ -170,27 +169,27 @@ if ($form->hours >1) {
echo "<tr><td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$student->lastname."</td>\n";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$student->firstname."</td>\n";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$student->idnumber."</td>\n";
for($j=1;$j<=$form->hours;$j++) {
for($j=1;$j<=$form->hours;$j++) {
// set the attendance defaults for each student
$r1c=$r2c=$r3c=" ";
$r1c=$r2c=$r3c=" ";
$rollstatus = (($form->edited==0)?$CFG->attendance_default_student_status:
((isset($sroll[$student->id][$j]->status)?$sroll[$student->id][$j]->status:0)));
if ($rollstatus==1) {$r2c="checked=\"checked\"";}
elseif ($rollstatus==2) {$r3c="checked=\"checked\"";}
else {$r1c="checked=\"checked\"";}
$radio1="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"0\" ".$r1c." />";
$radio2="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"1\" ".$r2c." />";
$radio3="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"2\" ".$r3c." />";
$radio2="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"1\" ".$r2c." />";
$radio3="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"2\" ".$r3c." />";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$radio1."</td>\n";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$radio2."</td>\n";
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$radio3."</td>\n";
} // for loop
} // for loop
echo "</tr>\n";
// $radio1="<input type=\"radio\" name=\"student_".$student->id."\" value=\"0\" checked=\"checked\" />";
// $radio2="<input type=\"radio\" name=\"student_".$student->id."\" value=\"1\" />";
// $radio2="<input type=\"radio\" name=\"student_".$student->id."\" value=\"1\" />";
// $radio3="<input type=\"radio\" name=\"student_".$student->id."\" value=\"2\" />";
// $table->data[$i]=array($student->lastname, $student->firstname,
// $student->idnumber, $radio1,$radio2,$radio3);
// $student->idnumber, $radio1,$radio2,$radio3);
// $i++;
}
// doing the table manually now

View File

@ -61,8 +61,8 @@
?></td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('savemessages', 'chat')?>:</b></td>
<td>
<td align="right"><b><?php print_string('savemessages', 'chat')?>:</b></td>
<td>
<?php
unset($options);
$options[0] = get_string('neverdeletemessages', 'chat');
@ -83,8 +83,8 @@
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('studentseereports', 'chat')?>:</b></td>
<td>
<td align="right"><b><?php print_string('studentseereports', 'chat')?>:</b></td>
<td>
<?php
unset($options);
$options[0] = get_string('no');
@ -93,7 +93,7 @@
?>
</td>
</tr>
<?php print_standard_coursemodule_settings($form); ?>
</table>
<center>
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
@ -107,4 +107,4 @@
<input type="submit" value="<?php print_string('savechanges') ?>" />
<input type="submit" name="cancel" value="<?php print_string('cancel') ?>" />
</center>
</form>
</form>

View File

@ -258,7 +258,7 @@
<br />
</td>
</tr>
<?php print_standard_coursemodule_settings($form); ?>
</table>
<center>

View File

@ -48,9 +48,9 @@ print_heading_with_help(get_string("furtherinformation", "dialogue"), "info", "d
<td align="right"><p><b><?php print_string("deleteafter", "dialogue") ?>:</b></p></td>
<td>
<?php
require("$CFG->dirroot/mod/dialogue/lib.php");
choose_from_menu($DIALOGUE_DAYS, "deleteafter", $form->deleteafter, "");
helpbutton("deleteafter", get_string("deleteafter", "dialogue"), "dialogue");
require("$CFG->dirroot/mod/dialogue/lib.php");
choose_from_menu($DIALOGUE_DAYS, "deleteafter", $form->deleteafter, "");
helpbutton("deleteafter", get_string("deleteafter", "dialogue"), "dialogue");
?>
</td>
</tr>
@ -91,7 +91,7 @@ print_heading_with_help(get_string("furtherinformation", "dialogue"), "info", "d
?>
</td>
</tr>
<?php print_standard_coursemodule_settings($form); ?>
</table>
<center>

View File

@ -1,12 +1,12 @@
<?php
require("$CFG->dirroot/mod/exercise/lib.php"); // for parameter arrays
// ...and fill the form if needed
require("$CFG->dirroot/mod/exercise/lib.php"); // for parameter arrays
// ...and fill the form if needed
if (empty($form->name)) {
$form->name = "";
}
if (!isset($form->gradingstrategy)) {
$form->gradingstrategy = 1;
}
$form->gradingstrategy = 1;
}
if (empty($form->usemaximum)) {
$form->usemaximum = 0;
}
@ -28,7 +28,7 @@
if (empty($form->deadline)) {
$form->deadline = "";
}
if (!isset($form->usepassword)) {
if (!isset($form->usepassword)) {
$form->usepassword = 0;
}
if (empty($form->showleaguetable)) {
@ -54,7 +54,7 @@
<td align="right"><b><?php print_string("description", "exercise") ?>:</b></td>
<td>
<?php
echo get_string("descriptionofexercise", "exercise", $course->students);
echo get_string("descriptionofexercise", "exercise", $course->students);
?>
</td>
</tr>
@ -120,10 +120,10 @@
<td align="right"><b><?php print_string("comparisonofassessments", "exercise") ?>:</b></td>
<td>
<?php
// set up comparison names
// set up comparison names
foreach ($EXERCISE_ASSESSMENT_COMPS as $KEY => $COMPARISON) {
$COMPARISONS[] = $COMPARISON['name'];
}
}
choose_from_menu($COMPARISONS, "assessmentcomps", $form->assessmentcomps, "");
helpbutton("comparisonofassessments", get_string("comparisonofassessments", "exercise"), "exercise");
?>
@ -135,7 +135,7 @@
<td>
<?php
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "usepassword", $form->usepassword, "");
choose_from_menu($options, "usepassword", $form->usepassword, "");
helpbutton("usepassword", get_string("usepassword", "exercise"), "exercise");
?>
</td>
@ -145,7 +145,7 @@
<td align="right"><b><?php print_string("password"); ?>:</b></td>
<td>
<input type="text" name="password" size="10" value="" alt="<?php print_string("password"); ?>" /> <?php echo " (".get_string("leavetokeep").")"; ?>
<?php helpbutton("password", get_string("password"), "exercise"); ?>
<?php helpbutton("password", get_string("password"), "exercise"); ?>
</td>
</tr>
@ -208,7 +208,7 @@
?>
</td>
</tr>
<?php print_standard_coursemodule_settings($form); ?>
<tr>
<td colspan="2">

View File

@ -266,6 +266,7 @@
?>
</td>
</tr>
<?php print_standard_coursemodule_settings($form); ?>
</table>
<center>
<input type="hidden" name="course" value="<?php p($form->course) ?>" />

View File

@ -95,7 +95,7 @@ if (!isset($form->assesstimefinish)) {
<tr valign="top">
<td align="right"><b><?php echo get_string("entbypage", "glossary") ?>:</b></td>
<td align="left">
<input name="entbypage" type="text" size="2" value="<?php p($form->entbypage) ?>" /> <?php helpbutton("entbypage", get_string("entbypage", "glossary"), "glossary") ?>
<input name="entbypage" type="text" size="2" value="<?php p($form->entbypage) ?>" /> <?php helpbutton("entbypage", get_string("entbypage", "glossary"), "glossary") ?>
</td>
</tr>
@ -147,7 +147,7 @@ if (!$mainglossary or $mainglossary->id == $form->instance ) {
</tr>
<?php
} else {
echo "<input type=\"hidden\" name=\"mainglossary\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"mainglossary\" value=\"0\" />";
}
?>
<tr valign="top">
@ -498,6 +498,7 @@ if (!$mainglossary or $mainglossary->id == $form->instance ) {
?>
</td>
</tr>
<?php print_visible_setting($form); ?>
</table>
<!-- These hidden variables are always the same -->
<input type="hidden" name="course" value="<?php p($form->course) ?>" />

View File

@ -91,7 +91,7 @@
?>
</td>
</tr>
<?php print_standard_coursemodule_settings($form); ?>
</table>
<center>
<input type="hidden" name="course" value="<?php p($form->course) ?>" />

View File

@ -4,13 +4,13 @@
require_once("styles.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;
}
}
}
if ($defaults = get_record("lesson_default", "course", $form->course)) {
foreach ($defaults as $name => $value) {
if (!is_numeric($name)) {
$form->$name = $value;
}
}
}
}
// set the defaults
@ -45,11 +45,11 @@ if ($form->mode == "add") {
$form->available = 0;
}
if (!isset($form->deadline)) {
$currentdate = usergetdate(time());
$currentdate = usergetdate(time());
$form->deadline = gmmktime($currentdate["hours"], $currentdate["minutes"], $currentdate["seconds"], $currentdate["mon"]+1, $currentdate["mday"], $currentdate["year"]);
}
/// CDC-FLAG ///
if (!isset($form->usepassword)) {
/// CDC-FLAG ///
if (!isset($form->usepassword)) {
$form->usepassword = 0;
}
if (!isset($form->custom)) {
@ -79,32 +79,32 @@ if ($form->mode == "add") {
if (!isset($form->bgcolor)) {
$form->bgcolor = "#FFFFFF";
}
if (!isset($form->displayleft)) {
$form->displayleft = 0;
}
if (!isset($form->highscores)) {
$form->highscores = 0;
}
if (!isset($form->displayleft)) {
$form->displayleft = 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->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;
}
$form->deleteattempts = "";
$form->deleteattempts = "";
/// CDC-FLAG ///
/// CDC-FLAG ///
?>
<form name="form" method="post" action="<?php echo $ME ?>">
@ -113,9 +113,9 @@ if ($form->mode == "add") {
<table cellpadding="5">
<tr>
<td>
<?php print_heading(get_string("general", "lesson"), "left", 4); ?>
</td><td></td>
<td>
<?php print_heading(get_string("general", "lesson"), "left", 4); ?>
</td><td></td>
</tr>
<tr valign="top">
@ -129,9 +129,9 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("timed", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "timed", $form->timed, "");
choose_from_menu($options, "timed", $form->timed, "");
helpbutton("timed", get_string("timed", "lesson"), "lesson");
?>
</td>
@ -141,7 +141,7 @@ if ($form->mode == "add") {
<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"); ?>
<?php helpbutton("maxtime", get_string("maxtime", "lesson"), "lesson"); ?>
</td>
</tr>
@ -149,7 +149,7 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("maximumnumberofanswersbranches", "lesson") ?>:</b></td>
<td>
<?php
$numbers = array();
$numbers = array();
for ($i=20; $i>1; $i--) {
$numbers[$i] = $i;
}
@ -160,18 +160,18 @@ if ($form->mode == "add") {
</tr>
<tr>
<td>
<br/><?php print_heading(get_string("gradeoptions", "lesson"), "left", 4); ?>
</td><td></td>
<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 = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "practice", $form->practice, "");
choose_from_menu($options, "practice", $form->practice, "");
helpbutton("practice", get_string("practice", "lesson"), "lesson");
?>
</td>
@ -181,9 +181,9 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("customscoring", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "custom", $form->custom, "");
choose_from_menu($options, "custom", $form->custom, "");
helpbutton("custom", get_string("customscoring", "lesson"), "lesson");
?>
</td>
@ -193,7 +193,7 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("maximumgrade") ?>:</b></td>
<td>
<?php
$grades = array();
$grades = array();
for ($i=100; $i>=0; $i--) {
$grades[$i] = $i;
}
@ -207,7 +207,7 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("canretake", "lesson", $course->student) ?>:</b></td>
<td>
<?PHP
$options = array();
$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");
@ -219,7 +219,7 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("handlingofretakes", "lesson") ?>:</b></td>
<td>
<?PHP
$options = array();
$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");
@ -231,27 +231,27 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("ongoing", "lesson"); ?>:</b></td>
<td>
<?php
$options = array();
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "ongoing", $form->ongoing, "");
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>
<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 = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "modattempts", $form->modattempts, "");
choose_from_menu($options, "modattempts", $form->modattempts, "");
helpbutton("modattempts", get_string("modattempts", "lesson"), "lesson");
?>
</td>
@ -261,9 +261,9 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("displayreview", "lesson"); ?>:</b></td>
<td>
<?php
$options = array();
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "review", $form->review, "");
choose_from_menu($options, "review", $form->review, "");
helpbutton("review", get_string("displayreview", "lesson"), "lesson");
?>
</td>
@ -322,18 +322,18 @@ if ($form->mode == "add") {
</tr>
<tr>
<td>
<br/><?php print_heading(get_string("lessonformating", "lesson"), "left", 4); ?>
</td><td></td>
<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 = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "slideshow", $form->slideshow, "");
choose_from_menu($options, "slideshow", $form->slideshow, "");
helpbutton("slideshow", get_string("slideshow", "lesson"), "lesson");
?>
</td>
@ -343,7 +343,7 @@ if ($form->mode == "add") {
<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"); ?>
<?php helpbutton("width", get_string("slideshowwidth", "lesson"), "lesson"); ?>
</td>
</tr>
@ -351,7 +351,7 @@ if ($form->mode == "add") {
<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"); ?>
<?php helpbutton("height", get_string("slideshowheight", "lesson"), "lesson"); ?>
</td>
</tr>
@ -359,7 +359,7 @@ if ($form->mode == "add") {
<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"); ?>
<?php helpbutton("bgcolor", get_string("slideshowbgcolor", "lesson"), "lesson"); ?>
</td>
</tr>
@ -368,27 +368,27 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("displayleftmenu", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "displayleft", $form->displayleft, "");
choose_from_menu($options, "displayleft", $form->displayleft, "");
helpbutton("displayleft", get_string("displayleftmenu", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td>
<br/><?php print_heading(get_string("accesscontrol", "lesson"), "left", 4); ?>
</td><td></td>
<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 = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "usepassword", $form->usepassword, "");
choose_from_menu($options, "usepassword", $form->usepassword, "");
helpbutton("usepassword", get_string("usepassword", "lesson"), "lesson");
?>
</td>
@ -398,7 +398,7 @@ if ($form->mode == "add") {
<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"); ?>
<?php helpbutton("password", get_string("password", "lesson"), "lesson"); ?>
</td>
</tr>
@ -416,23 +416,23 @@ if ($form->mode == "add") {
<td><?php
print_date_selector("deadlineday", "deadlinemonth", "deadlineyear", $form->deadline);
echo "&nbsp;-&nbsp;";
print_time_selector("deadlinehour", "deadlineminute", $form->deadline);
print_time_selector("deadlinehour", "deadlineminute", $form->deadline);
?></td>
</tr>
<tr>
<td>
<br/><?php print_heading(get_string("other", "lesson"), "left", 4); ?>
</td><td></td>
<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 = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "tree", $form->tree, "");
choose_from_menu($options, "tree", $form->tree, "");
helpbutton("tree", get_string("treeview", "lesson"), "lesson");
?>
</td>
@ -442,9 +442,9 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("displayhighscores", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "highscores", $form->highscores, "");
choose_from_menu($options, "highscores", $form->highscores, "");
helpbutton("highscores", get_string("displayhighscores", "lesson"), "lesson");
?>
</td>
@ -454,7 +454,7 @@ if ($form->mode == "add") {
<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"); ?>
<?php helpbutton("maxhighscores", get_string("maxhighscores", "lesson"), "lesson"); ?>
</td>
</tr>
@ -462,28 +462,28 @@ if ($form->mode == "add") {
<td align="right"><b><?php print_string("lessondefault", "lesson"); ?>:</b></td>
<td>
<?PHP
$options = array();
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "lessondefault", $form->lessondefault, "");
choose_from_menu($options, "lessondefault", $form->lessondefault, "");
helpbutton("lessondefault", get_string("lessondefault", "lesson"), "lesson");
?>
</td>
</tr>
<?php
if ($form->mode != "add") {
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; ?>" />
<?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") {
} // 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) ?>" />

View File

@ -351,7 +351,7 @@
</td>
</tr>
<?php } ?>
<?php print_standard_coursemodule_settings($form); ?>
</table>

View File

@ -13,4 +13,4 @@
<p><?php print_string("directoryinfo", "resource") ?></p>
</td>
</tr>
<?php print_visible_setting($form); ?>

View File

@ -193,4 +193,4 @@ for ($i=0; $i < $this->maxparameters; $i++) {
</td></tr>
<?php print_visible_setting($form); ?>

View File

@ -121,3 +121,4 @@
</td></tr>
<?php print_visible_setting($form); ?>

View File

@ -135,5 +135,5 @@
</td></tr>
<?php print_visible_setting($form); ?>

View File

@ -1,76 +1,77 @@
<?php
if (empty($form->name)) {
$form->name = "";
$form->name = "";
}
if (empty($form->reference)) {
$form->reference = "";
$form->reference = "";
}
if (empty($form->summary)) {
$form->summary = "";
$form->summary = "";
}
if (empty($form->launch)) {
$form->launch = "";
$form->launch = "";
}
?>
<form name="form" method="post" action="<?php echo $CFG->wwwroot ?>/mod/scorm/details.php">
<table cellpadding="5">
<tr valign="top">
<td align="right"><b><?php print_string("name") ?>:</b></td>
<td>
<input type="text" name="name" size="50" value="<?php p($form->name) ?>" alt="<?php print_string("name") ?>" />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("name") ?>:</b></td>
<td>
<input type="text" name="name" size="50" value="<?php p($form->name) ?>" alt="<?php print_string("name") ?>" />
</td>
</tr>
<?php
$strfilename = get_string("coursepacket", "scorm");
$strchooseafile = get_string("chooseapacket", "scorm");
?>
<tr valign="top">
<td align="right" nowrap="nowrap">
<b><?php echo $strfilename?>:</b>
</td>
<td>
<?php
echo "<input name=\"reference\" size=\"50\" value=\"$form->reference\" alt=\"$strfilename\" />&nbsp;";
button_to_popup_window ("/files/index.php?id=$course->id&amp;choose=form.reference",
"coursefiles", $strchooseafile, 500, 750, $strchooseafile);
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("summary") ?>:</b><br />
<font size="1">
<?php
helpbutton("summary", get_string("summary"), "scorm", true, true);
echo "<br />";
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton("text", get_string("helptext"), "moodle", true, true);
?>
</font>
</td>
<td>
<tr valign="top">
<td align="right" nowrap="nowrap">
<b><?php echo $strfilename?>:</b>
</td>
<td>
<?php
echo "<input name=\"reference\" size=\"50\" value=\"$form->reference\" alt=\"$strfilename\" />&nbsp;";
button_to_popup_window ("/files/index.php?id=$course->id&amp;choose=form.reference",
"coursefiles", $strchooseafile, 500, 750, $strchooseafile);
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("summary") ?>:</b><br />
<font size="1">
<?php
helpbutton("summary", get_string("summary"), "scorm", true, true);
echo "<br />";
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton("text", get_string("helptext"), "moodle", true, true);
?>
</font>
</td>
<td>
<?php print_textarea($usehtmleditor, 20, 50, 680, 400, "summary", $form->summary); ?>
</td>
</tr>
</td>
</tr>
<?php print_visible_setting($form); ?>
</table>
<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="datadir" value="<?php p($form->datadir) ?>" />
<input type="hidden" name="launch" value="<?php p($form->launch) ?>" />
<input type="hidden" name="popup" value="<?php p($form->popup) ?>" />
<input type="hidden" name="auto" value="<?php p($form->auto) ?>" />
<input type="hidden" name="maxgrade" value="<?php p($form->maxgrade) ?>" />
<input type="hidden" name="grademethod" value="<?php p($form->grademethod) ?>" />
<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="hidden" name="destination" value="<?php echo $ME ?>" />
<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="datadir" value="<?php p($form->datadir) ?>" />
<input type="hidden" name="launch" value="<?php p($form->launch) ?>" />
<input type="hidden" name="popup" value="<?php p($form->popup) ?>" />
<input type="hidden" name="auto" value="<?php p($form->auto) ?>" />
<input type="hidden" name="maxgrade" value="<?php p($form->maxgrade) ?>" />
<input type="hidden" name="grademethod" value="<?php p($form->grademethod) ?>" />
<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="hidden" name="destination" value="<?php echo $ME ?>" />
<center>
<input type="submit" value="<?php print_string("continue") ?>" />
<input type="submit" value="<?php print_string("continue") ?>" />
</center>
</form>

View File

@ -35,6 +35,7 @@
?>
</td>
</tr>
<?php print_standard_coursemodule_setting($form); ?>
</table>
<center>
<input type="hidden" name="intro" value="<?php p($form->intro) ?>" />

View File

@ -203,7 +203,7 @@
?>
</td>
</tr>
<?php print_visible_setting($form); ?>
</table>
<!-- These hidden variables are always the same -->
<input type="hidden" name="course" value="<?php p($form->course) ?>" />

View File

@ -419,7 +419,7 @@
helpbutton("releasegrades", get_string("releaseteachergrades", "workshop"), "workshop");
?></td>
</tr>
<?php print_visible_setting($form); ?>
</table>
<br />
<center>