MDL-9484 cm-idnumber implementation is incorrect
This commit is contained in:
+5
-4
@@ -92,6 +92,7 @@
|
||||
|
||||
$form->coursemodule = $cm->id;
|
||||
$form->section = $cm->section; // The section ID
|
||||
$form->cmidnumber = $cm->idnumber; // The cm IDnumber
|
||||
$form->course = $course->id;
|
||||
$form->module = $module->id;
|
||||
$form->modulename = $module->name;
|
||||
@@ -207,8 +208,8 @@
|
||||
}
|
||||
|
||||
// set cm id number
|
||||
if (isset($fromform->idnumber)) {
|
||||
set_coursemodule_idnumber($fromform->coursemodule, $fromform->idnumber);
|
||||
if (isset($fromform->cmidnumber)) {
|
||||
set_coursemodule_idnumber($fromform->coursemodule, $fromform->cmidnumber);
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "update mod",
|
||||
@@ -268,8 +269,8 @@
|
||||
set_coursemodule_visible($fromform->coursemodule, $fromform->visible);
|
||||
|
||||
// set cm idnumber
|
||||
if (isset($fromform->idnumber)) {
|
||||
set_coursemodule_idnumber($fromform->coursemodule, $fromform->idnumber);
|
||||
if (isset($fromform->cmidnumber)) {
|
||||
set_coursemodule_idnumber($fromform->coursemodule, $fromform->cmidnumber);
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "add mod",
|
||||
|
||||
@@ -68,8 +68,7 @@ class moodleform_mod extends moodleform {
|
||||
$mform->addElement('modgroupmode', 'groupmode', get_string('groupmode'));
|
||||
}
|
||||
$mform->addElement('modvisible', 'visible', get_string('visible'));
|
||||
$mform->addElement('text', 'idnumber', get_string('idnumber'));
|
||||
$mform->setDefault('idnumber', $this->_cm->idnumber);
|
||||
$mform->addElement('text', 'cmidnumber', get_string('idnumber'));
|
||||
$this->standard_hidden_coursemodule_elements();
|
||||
}
|
||||
|
||||
@@ -113,7 +112,7 @@ class moodleform_mod extends moodleform {
|
||||
* @return unknown
|
||||
*/
|
||||
function standard_coursemodule_elements_settings(){
|
||||
return ($this->modgroupmode_settings() + $this->modvisible_settings() + $this->modidnumber_settings());
|
||||
return ($this->modgroupmode_settings() + $this->modvisible_settings());
|
||||
}
|
||||
/**
|
||||
* This is called from modedit.php to load the default for the groupmode element.
|
||||
@@ -125,16 +124,6 @@ class moodleform_mod extends moodleform {
|
||||
global $COURSE;
|
||||
return array('groupmode'=>groupmode($COURSE, $this->_cm));
|
||||
}
|
||||
/**
|
||||
* This is called from modedit.php to load the default for the groupmode element.
|
||||
*
|
||||
* @param object $course
|
||||
* @param object $cm
|
||||
*/
|
||||
function modidnumber_settings() {
|
||||
global $COURSE;
|
||||
return array('idnumber'=>$this->_cm->idnumber);
|
||||
}
|
||||
/**
|
||||
* This is called from modedit.php to set the default for modvisible form element.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user