Merge branch 'MDL-78967-main' of https://github.com/kevpercy/moodle

This commit is contained in:
Sara Arjona 2024-02-27 12:49:06 +01:00
commit b33ba0b9fb
No known key found for this signature in database
16 changed files with 30 additions and 62 deletions

View File

@ -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);

View File

@ -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 @@
</select>
<input type="checkbox" id="{{id}}force" name="{{name}}[forced]" value="1" {{#forced}}checked{{/forced}}>
<label for="{{id}}force">{{#str}}force{{/str}}</label>
<input type="checkbox" id="{{id}}adv" name="{{name}}[adv]" value="1" {{#advanced}}checked{{/advanced}}>
<label for="{{id}}adv">{{#str}}advanced{{/str}}</label>
</div>

View File

@ -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.

View File

@ -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 |

View File

@ -138,3 +138,5 @@ editinga,core
updatinga,core
updatingain,core
summaryof,core
gradeitemadvanced,core_grades
gradeitemadvanced_help,core_grades

View File

@ -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.';

View File

@ -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,

View File

@ -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;
}

View File

@ -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 |

View File

@ -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 |

View File

@ -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 |

View File

@ -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 |

View File

@ -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 |

View File

@ -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 |

View File

@ -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 |

View File

@ -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