MDL-16075 adding support for embedded Glossary images
[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')));
70aaa10f 55 $temp->add(new admin_setting_configselect('grade_navmethod', get_string('navmethod', 'grades'), null, 0,
56 array(GRADE_NAVMETHOD_DROPDOWN => get_string('dropdown', 'grades'),
57 GRADE_NAVMETHOD_TABS => get_string('tabs', 'grades'),
58 GRADE_NAVMETHOD_COMBO => get_string('combo', 'grades'))));
59
220a90c5 60 $temp->add(new admin_setting_special_gradeexport());
61 }
62 $ADMIN->add('grades', $temp);
63
64 /// Grade category settings
65 $temp = new admin_settingpage('gradecategorysettings', get_string('gradecategorysettings', 'grades'), 'moodle/grade:manage');
66 if ($ADMIN->fulltree) {
67 $temp->add(new admin_setting_configcheckbox('grade_hideforcedsettings', get_string('hideforcedsettings', 'grades'), get_string('confighideforcedsettings', 'grades'), '1'));
68
69 $strnoforce = get_string('noforce', 'grades');
70
71 // Aggregation type
72 $options = array(GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', 'grades'),
73 GRADE_AGGREGATE_WEIGHTED_MEAN =>get_string('aggregateweightedmean', 'grades'),
74 GRADE_AGGREGATE_WEIGHTED_MEAN2 =>get_string('aggregateweightedmean2', 'grades'),
75 GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'),
76 GRADE_AGGREGATE_MEDIAN =>get_string('aggregatemedian', 'grades'),
77 GRADE_AGGREGATE_MIN =>get_string('aggregatemin', 'grades'),
78 GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'),
79 GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'),
80 GRADE_AGGREGATE_SUM =>get_string('aggregatesum', 'grades'));
81 $defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN2, 'forced'=>false, 'adv'=>false);
82 $temp->add(new admin_setting_gradecat_combo('grade_aggregation', get_string('aggregation', 'grades'), get_string('aggregationhelp', 'grades'), $defaults, $options));
83
84 $options = array(0 => get_string('no'), 1 => get_string('yes'));
85
86 $defaults = array('value'=>1, 'forced'=>false, 'adv'=>true);
87 $temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', get_string('aggregateonlygraded', 'grades'),
88 get_string('aggregateonlygradedhelp', 'grades'), $defaults, $options));
ee982b07 89 $defaults = array('value'=>0, 'forced'=>false, 'adv'=>true);
220a90c5 90 $temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', get_string('aggregateoutcomes', 'grades'),
91 get_string('aggregateoutcomeshelp', 'grades'), $defaults, $options));
92 $temp->add(new admin_setting_gradecat_combo('grade_aggregatesubcats', get_string('aggregatesubcats', 'grades'),
93 get_string('aggregatesubcatshelp', 'grades'), $defaults, $options));
94
95 $options = array(0 => get_string('none'));
96 for ($i=1; $i<=20; $i++) {
97 $options[$i] = $i;
28e2c556 98 }
99
220a90c5 100 $defaults['value'] = 0;
101 $defaults['forced'] = true;
102 $temp->add(new admin_setting_gradecat_combo('grade_keephigh', get_string('keephigh', 'grades'),
103 get_string('keephighhelp', 'grades'), $defaults, $options));
104 $defaults['forced'] = false;
105 $temp->add(new admin_setting_gradecat_combo('grade_droplow', get_string('droplow', 'grades'),
106 get_string('droplowhelp', 'grades'), $defaults, $options));
107 }
108 $ADMIN->add('grades', $temp);
109
110
111 /// Grade item settings
112 $temp = new admin_settingpage('gradeitemsettings', get_string('gradeitemsettings', 'grades'), 'moodle/grade:manage');
113 if ($ADMIN->fulltree) {
114 $temp->add(new admin_setting_configselect('grade_displaytype', get_string('gradedisplaytype', 'grades'),
7d10995c 115 get_string('configgradedisplaytype', 'grades'), GRADE_DISPLAY_TYPE_REAL, $display_types));
220a90c5 116
117 $temp->add(new admin_setting_configselect('grade_decimalpoints', get_string('decimalpoints', 'grades'),
118 get_string('configdecimalpoints', 'grades'), 2,
119 array( '0' => '0',
120 '1' => '1',
121 '2' => '2',
122 '3' => '3',
123 '4' => '4',
124 '5' => '5')));
125
126 $temp->add(new admin_setting_configmultiselect('grade_item_advanced', get_string('gradeitemadvanced', 'grades'), get_string('configgradeitemadvanced', 'grades'),
127 array('iteminfo', 'idnumber', 'gradepass', 'plusfactor', 'multfactor', 'display', 'decimals', 'hiddenuntil', 'locktime'),
128 array('iteminfo' => get_string('iteminfo', 'grades'),
d343bd21 129 'idnumber' => get_string('idnumbermod'),
220a90c5 130 'gradetype' => get_string('gradetype', 'grades'),
131 'scaleid' => get_string('scale'),
132 'grademin' => get_string('grademin', 'grades'),
133 'grademax' => get_string('grademax', 'grades'),
134 'gradepass' => get_string('gradepass', 'grades'),
135 'plusfactor' => get_string('plusfactor', 'grades'),
136 'multfactor' => get_string('multfactor', 'grades'),
137 'display' => get_string('gradedisplaytype', 'grades'),
138 'decimals' => get_string('decimalpoints', 'grades'),
139 'hidden' => get_string('hidden', 'grades'),
140 'hiddenuntil' => get_string('hiddenuntil', 'grades'),
141 'locked' => get_string('locked', 'grades'),
142 'locktime' => get_string('locktime', 'grades'),
143 'aggregationcoef' => get_string('aggregationcoef', 'grades'),
144 'parentcategory' => get_string('parentcategory', 'grades'))));
145 }
146 $ADMIN->add('grades', $temp);
147
148
149 /// Scales and outcomes
150
151 $scales = new admin_externalpage('scales', get_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
152 $ADMIN->add('grades', $scales);
da2f4411 153 if ($CFG->enableoutcomes) {
154 $outcomes = new admin_externalpage('outcomes', get_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage', empty($CFG->enableoutcomes));
155 $ADMIN->add('grades', $outcomes);
156 }
220a90c5 157 $letters = new admin_externalpage('letters', get_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/edit.php', 'moodle/grade:manageletters');
158 $ADMIN->add('grades', $letters);
159
160 // The plugins must implement a settings.php file that adds their admin settings to the $settings object
161
162 // Reports
163 $ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
164 foreach (get_list_of_plugins('grade/report') as $plugin) {
165 // Include all the settings commands for this plugin if there are any
166 if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php')) {
167 $settings = new admin_settingpage('gradereport'.$plugin, get_string('modulename', 'gradereport_'.$plugin), 'moodle/grade:manage');
168 if ($ADMIN->fulltree) {
169 include($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php');
170 }
171 $ADMIN->add('gradereports', $settings);
172 }
28e2c556 173 }
28e2c556 174
220a90c5 175 // Imports
c8fbaa75 176 $ADMIN->add('grades', new admin_category('gradeimports', get_string('importsettings', 'grades')));
220a90c5 177 foreach (get_list_of_plugins('grade/import') as $plugin) {
178
179 // Include all the settings commands for this plugin if there are any
180 if (file_exists($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php')) {
181 $settings = new admin_settingpage('gradeimport'.$plugin, get_string('modulename', 'gradeimport_'.$plugin), 'moodle/grade:manage');
182 if ($ADMIN->fulltree) {
183 include($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php');
184 }
185 $ADMIN->add('gradeimports', $settings);
186 }
187 }
28e2c556 188
28e2c556 189
220a90c5 190 // Exports
c8fbaa75 191 $ADMIN->add('grades', new admin_category('gradeexports', get_string('exportsettings', 'grades')));
220a90c5 192 foreach (get_list_of_plugins('grade/export') as $plugin) {
193 // Include all the settings commands for this plugin if there are any
194 if (file_exists($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php')) {
195 $settings = new admin_settingpage('gradeexport'.$plugin, get_string('modulename', 'gradeexport_'.$plugin), 'moodle/grade:manage');
196 if ($ADMIN->fulltree) {
197 include($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php');
198 }
199 $ADMIN->add('gradeexports', $settings);
28e2c556 200 }
28e2c556 201 }
a559f630 202
203} // end of speedup
204
28e2c556 205?>