2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Defines the form for editing activity results block instances.
20 * @package block_activity_results
21 * @copyright 2016 Stephen Bourget
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 defined('MOODLE_INTERNAL') ||
die;
27 if ($ADMIN->fulltree
) {
29 // Default high scores.
30 $setting = new admin_setting_configtext('block_activity_results/config_showbest',
31 new lang_string('defaulthighestgrades', 'block_activity_results'),
32 new lang_string('defaulthighestgrades_desc', 'block_activity_results'), 3, PARAM_INT
);
33 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
34 $settings->add($setting);
36 // Default low scores.
37 $setting = new admin_setting_configtext('block_activity_results/config_showworst',
38 new lang_string('defaultlowestgrades', 'block_activity_results'),
39 new lang_string('defaultlowestgrades_desc', 'block_activity_results'), 0, PARAM_INT
);
40 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
41 $settings->add($setting);
43 // Default group display.
44 $yesno = array(0 => get_string('no'), 1 => get_string('yes'));
45 $setting = new admin_setting_configselect('block_activity_results/config_usegroups',
46 new lang_string('defaultshowgroups', 'block_activity_results'),
47 new lang_string('defaultshowgroups_desc', 'block_activity_results'), 0, $yesno);
48 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
49 $settings->add($setting);
51 // Default privacy settings.
53 B_ACTIVITYRESULTS_NAME_FORMAT_FULL
=> get_string('config_names_full', 'block_activity_results'),
54 B_ACTIVITYRESULTS_NAME_FORMAT_ID
=> get_string('config_names_id', 'block_activity_results'),
55 B_ACTIVITYRESULTS_NAME_FORMAT_ANON
=> get_string('config_names_anon', 'block_activity_results')
57 $setting = new admin_setting_configselect('block_activity_results/config_nameformat',
58 new lang_string('defaultnameoptions', 'block_activity_results'),
59 new lang_string('defaultnameoptions_desc', 'block_activity_results'), B_ACTIVITYRESULTS_NAME_FORMAT_FULL
, $nameoptions);
60 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
61 $settings->add($setting);
63 // Default grade display settings.
64 $gradeoptions = array(
65 B_ACTIVITYRESULTS_GRADE_FORMAT_PCT
=> get_string('config_format_percentage', 'block_activity_results'),
66 B_ACTIVITYRESULTS_GRADE_FORMAT_FRA
=> get_string('config_format_fraction', 'block_activity_results'),
67 B_ACTIVITYRESULTS_GRADE_FORMAT_ABS
=> get_string('config_format_absolute', 'block_activity_results')
69 $setting = new admin_setting_configselect('block_activity_results/config_gradeformat',
70 new lang_string('defaultgradedisplay', 'block_activity_results'),
71 new lang_string('defaultgradedisplay_desc', 'block_activity_results'), B_ACTIVITYRESULTS_GRADE_FORMAT_PCT
, $gradeoptions);
72 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
73 $settings->add($setting);
75 // Default decimal places.
77 for ($i = 0; $i <= 5; $i++
) {
80 $setting = new admin_setting_configselect('block_activity_results/config_decimalpoints',
81 new lang_string('defaultdecimalplaces', 'block_activity_results'),
82 new lang_string('defaultdecimalplaces_desc', 'block_activity_results'), 2, $places);
83 $setting->set_locked_flag_options(admin_setting_flag
::ENABLED
, false);
84 $settings->add($setting);