Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / admin / settings / grades.php
blob05ea2f682d810d6dc0bab1b93345f6d77baa6f55
1 <?php // $Id$
3 // This file defines settingpages and externalpages under the "grades" section
5 if (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
8 // General settings
10 $temp = new admin_settingpage('gradessettings', get_string('generalsettings', 'grades'), 'moodle/grade:manage');
11 if ($ADMIN->fulltree) {
12 require_once $CFG->libdir.'/grade/constants.php';
14 // new CFG variable for gradebook (what roles to display)
15 $temp->add(new admin_setting_special_gradebookroles());
17 // enable outcomes checkbox
18 $temp->add(new admin_setting_configcheckbox('enableoutcomes', get_string('enableoutcomes', 'grades'), get_string('configenableoutcomes', 'grades'), 0, PARAM_INT));
20 $temp->add(new admin_setting_grade_profilereport());
22 $temp->add(new admin_setting_configselect('grade_aggregationposition', get_string('aggregationposition', 'grades'),
23 get_string('configaggregationposition', 'grades'), GRADE_REPORT_AGGREGATION_POSITION_LAST,
24 array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
25 GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'))));
27 $temp->add(new admin_setting_regradingcheckbox('grade_includescalesinaggregation', get_string('includescalesinaggregation', 'grades'), get_string('configincludescalesinaggregation', 'grades'), 1));
29 $temp->add(new admin_setting_configcheckbox('grade_hiddenasdate', get_string('hiddenasdate', 'grades'), get_string('confighiddenasdate', 'grades'), 0));
31 // enable publishing in exports/imports
32 $temp->add(new admin_setting_configcheckbox('gradepublishing', get_string('gradepublishing', 'grades'), get_string('configgradepublishing', 'grades'), 0));
34 $temp->add(new admin_setting_configselect('grade_export_displaytype', get_string('gradeexportdisplaytype', 'grades'),
35 get_string('configgradeexportdisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
36 array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
37 GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
38 GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
40 $temp->add(new admin_setting_configselect('grade_export_decimalpoints', get_string('gradeexportdecimalpoints', 'grades'),
41 get_string('configexportdecimalpoints', 'grades'), 2,
42 array( '0' => '0',
43 '1' => '1',
44 '2' => '2',
45 '3' => '3',
46 '4' => '4',
47 '5' => '5')));
49 $temp->add(new admin_setting_special_gradeexport());
51 $ADMIN->add('grades', $temp);
53 /// Grade category settings
54 $temp = new admin_settingpage('gradecategorysettings', get_string('gradecategorysettings', 'grades'), 'moodle/grade:manage');
55 if ($ADMIN->fulltree) {
56 $temp->add(new admin_setting_configcheckbox('grade_hideforcedsettings', get_string('hideforcedsettings', 'grades'), get_string('confighideforcedsettings', 'grades'), '1'));
58 $strnoforce = get_string('noforce', 'grades');
60 // Aggregation type
61 $options = array(GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', 'grades'),
62 GRADE_AGGREGATE_WEIGHTED_MEAN =>get_string('aggregateweightedmean', 'grades'),
63 GRADE_AGGREGATE_WEIGHTED_MEAN2 =>get_string('aggregateweightedmean2', 'grades'),
64 GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'),
65 GRADE_AGGREGATE_MEDIAN =>get_string('aggregatemedian', 'grades'),
66 GRADE_AGGREGATE_MIN =>get_string('aggregatemin', 'grades'),
67 GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'),
68 GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'),
69 GRADE_AGGREGATE_SUM =>get_string('aggregatesum', 'grades'));
70 $defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN2, 'forced'=>false, 'adv'=>false);
71 $temp->add(new admin_setting_gradecat_combo('grade_aggregation', get_string('aggregation', 'grades'), get_string('aggregationhelp', 'grades'), $defaults, $options));
73 $options = array(0 => get_string('no'), 1 => get_string('yes'));
75 $defaults = array('value'=>1, 'forced'=>false, 'adv'=>true);
76 $temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', get_string('aggregateonlygraded', 'grades'),
77 get_string('aggregateonlygradedhelp', 'grades'), $defaults, $options));
78 $defaults = array('value'=>0, 'forced'=>false, 'adv'=>true);
79 $temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', get_string('aggregateoutcomes', 'grades'),
80 get_string('aggregateoutcomeshelp', 'grades'), $defaults, $options));
81 $temp->add(new admin_setting_gradecat_combo('grade_aggregatesubcats', get_string('aggregatesubcats', 'grades'),
82 get_string('aggregatesubcatshelp', 'grades'), $defaults, $options));
84 $options = array(0 => get_string('none'));
85 for ($i=1; $i<=20; $i++) {
86 $options[$i] = $i;
89 $defaults['value'] = 0;
90 $defaults['forced'] = true;
91 $temp->add(new admin_setting_gradecat_combo('grade_keephigh', get_string('keephigh', 'grades'),
92 get_string('keephighhelp', 'grades'), $defaults, $options));
93 $defaults['forced'] = false;
94 $temp->add(new admin_setting_gradecat_combo('grade_droplow', get_string('droplow', 'grades'),
95 get_string('droplowhelp', 'grades'), $defaults, $options));
97 $ADMIN->add('grades', $temp);
100 /// Grade item settings
101 $temp = new admin_settingpage('gradeitemsettings', get_string('gradeitemsettings', 'grades'), 'moodle/grade:manage');
102 if ($ADMIN->fulltree) {
103 $temp->add(new admin_setting_configselect('grade_displaytype', get_string('gradedisplaytype', 'grades'),
104 get_string('configgradedisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL,
105 array(GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
106 GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
107 GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades'))));
109 $temp->add(new admin_setting_configselect('grade_decimalpoints', get_string('decimalpoints', 'grades'),
110 get_string('configdecimalpoints', 'grades'), 2,
111 array( '0' => '0',
112 '1' => '1',
113 '2' => '2',
114 '3' => '3',
115 '4' => '4',
116 '5' => '5')));
118 $temp->add(new admin_setting_configmultiselect('grade_item_advanced', get_string('gradeitemadvanced', 'grades'), get_string('configgradeitemadvanced', 'grades'),
119 array('iteminfo', 'idnumber', 'gradepass', 'plusfactor', 'multfactor', 'display', 'decimals', 'hiddenuntil', 'locktime'),
120 array('iteminfo' => get_string('iteminfo', 'grades'),
121 'idnumber' => get_string('idnumbermod'),
122 'gradetype' => get_string('gradetype', 'grades'),
123 'scaleid' => get_string('scale'),
124 'grademin' => get_string('grademin', 'grades'),
125 'grademax' => get_string('grademax', 'grades'),
126 'gradepass' => get_string('gradepass', 'grades'),
127 'plusfactor' => get_string('plusfactor', 'grades'),
128 'multfactor' => get_string('multfactor', 'grades'),
129 'display' => get_string('gradedisplaytype', 'grades'),
130 'decimals' => get_string('decimalpoints', 'grades'),
131 'hidden' => get_string('hidden', 'grades'),
132 'hiddenuntil' => get_string('hiddenuntil', 'grades'),
133 'locked' => get_string('locked', 'grades'),
134 'locktime' => get_string('locktime', 'grades'),
135 'aggregationcoef' => get_string('aggregationcoef', 'grades'),
136 'parentcategory' => get_string('parentcategory', 'grades'))));
138 $ADMIN->add('grades', $temp);
141 /// Scales and outcomes
143 $scales = new admin_externalpage('scales', get_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
144 $ADMIN->add('grades', $scales);
145 $outcomes = new admin_externalpage('outcomes', get_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage');
146 $ADMIN->add('grades', $outcomes);
147 $letters = new admin_externalpage('letters', get_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/edit.php', 'moodle/grade:manageletters');
148 $ADMIN->add('grades', $letters);
150 // The plugins must implement a settings.php file that adds their admin settings to the $settings object
152 // Reports
153 $ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
154 foreach (get_list_of_plugins('grade/report') as $plugin) {
155 // Include all the settings commands for this plugin if there are any
156 if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php')) {
157 $settings = new admin_settingpage('gradereport'.$plugin, get_string('modulename', 'gradereport_'.$plugin), 'moodle/grade:manage');
158 if ($ADMIN->fulltree) {
159 include($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php');
161 $ADMIN->add('gradereports', $settings);
165 // Imports
166 $ADMIN->add('grades', new admin_category('gradeimports', get_string('importsettings', 'grades')));
167 foreach (get_list_of_plugins('grade/import') as $plugin) {
169 // Include all the settings commands for this plugin if there are any
170 if (file_exists($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php')) {
171 $settings = new admin_settingpage('gradeimport'.$plugin, get_string('modulename', 'gradeimport_'.$plugin), 'moodle/grade:manage');
172 if ($ADMIN->fulltree) {
173 include($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php');
175 $ADMIN->add('gradeimports', $settings);
180 // Exports
181 $ADMIN->add('grades', new admin_category('gradeexports', get_string('exportsettings', 'grades')));
182 foreach (get_list_of_plugins('grade/export') as $plugin) {
183 // Include all the settings commands for this plugin if there are any
184 if (file_exists($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php')) {
185 $settings = new admin_settingpage('gradeexport'.$plugin, get_string('modulename', 'gradeexport_'.$plugin), 'moodle/grade:manage');
186 if ($ADMIN->fulltree) {
187 include($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php');
189 $ADMIN->add('gradeexports', $settings);
193 } // end of speedup