diff --git a/admin/settings/grades.php b/admin/settings/grades.php index a832c9db217..156b61bdf81 100644 --- a/admin/settings/grades.php +++ b/admin/settings/grades.php @@ -113,7 +113,7 @@ if (has_capability('moodle/grade:manage', $systemcontext) $defaultvisible = array(GRADE_AGGREGATE_SUM); - $defaults = array('value' => GRADE_AGGREGATE_SUM, 'forced' => false, 'adv' => false); + $defaults = array('value' => GRADE_AGGREGATE_SUM, 'forced' => false); $temp->add(new admin_setting_gradecat_combo('grade_aggregation', new lang_string('aggregation', 'grades'), new lang_string('aggregation_help', 'grades'), $defaults, $options)); $temp->add(new admin_setting_configmultiselect('grade_aggregations_visible', new lang_string('aggregationsvisible', 'grades'), @@ -121,10 +121,10 @@ if (has_capability('moodle/grade:manage', $systemcontext) $options = array(0 => new lang_string('no'), 1 => new lang_string('yes')); - $defaults = array('value'=>1, 'forced'=>false, 'adv'=>true); + $defaults = array('value' => 1, 'forced' => false); $temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', new lang_string('aggregateonlygraded', 'grades'), new lang_string('aggregateonlygraded_help', 'grades'), $defaults, $options)); - $defaults = array('value'=>0, 'forced'=>false, 'adv'=>true); + $defaults = array('value' => 0, 'forced' => false); $temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', new lang_string('aggregateoutcomes', 'grades'), new lang_string('aggregateoutcomes_help', 'grades'), $defaults, $options)); @@ -161,26 +161,6 @@ if (has_capability('moodle/grade:manage', $systemcontext) '3' => '3', '4' => '4', '5' => '5'))); - - $temp->add(new admin_setting_configmultiselect('grade_item_advanced', new lang_string('gradeitemadvanced', 'grades'), new lang_string('gradeitemadvanced_help', 'grades'), - array('iteminfo', 'idnumber', 'gradepass', 'plusfactor', 'multfactor', 'display', 'decimals', 'hiddenuntil', 'locktime'), - array('iteminfo' => new lang_string('iteminfo', 'grades'), - 'idnumber' => new lang_string('idnumbermod'), - 'gradetype' => new lang_string('gradetype', 'grades'), - 'scaleid' => new lang_string('scale'), - 'grademin' => new lang_string('grademin', 'grades'), - 'grademax' => new lang_string('grademax', 'grades'), - 'gradepass' => new lang_string('gradepass', 'grades'), - 'plusfactor' => new lang_string('plusfactor', 'grades'), - 'multfactor' => new lang_string('multfactor', 'grades'), - 'display' => new lang_string('gradedisplaytype', 'grades'), - 'decimals' => new lang_string('decimalpoints', 'grades'), - 'hidden' => new lang_string('hidden', 'grades'), - 'hiddenuntil' => new lang_string('hiddenuntil', 'grades'), - 'locked' => new lang_string('locked', 'grades'), - 'locktime' => new lang_string('locktime', 'grades'), - 'aggregationcoef' => new lang_string('aggregationcoef', 'grades'), - 'parentcategory' => new lang_string('parentcategory', 'grades')))); } $ADMIN->add('grades', $temp); diff --git a/admin/templates/setting_gradecat_combo.mustache b/admin/templates/setting_gradecat_combo.mustache index 9e71c27f29b..b8c0a2430f7 100644 --- a/admin/templates/setting_gradecat_combo.mustache +++ b/admin/templates/setting_gradecat_combo.mustache @@ -24,7 +24,6 @@ * id - element id * options - list of options containing name, value and selected * forced - is it forced - * advanced - is it advanced Example context (json): { @@ -33,8 +32,7 @@ "options": [ { "name": "Option name", "value": "Value", "selected": true } ], - "forced": true, - "advanced": true + "forced": true } }} {{! @@ -48,7 +46,5 @@ - - diff --git a/admin/upgrade.txt b/admin/upgrade.txt index 2f76124b45b..bbc7762a5cf 100644 --- a/admin/upgrade.txt +++ b/admin/upgrade.txt @@ -1,5 +1,10 @@ This files describes API changes in /admin/*. +=== 4.4 === + +* Grade item setting "Advanced grade item options" (grade_item_advanced) is no longer used and has been removed. +* Grade category settings no longer have the "Advanced" checkbox. The 'advanced' parameter has been removed. + === 4.3 === * Removed admin setting cookiehttponly Moodle now defaults to HTTP only cookies for new installs only. diff --git a/badges/tests/behat/criteria_activity.feature b/badges/tests/behat/criteria_activity.feature index e5f5b5f58f9..81459ae7609 100644 --- a/badges/tests/behat/criteria_activity.feature +++ b/badges/tests/behat/criteria_activity.feature @@ -18,8 +18,6 @@ Feature: Award badges based on activity completion | teacher1 | C1 | editingteacher | | student1 | C1 | student | | student2 | C1 | student | - And the following config values are set as admin: - | grade_item_advanced | hiddenuntil | And the following "question categories" exist: | contextlevel | reference | name | | Course | C1 | Test questions | diff --git a/lang/en/deprecated.txt b/lang/en/deprecated.txt index 0420e7779d3..1f52a300942 100644 --- a/lang/en/deprecated.txt +++ b/lang/en/deprecated.txt @@ -138,3 +138,5 @@ editinga,core updatinga,core updatingain,core summaryof,core +gradeitemadvanced,core_grades +gradeitemadvanced_help,core_grades diff --git a/lang/en/grades.php b/lang/en/grades.php index 8513f777183..9649e94b6c9 100644 --- a/lang/en/grades.php +++ b/lang/en/grades.php @@ -306,8 +306,6 @@ $string['gradeimport'] = 'Grade import'; $string['gradeimportfailed'] = 'Grade Import failed during commit. Details:'; $string['gradeitem'] = 'Grade item'; $string['gradeitemaddusers'] = 'Exclude from grading'; -$string['gradeitemadvanced'] = 'Advanced grade item options'; -$string['gradeitemadvanced_help'] = 'Select all elements that should be displayed as advanced when editing grade items.'; $string['gradeitemislocked'] = 'This activity is locked in the gradebook. Changes that are made to grades in this activity will not be copied to the gradebook until it is unlocked.'; $string['gradeitemlocked'] = 'Grading locked'; $string['gradeitemminmax'] = 'Min and max grades as specified in grade item settings'; @@ -924,3 +922,5 @@ $string['studentsperpage_help'] = 'This setting determines the number of student // Deprecated since Moodle 4.4. $string['grade'] = 'Grade'; +$string['gradeitemadvanced'] = 'Advanced grade item options'; +$string['gradeitemadvanced_help'] = 'Select all elements that should be displayed as advanced when editing grade items.'; diff --git a/lib/adminlib.php b/lib/adminlib.php index a370b5d86ac..e31462a9189 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -6316,7 +6316,7 @@ class admin_setting_gradecat_combo extends admin_setting { /** * Return the current setting(s) array * - * @return array Array of value=>xx, forced=>xx, adv=>xx + * @return array Array of value=>xx, forced=>xx */ public function get_setting() { global $CFG; @@ -6328,38 +6328,36 @@ class admin_setting_gradecat_combo extends admin_setting { return NULL; } + // Bitwise operation is still required, in cases where unused 'advanced' flag is still set. $flag = (int)$flag; - $forced = (boolean)(1 & $flag); // first bit - $adv = (boolean)(2 & $flag); // second bit + $forced = (bool)(1 & $flag); // First bit. - return array('value' => $value, 'forced' => $forced, 'adv' => $adv); + return array('value' => $value, 'forced' => $forced); } /** * Save the new settings passed in $data * * @todo Add vartype handling to ensure $data is array - * @param array $data Associative array of value=>xx, forced=>xx, adv=>xx + * @param array $data Associative array of value=>xx, forced=>xx * @return string empty or error message */ public function write_setting($data) { global $CFG; - $value = $data['value']; + $value = $data['value']; $forced = empty($data['forced']) ? 0 : 1; - $adv = empty($data['adv']) ? 0 : 2; - $flag = ($forced | $adv); //bitwise or if (!in_array($value, array_keys($this->choices))) { return 'Error setting '; } - $oldvalue = $this->config_read($this->name); - $oldflag = (int)$this->config_read($this->name.'_flag'); + $oldvalue = $this->config_read($this->name); + $oldflag = (int)$this->config_read($this->name.'_flag'); $oldforced = (1 & $oldflag); // first bit $result1 = $this->config_write($this->name, $value); - $result2 = $this->config_write($this->name.'_flag', $flag); + $result2 = $this->config_write($this->name.'_flag', $forced); // force regrade if needed if ($oldforced != $forced or ($forced and $value != $oldvalue)) { @@ -6396,9 +6394,6 @@ class admin_setting_gradecat_combo extends admin_setting { if (!empty($default['forced'])) { $defaultinfo[] = get_string('force'); } - if (!empty($default['adv'])) { - $defaultinfo[] = get_string('advanced'); - } $defaultinfo = implode(', ', $defaultinfo); } else { @@ -6410,7 +6405,6 @@ class admin_setting_gradecat_combo extends admin_setting { 'id' => $this->get_id(), 'name' => $this->get_full_name(), 'forced' => !empty($data['forced']), - 'advanced' => !empty($data['adv']), 'options' => array_map(function($option) use ($options, $value) { return [ 'value' => $option, diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 17c82ba9601..98d019333ec 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1086,5 +1086,12 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2024021500.02); } + if ($oldversion < 2024022300.02) { + // Removed advanced grade item settings. + unset_config('grade_item_advanced'); + + upgrade_main_savepoint(true, 2024022300.02); + } + return true; } diff --git a/mod/quiz/tests/behat/completion_condition_attempts_used.feature b/mod/quiz/tests/behat/completion_condition_attempts_used.feature index 7351b1b73ce..6e42450577d 100644 --- a/mod/quiz/tests/behat/completion_condition_attempts_used.feature +++ b/mod/quiz/tests/behat/completion_condition_attempts_used.feature @@ -16,8 +16,6 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And the following config values are set as admin: - | grade_item_advanced | hiddenuntil | And the following "question categories" exist: | contextlevel | reference | name | | Course | C1 | Test questions | diff --git a/mod/quiz/tests/behat/completion_condition_minimum_attempts.feature b/mod/quiz/tests/behat/completion_condition_minimum_attempts.feature index 1550e26058a..c0660cf2e71 100644 --- a/mod/quiz/tests/behat/completion_condition_minimum_attempts.feature +++ b/mod/quiz/tests/behat/completion_condition_minimum_attempts.feature @@ -16,8 +16,6 @@ Feature: Set a quiz to be marked complete when the student completes a minimum a | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And the following config values are set as admin: - | grade_item_advanced | hiddenuntil | And the following "question categories" exist: | contextlevel | reference | name | | Course | C1 | Test questions | diff --git a/mod/quiz/tests/behat/completion_condition_passing_grade.feature b/mod/quiz/tests/behat/completion_condition_passing_grade.feature index c00663452ed..b98606f73d3 100644 --- a/mod/quiz/tests/behat/completion_condition_passing_grade.feature +++ b/mod/quiz/tests/behat/completion_condition_passing_grade.feature @@ -16,8 +16,6 @@ Feature: Set a quiz to be marked complete when the student passes | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And the following config values are set as admin: - | grade_item_advanced | hiddenuntil | And the following "question categories" exist: | contextlevel | reference | name | | Course | C1 | Test questions | diff --git a/mod/quiz/tests/behat/completion_manual.feature b/mod/quiz/tests/behat/completion_manual.feature index a34f3518313..d2f3e2c762b 100644 --- a/mod/quiz/tests/behat/completion_manual.feature +++ b/mod/quiz/tests/behat/completion_manual.feature @@ -16,8 +16,6 @@ Feature: Manually complete a quiz | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And the following config values are set as admin: - | grade_item_advanced | hiddenuntil | And the following "question categories" exist: | contextlevel | reference | name | | Course | C1 | Test questions | diff --git a/mod/quiz/tests/behat/quiz_activity_completion.feature b/mod/quiz/tests/behat/quiz_activity_completion.feature index 1fe3c90264e..f9047398d7e 100644 --- a/mod/quiz/tests/behat/quiz_activity_completion.feature +++ b/mod/quiz/tests/behat/quiz_activity_completion.feature @@ -16,8 +16,6 @@ Feature: View activity completion in the quiz activity | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And the following config values are set as admin: - | grade_item_advanced | hiddenuntil | And the following "question categories" exist: | contextlevel | reference | name | | Course | C1 | Test questions | diff --git a/mod/quiz/tests/behat/quiz_activity_completion_locked.feature b/mod/quiz/tests/behat/quiz_activity_completion_locked.feature index 8bd9f46dc02..dd60560f310 100644 --- a/mod/quiz/tests/behat/quiz_activity_completion_locked.feature +++ b/mod/quiz/tests/behat/quiz_activity_completion_locked.feature @@ -17,8 +17,6 @@ Feature: Ensure saving a quiz does not modify the completion settings. | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And the following config values are set as admin: - | grade_item_advanced | hiddenuntil | And the following "question categories" exist: | contextlevel | reference | name | | Course | C1 | Test questions | diff --git a/mod/quiz/tests/behat/quiz_activity_completion_unlocked.feature b/mod/quiz/tests/behat/quiz_activity_completion_unlocked.feature index b1e35f074a1..79943ed6094 100644 --- a/mod/quiz/tests/behat/quiz_activity_completion_unlocked.feature +++ b/mod/quiz/tests/behat/quiz_activity_completion_unlocked.feature @@ -16,8 +16,6 @@ Feature: Activity completion in the quiz activity with unlocked and re-grading. | user | course | role | | teacher1 | C1 | editingteacher | | student1 | C1 | student | - And the following config values are set as admin: - | grade_item_advanced | hiddenuntil | And the following "question categories" exist: | contextlevel | reference | name | | Course | C1 | Test questions | diff --git a/version.php b/version.php index 0fc0fd2ea78..90dfa849556 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2024022300.01; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2024022300.02; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.4dev (Build: 20240223)'; // Human-friendly version name