NOMDL MNet: Remote application like Mahara does not send user's lang attribute
[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';
9 $display_types = array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
10 GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
11 GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'),
12 GRADE_DISPLAY_TYPE_REAL_PERCENTAGE => get_string('realpercentage', 'grades'),
13 GRADE_DISPLAY_TYPE_REAL_LETTER => get_string('realletter', 'grades'),
14 GRADE_DISPLAY_TYPE_LETTER_REAL => get_string('letterreal', 'grades'),
15 GRADE_DISPLAY_TYPE_LETTER_PERCENTAGE => get_string('letterpercentage', 'grades'),
16 GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER => get_string('percentageletter', 'grades'),
17 GRADE_DISPLAY_TYPE_PERCENTAGE_REAL => get_string('percentagereal', 'grades')
18 );
19 asort($display_types);
20
220a90c5 21 // General settings
28e2c556 22
220a90c5 23 $temp = new admin_settingpage('gradessettings', get_string('generalsettings', 'grades'), 'moodle/grade:manage');
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
33 $temp->add(new admin_setting_configselect('grade_aggregationposition', get_string('aggregationposition', 'grades'),
6e2d05ae 34 get_string('aggregationposition_help', 'grades'), GRADE_REPORT_AGGREGATION_POSITION_LAST,
220a90c5 35 array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
36 GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
28e2c556 37
5cf5cc9b 38 $temp->add(new admin_setting_regradingcheckbox('grade_includescalesinaggregation', get_string('includescalesinaggregation', 'grades'), get_string('includescalesinaggregation_help', 'grades'), 1));
91f9a62c 39
5cf5cc9b 40 $temp->add(new admin_setting_configcheckbox('grade_hiddenasdate', get_string('hiddenasdate', 'grades'), get_string('hiddenasdate_help', 'grades'), 0));
28e2c556 41
220a90c5 42 // enable publishing in exports/imports
5cf5cc9b 43 $temp->add(new admin_setting_configcheckbox('gradepublishing', get_string('gradepublishing', 'grades'), get_string('gradepublishing_help', 'grades'), 0));
4e67c97b 44
220a90c5 45 $temp->add(new admin_setting_configselect('grade_export_displaytype', get_string('gradeexportdisplaytype', 'grades'),
c64c9597 46 get_string('gradeexportdisplaytype_desc', 'grades'), GRADE_DISPLAY_TYPE_REAL, $display_types));
7d10995c 47
220a90c5 48 $temp->add(new admin_setting_configselect('grade_export_decimalpoints', get_string('gradeexportdecimalpoints', 'grades'),
66267260 49 get_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')));
70aaa10f 56 $temp->add(new admin_setting_configselect('grade_navmethod', get_string('navmethod', 'grades'), null, 0,
57 array(GRADE_NAVMETHOD_DROPDOWN => get_string('dropdown', 'grades'),
58 GRADE_NAVMETHOD_TABS => get_string('tabs', 'grades'),
59 GRADE_NAVMETHOD_COMBO => get_string('combo', 'grades'))));
60
220a90c5 61 $temp->add(new admin_setting_special_gradeexport());
653a8648 62
63 $temp->add(new admin_setting_special_gradelimiting());
220a90c5 64 }
65 $ADMIN->add('grades', $temp);
66
67 /// Grade category settings
68 $temp = new admin_settingpage('gradecategorysettings', get_string('gradecategorysettings', 'grades'), 'moodle/grade:manage');
69 if ($ADMIN->fulltree) {
5cf5cc9b 70 $temp->add(new admin_setting_configcheckbox('grade_hideforcedsettings', get_string('hideforcedsettings', 'grades'), get_string('hideforcedsettings_help', 'grades'), '1'));
220a90c5 71
72 $strnoforce = get_string('noforce', 'grades');
73
74 // Aggregation type
75 $options = array(GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', 'grades'),
76 GRADE_AGGREGATE_WEIGHTED_MEAN =>get_string('aggregateweightedmean', 'grades'),
77 GRADE_AGGREGATE_WEIGHTED_MEAN2 =>get_string('aggregateweightedmean2', 'grades'),
78 GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'),
79 GRADE_AGGREGATE_MEDIAN =>get_string('aggregatemedian', 'grades'),
80 GRADE_AGGREGATE_MIN =>get_string('aggregatemin', 'grades'),
81 GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'),
82 GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'),
83 GRADE_AGGREGATE_SUM =>get_string('aggregatesum', 'grades'));
653a8648 84
85 $defaultvisible = array(GRADE_AGGREGATE_MEAN, GRADE_AGGREGATE_WEIGHTED_MEAN, GRADE_AGGREGATE_WEIGHTED_MEAN2,
86 GRADE_AGGREGATE_EXTRACREDIT_MEAN, GRADE_AGGREGATE_MEDIAN, GRADE_AGGREGATE_MIN,
87 GRADE_AGGREGATE_MAX, GRADE_AGGREGATE_MODE, GRADE_AGGREGATE_SUM);
88
220a90c5 89 $defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN2, 'forced'=>false, 'adv'=>false);
f89b71eb 90 $temp->add(new admin_setting_gradecat_combo('grade_aggregation', get_string('aggregation', 'grades'), get_string('aggregation_help', 'grades'), $defaults, $options));
220a90c5 91
653a8648 92 $temp->add(new admin_setting_configmultiselect('grade_aggregations_visible', get_string('aggregationsvisible', 'grades'),
93 get_string('aggregationsvisiblehelp', 'grades'), $defaultvisible, $options));
94
220a90c5 95 $options = array(0 => get_string('no'), 1 => get_string('yes'));
96
97 $defaults = array('value'=>1, 'forced'=>false, 'adv'=>true);
98 $temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', get_string('aggregateonlygraded', 'grades'),
c8d463dd 99 get_string('aggregateonlygraded_help', 'grades'), $defaults, $options));
ee982b07 100 $defaults = array('value'=>0, 'forced'=>false, 'adv'=>true);
220a90c5 101 $temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', get_string('aggregateoutcomes', 'grades'),
53267b79 102 get_string('aggregateoutcomes_help', 'grades'), $defaults, $options));
220a90c5 103 $temp->add(new admin_setting_gradecat_combo('grade_aggregatesubcats', get_string('aggregatesubcats', 'grades'),
75dc3218 104 get_string('aggregatesubcats_help', 'grades'), $defaults, $options));
220a90c5 105
106 $options = array(0 => get_string('none'));
107 for ($i=1; $i<=20; $i++) {
108 $options[$i] = $i;
28e2c556 109 }
110
220a90c5 111 $defaults['value'] = 0;
112 $defaults['forced'] = true;
113 $temp->add(new admin_setting_gradecat_combo('grade_keephigh', get_string('keephigh', 'grades'),
2fcf41e6 114 get_string('keephigh_help', 'grades'), $defaults, $options));
220a90c5 115 $defaults['forced'] = false;
116 $temp->add(new admin_setting_gradecat_combo('grade_droplow', get_string('droplow', 'grades'),
b37760fc 117 get_string('droplow_help', 'grades'), $defaults, $options));
220a90c5 118 }
119 $ADMIN->add('grades', $temp);
120
121
122 /// Grade item settings
123 $temp = new admin_settingpage('gradeitemsettings', get_string('gradeitemsettings', 'grades'), 'moodle/grade:manage');
124 if ($ADMIN->fulltree) {
125 $temp->add(new admin_setting_configselect('grade_displaytype', get_string('gradedisplaytype', 'grades'),
56f9c6ce 126 get_string('gradedisplaytype_help', 'grades'), GRADE_DISPLAY_TYPE_REAL, $display_types));
220a90c5 127
128 $temp->add(new admin_setting_configselect('grade_decimalpoints', get_string('decimalpoints', 'grades'),
66267260 129 get_string('decimalpoints_help', 'grades'), 2,
220a90c5 130 array( '0' => '0',
131 '1' => '1',
132 '2' => '2',
133 '3' => '3',
134 '4' => '4',
135 '5' => '5')));
136
5cf5cc9b 137 $temp->add(new admin_setting_configmultiselect('grade_item_advanced', get_string('gradeitemadvanced', 'grades'), get_string('gradeitemadvanced_help', 'grades'),
220a90c5 138 array('iteminfo', 'idnumber', 'gradepass', 'plusfactor', 'multfactor', 'display', 'decimals', 'hiddenuntil', 'locktime'),
139 array('iteminfo' => get_string('iteminfo', 'grades'),
d343bd21 140 'idnumber' => get_string('idnumbermod'),
220a90c5 141 'gradetype' => get_string('gradetype', 'grades'),
142 'scaleid' => get_string('scale'),
143 'grademin' => get_string('grademin', 'grades'),
144 'grademax' => get_string('grademax', 'grades'),
145 'gradepass' => get_string('gradepass', 'grades'),
146 'plusfactor' => get_string('plusfactor', 'grades'),
147 'multfactor' => get_string('multfactor', 'grades'),
148 'display' => get_string('gradedisplaytype', 'grades'),
149 'decimals' => get_string('decimalpoints', 'grades'),
150 'hidden' => get_string('hidden', 'grades'),
151 'hiddenuntil' => get_string('hiddenuntil', 'grades'),
152 'locked' => get_string('locked', 'grades'),
153 'locktime' => get_string('locktime', 'grades'),
154 'aggregationcoef' => get_string('aggregationcoef', 'grades'),
155 'parentcategory' => get_string('parentcategory', 'grades'))));
156 }
157 $ADMIN->add('grades', $temp);
158
159
160 /// Scales and outcomes
161
162 $scales = new admin_externalpage('scales', get_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
163 $ADMIN->add('grades', $scales);
c29b95d2 164 if (!empty($CFG->enableoutcomes)) {
653a8648 165 $outcomes = new admin_externalpage('outcomes', get_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage');
da2f4411 166 $ADMIN->add('grades', $outcomes);
167 }
54caa598 168 $letters = new admin_externalpage('letters', get_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/index.php', 'moodle/grade:manageletters');
220a90c5 169 $ADMIN->add('grades', $letters);
170
171 // The plugins must implement a settings.php file that adds their admin settings to the $settings object
172
173 // Reports
174 $ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
17da2e6f 175 foreach (get_plugin_list('gradereport') as $plugin => $plugindir) {
220a90c5 176 // Include all the settings commands for this plugin if there are any
17da2e6f 177 if (file_exists($plugindir.'/settings.php')) {
b5e7b2bf 178 $settings = new admin_settingpage('gradereport'.$plugin, get_string('pluginname', 'gradereport_'.$plugin), 'moodle/grade:manage');
220a90c5 179 if ($ADMIN->fulltree) {
17da2e6f 180 include($plugindir.'/settings.php');
220a90c5 181 }
182 $ADMIN->add('gradereports', $settings);
183 }
28e2c556 184 }
28e2c556 185
220a90c5 186 // Imports
c8fbaa75 187 $ADMIN->add('grades', new admin_category('gradeimports', get_string('importsettings', 'grades')));
17da2e6f 188 foreach (get_plugin_list('gradeimport') as $plugin => $plugindir) {
220a90c5 189
190 // Include all the settings commands for this plugin if there are any
17da2e6f 191 if (file_exists($plugindir.'/settings.php')) {
b5e7b2bf 192 $settings = new admin_settingpage('gradeimport'.$plugin, get_string('pluginname', 'gradeimport_'.$plugin), 'moodle/grade:manage');
220a90c5 193 if ($ADMIN->fulltree) {
17da2e6f 194 include($plugindir.'/settings.php');
220a90c5 195 }
196 $ADMIN->add('gradeimports', $settings);
197 }
198 }
28e2c556 199
28e2c556 200
220a90c5 201 // Exports
c8fbaa75 202 $ADMIN->add('grades', new admin_category('gradeexports', get_string('exportsettings', 'grades')));
17da2e6f 203 foreach (get_plugin_list('gradeexport') as $plugin => $plugindir) {
220a90c5 204 // Include all the settings commands for this plugin if there are any
17da2e6f 205 if (file_exists($plugindir.'/settings.php')) {
b5e7b2bf 206 $settings = new admin_settingpage('gradeexport'.$plugin, get_string('pluginname', 'gradeexport_'.$plugin), 'moodle/grade:manage');
220a90c5 207 if ($ADMIN->fulltree) {
17da2e6f 208 include($plugindir.'/settings.php');
220a90c5 209 }
210 $ADMIN->add('gradeexports', $settings);
28e2c556 211 }
28e2c556 212 }
a559f630 213
214} // end of speedup
215