MDL-18004 Added two admin settings for showing/hiding the gradebook dropdown and...
[moodle.git] / admin / settings / grades.php
CommitLineData
28e2c556 1<?php // $Id$
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
220a90c5 29 $temp->add(new admin_setting_grade_profilereport());
30
31 $temp->add(new admin_setting_configselect('grade_aggregationposition', get_string('aggregationposition', 'grades'),
32 get_string('configaggregationposition', 'grades'), GRADE_REPORT_AGGREGATION_POSITION_LAST,
33 array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
34 GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
28e2c556 35
91f9a62c 36 $temp->add(new admin_setting_regradingcheckbox('grade_includescalesinaggregation', get_string('includescalesinaggregation', 'grades'), get_string('configincludescalesinaggregation', 'grades'), 1));
37
38 $temp->add(new admin_setting_configcheckbox('grade_hiddenasdate', get_string('hiddenasdate', 'grades'), get_string('confighiddenasdate', 'grades'), 0));
28e2c556 39
220a90c5 40 // enable publishing in exports/imports
91f9a62c 41 $temp->add(new admin_setting_configcheckbox('gradepublishing', get_string('gradepublishing', 'grades'), get_string('configgradepublishing', 'grades'), 0));
4e67c97b 42
220a90c5 43 $temp->add(new admin_setting_configselect('grade_export_displaytype', get_string('gradeexportdisplaytype', 'grades'),
7d10995c 44 get_string('configgradeexportdisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL, $display_types));
45
220a90c5 46
47 $temp->add(new admin_setting_configselect('grade_export_decimalpoints', get_string('gradeexportdecimalpoints', 'grades'),
48 get_string('configexportdecimalpoints', 'grades'), 2,
49 array( '0' => '0',
50 '1' => '1',
51 '2' => '2',
52 '3' => '3',
53 '4' => '4',
54 '5' => '5')));
8354e716 55 $temp->add(new admin_setting_configcheckbox('grade_shownavmenu', get_string('shownavmenu', 'grades'), get_string('configshownavmenu', 'grades'), 1));
56 $temp->add(new admin_setting_configcheckbox('grade_showtabs', get_string('showtabs', 'grades'), get_string('configshowtabs', 'grades'), 0));
220a90c5 57 $temp->add(new admin_setting_special_gradeexport());
58 }
59 $ADMIN->add('grades', $temp);
60
61 /// Grade category settings
62 $temp = new admin_settingpage('gradecategorysettings', get_string('gradecategorysettings', 'grades'), 'moodle/grade:manage');
63 if ($ADMIN->fulltree) {
64 $temp->add(new admin_setting_configcheckbox('grade_hideforcedsettings', get_string('hideforcedsettings', 'grades'), get_string('confighideforcedsettings', 'grades'), '1'));
65
66 $strnoforce = get_string('noforce', 'grades');
67
68 // Aggregation type
69 $options = array(GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', 'grades'),
70 GRADE_AGGREGATE_WEIGHTED_MEAN =>get_string('aggregateweightedmean', 'grades'),
71 GRADE_AGGREGATE_WEIGHTED_MEAN2 =>get_string('aggregateweightedmean2', 'grades'),
72 GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'),
73 GRADE_AGGREGATE_MEDIAN =>get_string('aggregatemedian', 'grades'),
74 GRADE_AGGREGATE_MIN =>get_string('aggregatemin', 'grades'),
75 GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'),
76 GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'),
77 GRADE_AGGREGATE_SUM =>get_string('aggregatesum', 'grades'));
78 $defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN2, 'forced'=>false, 'adv'=>false);
79 $temp->add(new admin_setting_gradecat_combo('grade_aggregation', get_string('aggregation', 'grades'), get_string('aggregationhelp', 'grades'), $defaults, $options));
80
81 $options = array(0 => get_string('no'), 1 => get_string('yes'));
82
83 $defaults = array('value'=>1, 'forced'=>false, 'adv'=>true);
84 $temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', get_string('aggregateonlygraded', 'grades'),
85 get_string('aggregateonlygradedhelp', 'grades'), $defaults, $options));
ee982b07 86 $defaults = array('value'=>0, 'forced'=>false, 'adv'=>true);
220a90c5 87 $temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', get_string('aggregateoutcomes', 'grades'),
88 get_string('aggregateoutcomeshelp', 'grades'), $defaults, $options));
89 $temp->add(new admin_setting_gradecat_combo('grade_aggregatesubcats', get_string('aggregatesubcats', 'grades'),
90 get_string('aggregatesubcatshelp', 'grades'), $defaults, $options));
91
92 $options = array(0 => get_string('none'));
93 for ($i=1; $i<=20; $i++) {
94 $options[$i] = $i;
28e2c556 95 }
96
220a90c5 97 $defaults['value'] = 0;
98 $defaults['forced'] = true;
99 $temp->add(new admin_setting_gradecat_combo('grade_keephigh', get_string('keephigh', 'grades'),
100 get_string('keephighhelp', 'grades'), $defaults, $options));
101 $defaults['forced'] = false;
102 $temp->add(new admin_setting_gradecat_combo('grade_droplow', get_string('droplow', 'grades'),
103 get_string('droplowhelp', 'grades'), $defaults, $options));
104 }
105 $ADMIN->add('grades', $temp);
106
107
108 /// Grade item settings
109 $temp = new admin_settingpage('gradeitemsettings', get_string('gradeitemsettings', 'grades'), 'moodle/grade:manage');
110 if ($ADMIN->fulltree) {
111 $temp->add(new admin_setting_configselect('grade_displaytype', get_string('gradedisplaytype', 'grades'),
7d10995c 112 get_string('configgradedisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL, $display_types));
220a90c5 113
114 $temp->add(new admin_setting_configselect('grade_decimalpoints', get_string('decimalpoints', 'grades'),
115 get_string('configdecimalpoints', 'grades'), 2,
116 array( '0' => '0',
117 '1' => '1',
118 '2' => '2',
119 '3' => '3',
120 '4' => '4',
121 '5' => '5')));
122
123 $temp->add(new admin_setting_configmultiselect('grade_item_advanced', get_string('gradeitemadvanced', 'grades'), get_string('configgradeitemadvanced', 'grades'),
124 array('iteminfo', 'idnumber', 'gradepass', 'plusfactor', 'multfactor', 'display', 'decimals', 'hiddenuntil', 'locktime'),
125 array('iteminfo' => get_string('iteminfo', 'grades'),
d343bd21 126 'idnumber' => get_string('idnumbermod'),
220a90c5 127 'gradetype' => get_string('gradetype', 'grades'),
128 'scaleid' => get_string('scale'),
129 'grademin' => get_string('grademin', 'grades'),
130 'grademax' => get_string('grademax', 'grades'),
131 'gradepass' => get_string('gradepass', 'grades'),
132 'plusfactor' => get_string('plusfactor', 'grades'),
133 'multfactor' => get_string('multfactor', 'grades'),
134 'display' => get_string('gradedisplaytype', 'grades'),
135 'decimals' => get_string('decimalpoints', 'grades'),
136 'hidden' => get_string('hidden', 'grades'),
137 'hiddenuntil' => get_string('hiddenuntil', 'grades'),
138 'locked' => get_string('locked', 'grades'),
139 'locktime' => get_string('locktime', 'grades'),
140 'aggregationcoef' => get_string('aggregationcoef', 'grades'),
141 'parentcategory' => get_string('parentcategory', 'grades'))));
142 }
143 $ADMIN->add('grades', $temp);
144
145
146 /// Scales and outcomes
147
148 $scales = new admin_externalpage('scales', get_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
149 $ADMIN->add('grades', $scales);
90658eef 150 $outcomes = new admin_externalpage('outcomes', get_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage', empty($CFG->enableoutcomes));
220a90c5 151 $ADMIN->add('grades', $outcomes);
152 $letters = new admin_externalpage('letters', get_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/edit.php', 'moodle/grade:manageletters');
153 $ADMIN->add('grades', $letters);
154
155 // The plugins must implement a settings.php file that adds their admin settings to the $settings object
156
157 // Reports
158 $ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
159 foreach (get_list_of_plugins('grade/report') as $plugin) {
160 // Include all the settings commands for this plugin if there are any
161 if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php')) {
162 $settings = new admin_settingpage('gradereport'.$plugin, get_string('modulename', 'gradereport_'.$plugin), 'moodle/grade:manage');
163 if ($ADMIN->fulltree) {
164 include($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php');
165 }
166 $ADMIN->add('gradereports', $settings);
167 }
28e2c556 168 }
28e2c556 169
220a90c5 170 // Imports
c8fbaa75 171 $ADMIN->add('grades', new admin_category('gradeimports', get_string('importsettings', 'grades')));
220a90c5 172 foreach (get_list_of_plugins('grade/import') as $plugin) {
173
174 // Include all the settings commands for this plugin if there are any
175 if (file_exists($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php')) {
176 $settings = new admin_settingpage('gradeimport'.$plugin, get_string('modulename', 'gradeimport_'.$plugin), 'moodle/grade:manage');
177 if ($ADMIN->fulltree) {
178 include($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php');
179 }
180 $ADMIN->add('gradeimports', $settings);
181 }
182 }
28e2c556 183
28e2c556 184
220a90c5 185 // Exports
c8fbaa75 186 $ADMIN->add('grades', new admin_category('gradeexports', get_string('exportsettings', 'grades')));
220a90c5 187 foreach (get_list_of_plugins('grade/export') as $plugin) {
188 // Include all the settings commands for this plugin if there are any
189 if (file_exists($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php')) {
190 $settings = new admin_settingpage('gradeexport'.$plugin, get_string('modulename', 'gradeexport_'.$plugin), 'moodle/grade:manage');
191 if ($ADMIN->fulltree) {
192 include($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php');
193 }
194 $ADMIN->add('gradeexports', $settings);
28e2c556 195 }
28e2c556 196 }
a559f630 197
198} // end of speedup
199
28e2c556 200?>