Skip to content
Browse files

MDL-26644 course: Remove useless setting completionstartonenrol

This commit removes any trace of the setting 'Completion tracking
begins on enrolment' as it does not appear to do anything.
  • Loading branch information...
1 parent 373a8e0 commit 8819a836017cf762ab4bbb91034c3864d4059bc9 @FMCorz FMCorz committed Mar 22, 2013
View
1 admin/settings/courses.php
@@ -80,7 +80,6 @@
$temp->add(new admin_setting_configselect('moodlecourse/enablecompletion', new lang_string('completion','completion'), '',
0, array(0 => new lang_string('completiondisabled','completion'), 1 => new lang_string('completionenabled','completion'))));
- $temp->add(new admin_setting_configcheckbox('moodlecourse/completionstartonenrol', new lang_string('completionstartonenrol','completion'), new lang_string('completionstartonenrolhelp', 'completion'), 0));
$ADMIN->add('courses', $temp);
/// "courserequests" settingpage
View
8 course/edit_form.php
@@ -251,18 +251,10 @@ function definition() {
$mform->addElement('select', 'enablecompletion', get_string('completion','completion'),
array(0=>get_string('completiondisabled','completion'), 1=>get_string('completionenabled','completion')));
$mform->setDefault('enablecompletion', $courseconfig->enablecompletion);
-
- $mform->addElement('advcheckbox', 'completionstartonenrol', get_string('completionstartonenrol', 'completion'));
- $mform->setDefault('completionstartonenrol', $courseconfig->completionstartonenrol);
- $mform->disabledIf('completionstartonenrol', 'enablecompletion', 'eq', 0);
} else {
$mform->addElement('hidden', 'enablecompletion');
$mform->setType('enablecompletion', PARAM_INT);
$mform->setDefault('enablecompletion',0);
-
- $mform->addElement('hidden', 'completionstartonenrol');
- $mform->setType('completionstartonenrol', PARAM_INT);
- $mform->setDefault('completionstartonenrol',0);
}
/// customizable role names in this course
View
21 course/externallib.php
@@ -344,7 +344,6 @@ public static function get_courses($options = array()) {
$courseinfo['timemodified'] = $course->timemodified;
$courseinfo['forcetheme'] = $course->theme;
$courseinfo['enablecompletion'] = $course->enablecompletion;
- $courseinfo['completionstartonenrol'] = $course->completionstartonenrol;
$courseinfo['completionnotify'] = $course->completionnotify;
$courseinfo['courseformatoptions'] = array();
foreach ($courseformatoptions as $key => $value) {
@@ -418,10 +417,6 @@ public static function get_courses_returns() {
'Enabled, control via completion and activity settings. Disbaled,
not shown in activity settings.',
VALUE_OPTIONAL),
- 'completionstartonenrol' => new external_value(PARAM_INT,
- '1: begin tracking a student\'s progress in course completion
- after course enrolment. 0: does not',
- VALUE_OPTIONAL),
'completionnotify' => new external_value(PARAM_INT,
'1: yes 0: no', VALUE_OPTIONAL),
'lang' => new external_value(PARAM_SAFEDIR,
@@ -494,10 +489,6 @@ public static function create_courses_parameters() {
'Enabled, control via completion and activity settings. Disabled,
not shown in activity settings.',
VALUE_OPTIONAL),
- 'completionstartonenrol' => new external_value(PARAM_INT,
- '1: begin tracking a student\'s progress in course completion after
- course enrolment. 0: does not',
- VALUE_OPTIONAL),
'completionnotify' => new external_value(PARAM_INT,
'1: yes 0: no', VALUE_OPTIONAL),
'lang' => new external_value(PARAM_SAFEDIR,
@@ -579,12 +570,8 @@ public static function create_courses($courses) {
if (!array_key_exists('enablecompletion', $course)) {
$course['enablecompletion'] = $courseconfig->enablecompletion;
}
- if (!array_key_exists('completionstartonenrol', $course)) {
- $course['completionstartonenrol'] = $courseconfig->completionstartonenrol;
- }
} else {
$course['enablecompletion'] = 0;
- $course['completionstartonenrol'] = 0;
}
$course['category'] = $course['categoryid'];
@@ -670,9 +657,6 @@ public static function update_courses_parameters() {
'enablecompletion' => new external_value(PARAM_INT,
'Enabled, control via completion and activity settings. Disabled,
not shown in activity settings.', VALUE_OPTIONAL),
- 'completionstartonenrol' => new external_value(PARAM_INT,
- '1: begin tracking a student\'s progress in course completion after
- course enrolment. 0: does not', VALUE_OPTIONAL),
'completionnotify' => new external_value(PARAM_INT, '1: yes 0: no', VALUE_OPTIONAL),
'lang' => new external_value(PARAM_SAFEDIR, 'forced course language', VALUE_OPTIONAL),
'forcetheme' => new external_value(PARAM_PLUGIN, 'name of the force theme', VALUE_OPTIONAL),
@@ -777,11 +761,8 @@ public static function update_courses($courses) {
}
// Make sure completion is enabled before setting it.
- if ((array_key_exists('enabledcompletion', $course) ||
- array_key_exists('completionstartonenrol', $course)) &&
- !completion_info::is_enabled_for_site()) {
+ if (array_key_exists('enabledcompletion', $course) && !completion_info::is_enabled_for_site()) {
$course['enabledcompletion'] = 0;
- $course['completionstartonenrol'] = 0;
}
// Make sure maxbytes are less then CFG->maxbytes.
View
5 course/tests/externallib_test.php
@@ -359,7 +359,6 @@ public function test_create_courses() {
$course2['groupmodeforce'] = 0;
$course2['defaultgroupingid'] = 0;
$course2['enablecompletion'] = 1;
- $course2['completionstartonenrol'] = 1;
$course2['completionnotify'] = 1;
$course2['lang'] = 'en';
$course2['forcetheme'] = 'base';
@@ -416,7 +415,6 @@ public function test_create_courses() {
// We enabled completion at the beginning of the test.
$this->assertEquals($courseinfo->enablecompletion, $course2['enablecompletion']);
- $this->assertEquals($courseinfo->completionstartonenrol, $course2['completionstartonenrol']);
} else if ($createdcourse['shortname'] == $course1['shortname']) {
$courseconfig = get_config('moodlecourse');
@@ -544,9 +542,7 @@ public function test_get_courses () {
$this->assertEquals($course['completionnotify'], $dbcourse->completionnotify);
$this->assertEquals($course['lang'], $dbcourse->lang);
$this->assertEquals($course['forcetheme'], $dbcourse->theme);
- $this->assertEquals($course['completionstartonenrol'], $dbcourse->completionstartonenrol);
$this->assertEquals($course['enablecompletion'], $dbcourse->enablecompletion);
- $this->assertEquals($course['completionstartonenrol'], $dbcourse->completionstartonenrol);
if ($dbcourse->format === 'topics') {
$this->assertEquals($course['courseformatoptions'], array(
array('name' => 'numsections', 'value' => $dbcourse->numsections),
@@ -733,7 +729,6 @@ public function test_update_courses() {
if (completion_info::is_enabled_for_site()) {
$this->assertEquals($course2['enabledcompletion'], $courseinfo->enablecompletion);
- $this->assertEquals($course2['completionstartonenrol'], $courseinfo->completionstartonenrol);
}
} else if ($course['id'] == $course1['id']) {
$this->assertEquals($course1['fullname'], $courseinfo->fullname);
View
1 enrol/imsenterprise/lib.php
@@ -398,7 +398,6 @@ function process_group_tag($tagcontents) {
$course->groupmode = $courseconfig->groupmode;
$course->groupmodeforce = $courseconfig->groupmodeforce;
$course->enablecompletion = $courseconfig->enablecompletion;
- $course->completionstartonenrol = $courseconfig->completionstartonenrol;
// Insert default names for teachers/students, from the current language
// Handle course categorisation (taken from the group.org.orgunit field if present)
View
2 lang/en/completion.php
@@ -98,8 +98,6 @@
$string['completionmenuitem']='Completion';
$string['completiononunenrolment']='Completion on unenrolment';
$string['completionsettingslocked']='Completion settings locked';
-$string['completionstartonenrol']='Completion tracking begins on enrolment';
-$string['completionstartonenrolhelp']='Begin tracking a student\'s progress in course completion after course enrolment';
$string['completed'] = 'Completed';
$string['confirmselfcompletion']='Confirm self completion';
$string['coursealreadycompleted']='You have already completed this course';
View
5 lib/db/install.xml 100644 → 100755
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20121116" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20130321" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@@ -98,7 +98,6 @@
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="requested" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="enablecompletion" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 = allow use of 'completion' progress-tracking on this course. 0 = disable completion tracking on this course."/>
- <FIELD NAME="completionstartonenrol" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="1 = allow use of 'activty completion' progress-tracking on this course. 0 = disable activity completion tracking on this course."/>
<FIELD NAME="completionnotify" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Notify users when they complete this course"/>
</FIELDS>
<KEYS>
@@ -2933,4 +2932,4 @@
</INDEXES>
</TABLE>
</TABLES>
-</XMLDB>
+</XMLDB>
View
15 lib/db/upgrade.php
@@ -1756,5 +1756,20 @@ function xmldb_main_upgrade($oldversion) {
// No savepoint needed for this change.
}
+ if ($oldversion < 2013032200.00) {
+
+ // Define field completionstartonenrol to be dropped from course.
+ $table = new xmldb_table('course');
+ $field = new xmldb_field('completionstartonenrol');
+
+ // Conditionally launch drop field completionstartonenrol.
+ if ($dbman->field_exists($table, $field)) {
+ $dbman->drop_field($table, $field);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2013032200.00);
+ }
+
return true;
}

0 comments on commit 8819a83

Please sign in to comment.
Something went wrong with that request. Please try again.