MDL-11934 grade report in user profile now selectable
[moodle.git] / admin / settings / grades.php
CommitLineData
28e2c556 1<?php // $Id$
2
3// This file defines settingpages and externalpages under the "grades" section
4
5// General settings
6
d622930b 7require_once $CFG->libdir.'/grade/constants.php';
8
5df8b070 9$temp = new admin_settingpage('gradessettings', get_string('gradessettings', 'grades'));
864d1f8c 10
4e67c97b 11// enable outcomes checkbox
5df8b070 12$temp->add(new admin_setting_configcheckbox('enableoutcomes', get_string('enableoutcomes', 'grades'), get_string('configenableoutcomes', 'grades'), 0, PARAM_INT));
d622930b 13
0a784551 14$temp->add(new admin_setting_grade_profilereport());
15
e0724506 16$temp->add(new admin_setting_configselect('grade_aggregationposition', get_string('aggregationposition', 'grades'),
17 get_string('configaggregationposition', 'grades'), GRADE_REPORT_AGGREGATION_POSITION_LAST,
18 array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
19 GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
20
d622930b 21$temp->add(new admin_setting_configselect('grade_displaytype', get_string('gradedisplaytype', 'grades'),
22 get_string('configgradedisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
23 array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
24 GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
25 GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
26
27$temp->add(new admin_setting_configselect('grade_decimalpoints', get_string('decimalpoints', 'grades'),
28 get_string('configdecimalpoints', 'grades'), 2,
29 array( '0' => '0',
30 '1' => '1',
31 '2' => '2',
32 '3' => '3',
33 '4' => '4',
34 '5' => '5')));
35
d297269d 36$temp->add(new admin_setting_configcheckbox('grade_hiddenasdate', get_string('hiddenasdate', 'grades'), get_string('confighiddenasdate', 'grades'), 0, PARAM_INT));
37
38// enable publishing in exports/imports
39$temp->add(new admin_setting_configcheckbox('gradepublishing', get_string('gradepublishing', 'grades'), get_string('configgradepublishing', 'grades'), 0, PARAM_INT));
40
864d1f8c 41$temp->add(new admin_setting_configselect('grade_export_displaytype', get_string('gradeexportdisplaytype', 'grades'),
42 get_string('configgradeexportdisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
43 array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
44 GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
45 GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
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',
d297269d 54 '5' => '5')));
55
864d1f8c 56$temp->add(new admin_setting_special_gradeexport());
28e2c556 57$ADMIN->add('grades', $temp);
58
53461661 59/// Grade category settings
53461661 60$temp = new admin_settingpage('gradecategorysettings', get_string('gradecategorysettings', 'grades'));
d622930b 61
89a5f827 62$temp->add(new admin_setting_configcheckbox('grade_hideforcedsettings', get_string('hideforcedsettings', 'grades'), get_string('confighideforcedsettings', 'grades'), 0, PARAM_INT));
63
53461661 64$strnoforce = get_string('noforce', 'grades');
65
89a5f827 66// Aggregation type
67$options = array(-1 =>$strnoforce,
53461661 68 GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', 'grades'),
69 GRADE_AGGREGATE_MEDIAN =>get_string('aggregatemedian', 'grades'),
70 GRADE_AGGREGATE_MIN =>get_string('aggregatemin', 'grades'),
71 GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'),
72 GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'),
73 GRADE_AGGREGATE_WEIGHTED_MEAN =>get_string('aggregateweightedmean', 'grades'),
74 GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'));
89a5f827 75$temp->add(new admin_category_regrade_select('grade_aggregation', get_string('aggregation', 'grades'), get_string('aggregationhelp', 'grades'), -1, $options));
53461661 76
77$options = array(-1 => $strnoforce, 0 => get_string('forceoff', 'grades'), 1 => get_string('forceon', 'grades'));
89a5f827 78$temp->add(new admin_category_regrade_select('grade_aggregateonlygraded', get_string('aggregateonlygraded', 'grades'),
53461661 79 get_string('aggregateonlygradedhelp', 'grades'), -1, $options));
89a5f827 80$temp->add(new admin_category_regrade_select('grade_aggregateoutcomes', get_string('aggregateoutcomes', 'grades'),
53461661 81 get_string('aggregateoutcomeshelp', 'grades'), -1, $options));
89a5f827 82$temp->add(new admin_category_regrade_select('grade_aggregatesubcats', get_string('aggregatesubcats', 'grades'),
53461661 83 get_string('aggregatesubcatshelp', 'grades'), -1, $options));
84
85$options = array(-1 => $strnoforce, 0 => get_string('none'));
86for ($i=1; $i<=20; $i++) {
87 $options[$i] = $i;
88}
89
89a5f827 90$temp->add(new admin_category_regrade_select('grade_keephigh', get_string('keephigh', 'grades'),
53461661 91 get_string('keephighhelp', 'grades'), -1, $options));
89a5f827 92$temp->add(new admin_category_regrade_select('grade_droplow', get_string('droplow', 'grades'),
53461661 93 get_string('droplowhelp', 'grades'), -1, $options));
94
95$ADMIN->add('grades', $temp);
173a9d21 96
d297269d 97/// Scales and outcomes
98
99$scales = new admin_externalpage('scales', get_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
100$ADMIN->add('grades', $scales);
101$outcomes = new admin_externalpage('outcomes', get_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage');
102$ADMIN->add('grades', $outcomes);
103$letters = new admin_externalpage('letters', get_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/edit.php', 'moodle/grade:manageletters');
104$ADMIN->add('grades', $letters);
105
28e2c556 106// The plugins must implement a settings.php file that adds their admin settings to the $settings object
107
108// Reports
109
110$first = true;
111foreach (get_list_of_plugins('grade/report') as $plugin) {
112 // Include all the settings commands for this plugin if there are any
4e67c97b 113 if ($first) {
173a9d21 114 $ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
4e67c97b 115 $first = false;
5df8b070 116 }
117
173a9d21 118 if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php')) {
28e2c556 119
120 $settings = new admin_settingpage('gradereport'.$plugin, get_string('modulename', 'gradereport_'.$plugin));
02973505 121 include($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php');
28e2c556 122 $ADMIN->add('gradereports', $settings);
123 }
124}
125
28e2c556 126// Imports
127
128$first = true;
129foreach (get_list_of_plugins('grade/import') as $plugin) {
4e67c97b 130
28e2c556 131 // Include all the settings commands for this plugin if there are any
132 if (file_exists($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php')) {
133 if ($first) {
134 $ADMIN->add('grades', new admin_category('gradeimports', get_string('imports')));
135 $first = false;
136 }
137
138 $settings = new admin_settingpage('gradeimport'.$plugin, get_string('modulename', 'gradeimport_'.$plugin));
02973505 139 include($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php');
28e2c556 140 $ADMIN->add('gradeimports', $settings);
141 }
142}
143
144
145// Exports
146
147$first = true;
148foreach (get_list_of_plugins('grade/export') as $plugin) {
149 // Include all the settings commands for this plugin if there are any
150 if (file_exists($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php')) {
151 if ($first) {
152 $ADMIN->add('grades', new admin_category('gradeexports', get_string('exports')));
153 $first = false;
154 }
155
156 $settings = new admin_settingpage('gradeexport'.$plugin, get_string('modulename', 'gradeexport_'.$plugin));
02973505 157 include($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php');
28e2c556 158 $ADMIN->add('gradeexports', $settings);
159 }
160}
28e2c556 161?>