MDL-45894 navigation: My grades update to overview report.
[moodle.git] / admin / settings / grades.php
CommitLineData
11b749ca 1<?php
28e2c556 2
3// This file defines settingpages and externalpages under the "grades" section
4
a559f630 5if (has_capability('moodle/grade:manage', $systemcontext)
6 or has_capability('moodle/grade:manageletters', $systemcontext)) { // speedup for non-admins, add all caps used on this page
7
7d10995c 8 require_once $CFG->libdir.'/grade/constants.php';
e106013f
SH
9 $display_types = array(GRADE_DISPLAY_TYPE_REAL => new lang_string('real', 'grades'),
10 GRADE_DISPLAY_TYPE_PERCENTAGE => new lang_string('percentage', 'grades'),
11 GRADE_DISPLAY_TYPE_LETTER => new lang_string('letter', 'grades'),
12 GRADE_DISPLAY_TYPE_REAL_PERCENTAGE => new lang_string('realpercentage', 'grades'),
13 GRADE_DISPLAY_TYPE_REAL_LETTER => new lang_string('realletter', 'grades'),
14 GRADE_DISPLAY_TYPE_LETTER_REAL => new lang_string('letterreal', 'grades'),
15 GRADE_DISPLAY_TYPE_LETTER_PERCENTAGE => new lang_string('letterpercentage', 'grades'),
16 GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER => new lang_string('percentageletter', 'grades'),
17 GRADE_DISPLAY_TYPE_PERCENTAGE_REAL => new lang_string('percentagereal', 'grades')
7d10995c 18 );
19 asort($display_types);
20
220a90c5 21 // General settings
28e2c556 22
e106013f 23 $temp = new admin_settingpage('gradessettings', new lang_string('generalsettings', 'grades'), 'moodle/grade:manage');
220a90c5 24 if ($ADMIN->fulltree) {
5df8b070 25
220a90c5 26 // new CFG variable for gradebook (what roles to display)
27 $temp->add(new admin_setting_special_gradebookroles());
28e2c556 28
64f93798 29 // enable outcomes checkbox now in subsystems area
653a8648 30
220a90c5 31 $temp->add(new admin_setting_grade_profilereport());
32
e106013f
SH
33 $temp->add(new admin_setting_configselect('grade_aggregationposition', new lang_string('aggregationposition', 'grades'),
34 new lang_string('aggregationposition_help', 'grades'), GRADE_REPORT_AGGREGATION_POSITION_LAST,
35 array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => new lang_string('positionfirst', 'grades'),
36 GRADE_REPORT_AGGREGATION_POSITION_LAST => new lang_string('positionlast', 'grades'))));
28e2c556 37
e106013f 38 $temp->add(new admin_setting_regradingcheckbox('grade_includescalesinaggregation', new lang_string('includescalesinaggregation', 'grades'), new lang_string('includescalesinaggregation_help', 'grades'), 1));
91f9a62c 39
e106013f 40 $temp->add(new admin_setting_configcheckbox('grade_hiddenasdate', new lang_string('hiddenasdate', 'grades'), new lang_string('hiddenasdate_help', 'grades'), 0));
28e2c556 41
220a90c5 42 // enable publishing in exports/imports
e106013f 43 $temp->add(new admin_setting_configcheckbox('gradepublishing', new lang_string('gradepublishing', 'grades'), new lang_string('gradepublishing_help', 'grades'), 0));
4e67c97b 44
e106013f
SH
45 $temp->add(new admin_setting_configselect('grade_export_displaytype', new lang_string('gradeexportdisplaytype', 'grades'),
46 new lang_string('gradeexportdisplaytype_desc', 'grades'), GRADE_DISPLAY_TYPE_REAL, $display_types));
7d10995c 47
e106013f
SH
48 $temp->add(new admin_setting_configselect('grade_export_decimalpoints', new lang_string('gradeexportdecimalpoints', 'grades'),
49 new lang_string('gradeexportdecimalpoints_desc', 'grades'), 2,
220a90c5 50 array( '0' => '0',
51 '1' => '1',
52 '2' => '2',
53 '3' => '3',
54 '4' => '4',
55 '5' => '5')));
e106013f
SH
56 $temp->add(new admin_setting_configselect('grade_navmethod', new lang_string('navmethod', 'grades'), null, 0,
57 array(GRADE_NAVMETHOD_DROPDOWN => new lang_string('dropdown', 'grades'),
58 GRADE_NAVMETHOD_TABS => new lang_string('tabs', 'grades'),
59 GRADE_NAVMETHOD_COMBO => new lang_string('combo', 'grades'))));
70aaa10f 60
293f42b6
CF
61 $temp->add(new admin_setting_configtext('grade_export_userprofilefields', new lang_string('gradeexportuserprofilefields', 'grades'), new lang_string('gradeexportuserprofilefields_desc', 'grades'), 'firstname,lastname,idnumber,institution,department,email', PARAM_TEXT));
62
8b8e949c 63 $temp->add(new admin_setting_configtext('grade_export_customprofilefields', new lang_string('gradeexportcustomprofilefields', 'grades'), new lang_string('gradeexportcustomprofilefields_desc', 'grades'), '', PARAM_TEXT));
293f42b6 64
dbe93bc7
CF
65 $temp->add(new admin_setting_configcheckbox('recovergradesdefault', new lang_string('recovergradesdefault', 'grades'), new lang_string('recovergradesdefault_help', 'grades'), 0));
66
220a90c5 67 $temp->add(new admin_setting_special_gradeexport());
653a8648 68
69 $temp->add(new admin_setting_special_gradelimiting());
59766233 70
0e999796
AD
71 $temp->add(new admin_setting_configcheckbox('grade_report_showmin',
72 get_string('minimum_show', 'grades'),
73 get_string('minimum_show_help', 'grades'), '1'));
74
59766233
JM
75 $temp->add(new admin_setting_special_gradepointmax());
76
77 $temp->add(new admin_setting_special_gradepointdefault());
c9451960
AG
78
79 $temp->add(new admin_setting_my_grades_report());
80
81 $temp->add(new admin_setting_configtext('gradereport_mygradeurl', new lang_string('externalurl', 'grades'),
82 new lang_string('externalurl_desc', 'grades'), null));
220a90c5 83 }
84 $ADMIN->add('grades', $temp);
85
86 /// Grade category settings
e106013f 87 $temp = new admin_settingpage('gradecategorysettings', new lang_string('gradecategorysettings', 'grades'), 'moodle/grade:manage');
220a90c5 88 if ($ADMIN->fulltree) {
e106013f 89 $temp->add(new admin_setting_configcheckbox('grade_hideforcedsettings', new lang_string('hideforcedsettings', 'grades'), new lang_string('hideforcedsettings_help', 'grades'), '1'));
220a90c5 90
e106013f 91 $strnoforce = new lang_string('noforce', 'grades');
220a90c5 92
93 // Aggregation type
e106013f
SH
94 $options = array(GRADE_AGGREGATE_MEAN =>new lang_string('aggregatemean', 'grades'),
95 GRADE_AGGREGATE_WEIGHTED_MEAN =>new lang_string('aggregateweightedmean', 'grades'),
96 GRADE_AGGREGATE_WEIGHTED_MEAN2 =>new lang_string('aggregateweightedmean2', 'grades'),
97 GRADE_AGGREGATE_EXTRACREDIT_MEAN=>new lang_string('aggregateextracreditmean', 'grades'),
98 GRADE_AGGREGATE_MEDIAN =>new lang_string('aggregatemedian', 'grades'),
99 GRADE_AGGREGATE_MIN =>new lang_string('aggregatemin', 'grades'),
100 GRADE_AGGREGATE_MAX =>new lang_string('aggregatemax', 'grades'),
101 GRADE_AGGREGATE_MODE =>new lang_string('aggregatemode', 'grades'),
102 GRADE_AGGREGATE_SUM =>new lang_string('aggregatesum', 'grades'));
653a8648 103
f8259c2f 104 $defaultvisible = array(GRADE_AGGREGATE_SUM);
653a8648 105
313e9753 106 $defaults = array('value' => GRADE_AGGREGATE_SUM, 'forced' => false, 'adv' => false);
e106013f 107 $temp->add(new admin_setting_gradecat_combo('grade_aggregation', new lang_string('aggregation', 'grades'), new lang_string('aggregation_help', 'grades'), $defaults, $options));
220a90c5 108
e106013f
SH
109 $temp->add(new admin_setting_configmultiselect('grade_aggregations_visible', new lang_string('aggregationsvisible', 'grades'),
110 new lang_string('aggregationsvisiblehelp', 'grades'), $defaultvisible, $options));
653a8648 111
e106013f 112 $options = array(0 => new lang_string('no'), 1 => new lang_string('yes'));
220a90c5 113
114 $defaults = array('value'=>1, 'forced'=>false, 'adv'=>true);
e106013f
SH
115 $temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', new lang_string('aggregateonlygraded', 'grades'),
116 new lang_string('aggregateonlygraded_help', 'grades'), $defaults, $options));
ee982b07 117 $defaults = array('value'=>0, 'forced'=>false, 'adv'=>true);
e106013f
SH
118 $temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', new lang_string('aggregateoutcomes', 'grades'),
119 new lang_string('aggregateoutcomes_help', 'grades'), $defaults, $options));
220a90c5 120
e106013f 121 $options = array(0 => new lang_string('none'));
220a90c5 122 for ($i=1; $i<=20; $i++) {
123 $options[$i] = $i;
28e2c556 124 }
125
220a90c5 126 $defaults['value'] = 0;
127 $defaults['forced'] = true;
e106013f
SH
128 $temp->add(new admin_setting_gradecat_combo('grade_keephigh', new lang_string('keephigh', 'grades'),
129 new lang_string('keephigh_help', 'grades'), $defaults, $options));
220a90c5 130 $defaults['forced'] = false;
e106013f
SH
131 $temp->add(new admin_setting_gradecat_combo('grade_droplow', new lang_string('droplow', 'grades'),
132 new lang_string('droplow_help', 'grades'), $defaults, $options));
0e999796
AD
133
134 $temp->add(new admin_setting_configcheckbox('grade_overridecat', new lang_string('overridecat', 'grades'),
135 new lang_string('overridecat_help', 'grades'), 1));
220a90c5 136 }
137 $ADMIN->add('grades', $temp);
138
139
140 /// Grade item settings
e106013f 141 $temp = new admin_settingpage('gradeitemsettings', new lang_string('gradeitemsettings', 'grades'), 'moodle/grade:manage');
220a90c5 142 if ($ADMIN->fulltree) {
e106013f
SH
143 $temp->add(new admin_setting_configselect('grade_displaytype', new lang_string('gradedisplaytype', 'grades'),
144 new lang_string('gradedisplaytype_help', 'grades'), GRADE_DISPLAY_TYPE_REAL, $display_types));
220a90c5 145
e106013f
SH
146 $temp->add(new admin_setting_configselect('grade_decimalpoints', new lang_string('decimalpoints', 'grades'),
147 new lang_string('decimalpoints_help', 'grades'), 2,
220a90c5 148 array( '0' => '0',
149 '1' => '1',
150 '2' => '2',
151 '3' => '3',
152 '4' => '4',
153 '5' => '5')));
154
e106013f 155 $temp->add(new admin_setting_configmultiselect('grade_item_advanced', new lang_string('gradeitemadvanced', 'grades'), new lang_string('gradeitemadvanced_help', 'grades'),
220a90c5 156 array('iteminfo', 'idnumber', 'gradepass', 'plusfactor', 'multfactor', 'display', 'decimals', 'hiddenuntil', 'locktime'),
e106013f
SH
157 array('iteminfo' => new lang_string('iteminfo', 'grades'),
158 'idnumber' => new lang_string('idnumbermod'),
159 'gradetype' => new lang_string('gradetype', 'grades'),
160 'scaleid' => new lang_string('scale'),
161 'grademin' => new lang_string('grademin', 'grades'),
162 'grademax' => new lang_string('grademax', 'grades'),
163 'gradepass' => new lang_string('gradepass', 'grades'),
164 'plusfactor' => new lang_string('plusfactor', 'grades'),
165 'multfactor' => new lang_string('multfactor', 'grades'),
166 'display' => new lang_string('gradedisplaytype', 'grades'),
167 'decimals' => new lang_string('decimalpoints', 'grades'),
168 'hidden' => new lang_string('hidden', 'grades'),
169 'hiddenuntil' => new lang_string('hiddenuntil', 'grades'),
170 'locked' => new lang_string('locked', 'grades'),
171 'locktime' => new lang_string('locktime', 'grades'),
172 'aggregationcoef' => new lang_string('aggregationcoef', 'grades'),
173 'parentcategory' => new lang_string('parentcategory', 'grades'))));
220a90c5 174 }
175 $ADMIN->add('grades', $temp);
176
177
178 /// Scales and outcomes
179
e106013f 180 $scales = new admin_externalpage('scales', new lang_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
220a90c5 181 $ADMIN->add('grades', $scales);
c29b95d2 182 if (!empty($CFG->enableoutcomes)) {
e106013f 183 $outcomes = new admin_externalpage('outcomes', new lang_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage');
da2f4411 184 $ADMIN->add('grades', $outcomes);
185 }
e106013f 186 $letters = new admin_externalpage('letters', new lang_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/index.php', 'moodle/grade:manageletters');
220a90c5 187 $ADMIN->add('grades', $letters);
188
189 // The plugins must implement a settings.php file that adds their admin settings to the $settings object
190
191 // Reports
e106013f 192 $ADMIN->add('grades', new admin_category('gradereports', new lang_string('reportsettings', 'grades')));
bd3b3bba 193 foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
220a90c5 194 // Include all the settings commands for this plugin if there are any
17da2e6f 195 if (file_exists($plugindir.'/settings.php')) {
e106013f 196 $settings = new admin_settingpage('gradereport'.$plugin, new lang_string('pluginname', 'gradereport_'.$plugin), 'moodle/grade:manage');
dbf9e4ba
PS
197 include($plugindir.'/settings.php');
198 if ($settings) {
199 $ADMIN->add('gradereports', $settings);
220a90c5 200 }
220a90c5 201 }
28e2c556 202 }
28e2c556 203
220a90c5 204 // Imports
e106013f 205 $ADMIN->add('grades', new admin_category('gradeimports', new lang_string('importsettings', 'grades')));
bd3b3bba 206 foreach (core_component::get_plugin_list('gradeimport') as $plugin => $plugindir) {
220a90c5 207
208 // Include all the settings commands for this plugin if there are any
17da2e6f 209 if (file_exists($plugindir.'/settings.php')) {
e106013f 210 $settings = new admin_settingpage('gradeimport'.$plugin, new lang_string('pluginname', 'gradeimport_'.$plugin), 'moodle/grade:manage');
dbf9e4ba
PS
211 include($plugindir.'/settings.php');
212 if ($settings) {
213 $ADMIN->add('gradeimports', $settings);
220a90c5 214 }
220a90c5 215 }
216 }
28e2c556 217
28e2c556 218
220a90c5 219 // Exports
e106013f 220 $ADMIN->add('grades', new admin_category('gradeexports', new lang_string('exportsettings', 'grades')));
bd3b3bba 221 foreach (core_component::get_plugin_list('gradeexport') as $plugin => $plugindir) {
220a90c5 222 // Include all the settings commands for this plugin if there are any
17da2e6f 223 if (file_exists($plugindir.'/settings.php')) {
e106013f 224 $settings = new admin_settingpage('gradeexport'.$plugin, new lang_string('pluginname', 'gradeexport_'.$plugin), 'moodle/grade:manage');
dbf9e4ba
PS
225 include($plugindir.'/settings.php');
226 if ($settings) {
227 $ADMIN->add('gradeexports', $settings);
220a90c5 228 }
28e2c556 229 }
28e2c556 230 }
a559f630 231
232} // end of speedup
233