MDL-11278 Admin settings page completed, implementation of settings in the gradebook...
[moodle-pu.git] / admin / settings / grades.php
blob96196dd63342d5afbf18020068626d21de90bc08
1 <?php // $Id$
3 // This file defines settingpages and externalpages under the "grades" section
5 // General settings
7 $temp = new admin_settingpage('gradessettings', get_string('gradessettings', 'grades'));
8 $temp->add(new admin_setting_special_gradeexport());
9 // enable outcomes checkbox
10 $temp->add(new admin_setting_configcheckbox('enableoutcomes', get_string('enableoutcomes', 'grades'), get_string('configenableoutcomes', 'grades'), 0, PARAM_INT));
11 // enable publishing in exports/imports
12 $temp->add(new admin_setting_configcheckbox('gradepublishing', get_string('gradepublishing', 'grades'), get_string('configgradepublishing', 'grades'), 0, PARAM_INT));
13 $ADMIN->add('grades', $temp);
15 /// Scales and outcomes
17 $scales = new admin_externalpage('scales', get_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
18 $ADMIN->add('grades', $scales);
19 $outcomes = new admin_externalpage('outcomes', get_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage');
20 $ADMIN->add('grades', $outcomes);
22 /// Grade category settings
23 require_once $CFG->libdir . '/grade/constants.php';
24 $temp = new admin_settingpage('gradecategorysettings', get_string('gradecategorysettings', 'grades'));
25 $strnoforce = get_string('noforce', 'grades');
27 // Aggregation type
28 $options = array(-1 => $strnoforce,
29 GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', 'grades'),
30 GRADE_AGGREGATE_MEDIAN =>get_string('aggregatemedian', 'grades'),
31 GRADE_AGGREGATE_MIN =>get_string('aggregatemin', 'grades'),
32 GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'),
33 GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'),
34 GRADE_AGGREGATE_WEIGHTED_MEAN =>get_string('aggregateweightedmean', 'grades'),
35 GRADE_AGGREGATE_EXTRACREDIT_MEAN=>get_string('aggregateextracreditmean', 'grades'));
36 $temp->add(new admin_setting_configselect('aggregation', get_string('aggregation', 'grades'), get_string('aggregationhelp', 'grades'), -1, $options));
38 $options = array(-1 => $strnoforce, 0 => get_string('forceoff', 'grades'), 1 => get_string('forceon', 'grades'));
39 $temp->add(new admin_setting_configselect('aggregateonlygraded', get_string('aggregateonlygraded', 'grades'),
40 get_string('aggregateonlygradedhelp', 'grades'), -1, $options));
41 $temp->add(new admin_setting_configselect('aggregateoutcomes', get_string('aggregateoutcomes', 'grades'),
42 get_string('aggregateoutcomeshelp', 'grades'), -1, $options));
43 $temp->add(new admin_setting_configselect('aggregatesubcats', get_string('aggregatesubcats', 'grades'),
44 get_string('aggregatesubcatshelp', 'grades'), -1, $options));
46 $options = array(-1 => $strnoforce, 0 => get_string('none'));
47 for ($i=1; $i<=20; $i++) {
48 $options[$i] = $i;
51 $temp->add(new admin_setting_configselect('keephigh', get_string('keephigh', 'grades'),
52 get_string('keephighhelp', 'grades'), -1, $options));
53 $temp->add(new admin_setting_configselect('droplow', get_string('droplow', 'grades'),
54 get_string('droplowhelp', 'grades'), -1, $options));
56 $ADMIN->add('grades', $temp);
58 // The plugins must implement a settings.php file that adds their admin settings to the $settings object
60 // Reports
62 $first = true;
63 foreach (get_list_of_plugins('grade/report') as $plugin) {
64 // Include all the settings commands for this plugin if there are any
65 if ($first) {
66 $ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
67 $first = false;
70 if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php')) {
72 $settings = new admin_settingpage('gradereport'.$plugin, get_string('modulename', 'gradereport_'.$plugin));
73 include_once($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php');
74 $ADMIN->add('gradereports', $settings);
78 // Imports
80 $first = true;
81 foreach (get_list_of_plugins('grade/import') as $plugin) {
83 // Include all the settings commands for this plugin if there are any
84 if (file_exists($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php')) {
85 if ($first) {
86 $ADMIN->add('grades', new admin_category('gradeimports', get_string('imports')));
87 $first = false;
90 $settings = new admin_settingpage('gradeimport'.$plugin, get_string('modulename', 'gradeimport_'.$plugin));
91 include_once($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php');
92 $ADMIN->add('gradeimports', $settings);
97 // Exports
99 $first = true;
100 foreach (get_list_of_plugins('grade/export') as $plugin) {
101 // Include all the settings commands for this plugin if there are any
102 if (file_exists($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php')) {
103 if ($first) {
104 $ADMIN->add('grades', new admin_category('gradeexports', get_string('exports')));
105 $first = false;
108 $settings = new admin_settingpage('gradeexport'.$plugin, get_string('modulename', 'gradeexport_'.$plugin));
109 include_once($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php');
110 $ADMIN->add('gradeexports', $settings);