Index: moodle/mod/lamslesson/lang/en/lamslesson.php =================================================================== diff -u -rf723563ee637c0bcf6b391830f8e12e451a26258 -r3d9bff42a178790991088c19a24651e0dc5ed9ee --- moodle/mod/lamslesson/lang/en/lamslesson.php (.../lamslesson.php) (revision f723563ee637c0bcf6b391830f8e12e451a26258) +++ moodle/mod/lamslesson/lang/en/lamslesson.php (.../lamslesson.php) (revision 3d9bff42a178790991088c19a24651e0dc5ed9ee) @@ -77,6 +77,8 @@ $string['restcallfail'] = 'Call to LAMS failed: received no response or connection was refused. Please check that you have the correct LAMS server URL and that it is online.'; $string['sequencenotselected'] = 'You must select a sequence to proceed.'; $string['previewthislesson'] = 'Preview this lesson'; +$string['updatewarning'] = 'Warning: selecting another sequence than the current one will create a new lesson for the students. This might result in some slightly confused students'; +$string['currentsequence'] = 'Current sequence:'; // view.php Index: moodle/mod/lamslesson/lib.php =================================================================== diff -u -rc35069ead69cd62058df201bd7f75d289d20dd1c -r3d9bff42a178790991088c19a24651e0dc5ed9ee --- moodle/mod/lamslesson/lib.php (.../lib.php) (revision c35069ead69cd62058df201bd7f75d289d20dd1c) +++ moodle/mod/lamslesson/lib.php (.../lib.php) (revision 3d9bff42a178790991088c19a24651e0dc5ed9ee) @@ -100,11 +100,14 @@ function lamslesson_update_instance($lamslesson) { global $DB; + //Get first the original record and check whether the sequence_id has changed of not + $originallamslesson = $DB->get_record('lamslesson', array('id' => $lamslesson->instance)); $lamslesson->timemodified = time(); $lamslesson->id = $lamslesson->instance; - # You may have to add extra stuff in here # - lamslesson_add_lesson($lamslesson); + if ($originallamslesson->sequence_id != $lamslesson->sequence_id) { + lamslesson_add_lesson($lamslesson); + } return $DB->update_record('lamslesson', $lamslesson); } Index: moodle/mod/lamslesson/mod_form.php =================================================================== diff -u -rc35069ead69cd62058df201bd7f75d289d20dd1c -r3d9bff42a178790991088c19a24651e0dc5ed9ee --- moodle/mod/lamslesson/mod_form.php (.../mod_form.php) (revision c35069ead69cd62058df201bd7f75d289d20dd1c) +++ moodle/mod/lamslesson/mod_form.php (.../mod_form.php) (revision 3d9bff42a178790991088c19a24651e0dc5ed9ee) @@ -31,17 +31,27 @@ $PAGE->requires->yui2_lib('yahoo-dom-event'); $PAGE->requires->yui2_lib('treeview'); -$PAGE->requires->yui2_lib('event'); -$PAGE->requires->yui2_lib('connection'); + require_once($CFG->dirroot.'/course/moodleform_mod.php'); class mod_lamslesson_mod_form extends moodleform_mod { function definition() { global $COURSE, $USER, $CFG; + $mform =& $this->_form; -//------------------------------------------------------------------------------- + if (!empty($this->_instance)) { + $sequence_id = $this->current->sequence_id; + $currentsequence = get_string('currentsequence','lamslesson'); + $updatewarning = get_string('updatewarning','lamslesson'); + } else { + $sequence_id = 0; + $currentsequence = ''; + $updatewarning = ''; + } + + //------------------------------------------------------------------------------- /// Adding the "general" fieldset, where all the common settings are showed $mform->addElement('header', 'general', get_string('general', 'form')); @@ -120,13 +130,13 @@ //--> -