first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+163
View File
@@ -0,0 +1,163 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Adds settings links to admin tree.
*
* @package core_analytics
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig && \core_analytics\manager::is_analytics_enabled()) {
$settings = new admin_settingpage('analyticssite', new lang_string('analyticssiteinfo', 'analytics'));
$ADMIN->add('analytics', $settings);
if ($ADMIN->fulltree) {
$modeinstructions = [
'facetoface' => get_string('modeinstructionfacetoface', 'analytics'),
'blendedhybrid' => get_string('modeinstructionblendedhybrid', 'analytics'),
'fullyonline' => get_string('modeinstructionfullyonline', 'analytics'),
];
$settings->add(new admin_setting_configmultiselect('analytics/modeinstruction', get_string('modeinstruction', 'analytics'),
'', [], $modeinstructions));
$settings->add(new admin_setting_configtext_with_maxlength('analytics/percentonline',
get_string('percentonline', 'analytics'),
get_string('percentonline_help', 'analytics'), '', PARAM_INT, 3, 3));
$typeinstitutions = [
'typeinstitutionacademic' => get_string('typeinstitutionacademic', 'analytics'),
'typeinstitutiontraining' => get_string('typeinstitutiontraining', 'analytics'),
'typeinstitutionngo' => get_string('typeinstitutionngo', 'analytics'),
];
$settings->add(new admin_setting_configmultiselect('analytics/typeinstitution', get_string('typeinstitution', 'analytics'),
'', [], $typeinstitutions));
$levelinstitutions = [
'levelinstitutionisced0' => get_string('levelinstitutionisced0', 'analytics'),
'levelinstitutionisced1' => get_string('levelinstitutionisced1', 'analytics'),
'levelinstitutionisced2' => get_string('levelinstitutionisced2', 'analytics'),
'levelinstitutionisced3' => get_string('levelinstitutionisced3', 'analytics'),
'levelinstitutionisced4' => get_string('levelinstitutionisced4', 'analytics'),
'levelinstitutionisced5' => get_string('levelinstitutionisced5', 'analytics'),
'levelinstitutionisced6' => get_string('levelinstitutionisced6', 'analytics'),
'levelinstitutionisced7' => get_string('levelinstitutionisced7', 'analytics'),
'levelinstitutionisced8' => get_string('levelinstitutionisced8', 'analytics'),
];
$settings->add(new admin_setting_configmultiselect('analytics/levelinstitution',
get_string('levelinstitution', 'analytics'), '', [], $levelinstitutions));
}
$settings = new admin_settingpage('analyticssettings', new lang_string('analyticssettings', 'analytics'));
$ADMIN->add('analytics', $settings);
if ($ADMIN->fulltree) {
// Select the site prediction's processor.
$predictionprocessors = \core_analytics\manager::get_all_prediction_processors();
$predictors = array();
foreach ($predictionprocessors as $fullclassname => $predictor) {
$pluginname = substr($fullclassname, 1, strpos($fullclassname, '\\', 1) - 1);
$predictors[$fullclassname] = new lang_string('pluginname', $pluginname);
}
$settings->add(new \core_analytics\admin_setting_predictor('analytics/predictionsprocessor',
new lang_string('defaultpredictionsprocessor', 'analytics'), new lang_string('predictionsprocessor_help', 'analytics'),
\core_analytics\manager::default_mlbackend(), $predictors)
);
// Log store.
$logmanager = get_log_manager();
$readers = $logmanager->get_readers('core\log\sql_reader');
$options = array();
$defaultreader = null;
foreach ($readers as $plugin => $reader) {
if (!$reader->is_logging()) {
continue;
}
if (!isset($defaultreader)) {
// The top one as default reader.
$defaultreader = $plugin;
}
$options[$plugin] = $reader->get_name();
}
if (empty($defaultreader)) {
// We fall here during initial site installation because log stores are not
// enabled until admin/tool/log/db/install.php is executed and get_readers
// return nothing.
if ($enabledlogstores = get_config('tool_log', 'enabled_stores')) {
$enabledlogstores = explode(',', $enabledlogstores);
$defaultreader = reset($enabledlogstores);
// No need to set the correct name, just the value, this will not be displayed.
$options[$defaultreader] = $defaultreader;
}
}
$settings->add(new admin_setting_configselect('analytics/logstore',
new lang_string('analyticslogstore', 'analytics'), new lang_string('analyticslogstore_help', 'analytics'),
$defaultreader, $options));
// Enable/disable time splitting methods.
$alltimesplittings = \core_analytics\manager::get_time_splitting_methods_for_evaluation(true);
$timesplittingoptions = array();
$timesplittingdefaults = array('\core\analytics\time_splitting\quarters_accum',
'\core\analytics\time_splitting\quarters', '\core\analytics\time_splitting\single_range');
foreach ($alltimesplittings as $key => $timesplitting) {
$timesplittingoptions[$key] = $timesplitting->get_name();
}
$settings->add(new admin_setting_configmultiselect('analytics/defaulttimesplittingsevaluation',
new lang_string('defaulttimesplittingmethods', 'analytics'),
new lang_string('defaulttimesplittingmethods_help', 'analytics'),
$timesplittingdefaults, $timesplittingoptions)
);
// Predictions processor output dir - specify default in setting description (used if left blank).
$defaultmodeloutputdir = \core_analytics\model::default_output_dir();
$settings->add(new admin_setting_configdirectory('analytics/modeloutputdir', new lang_string('modeloutputdir', 'analytics'),
new lang_string('modeloutputdirwithdefaultinfo', 'analytics', $defaultmodeloutputdir), ''));
// Disable web interface evaluation and get predictions.
$settings->add(new admin_setting_configcheckbox('analytics/onlycli', new lang_string('onlycli', 'analytics'),
new lang_string('onlycliinfo', 'analytics'), 1));
// Training and prediction time limit per model.
$settings->add(new admin_setting_configduration('analytics/modeltimelimit', new lang_string('modeltimelimit', 'analytics'),
new lang_string('modeltimelimitinfo', 'analytics'), 20 * MINSECS));
$options = array(
0 => new lang_string('neverdelete', 'analytics'),
1000 => new lang_string('numdays', '', 1000),
365 => new lang_string('numdays', '', 365),
180 => new lang_string('numdays', '', 180),
150 => new lang_string('numdays', '', 150),
120 => new lang_string('numdays', '', 120),
90 => new lang_string('numdays', '', 90),
60 => new lang_string('numdays', '', 60),
35 => new lang_string('numdays', '', 35));
$settings->add(new admin_setting_configselect('analytics/calclifetime',
new lang_string('calclifetime', 'analytics'),
new lang_string('configlcalclifetime', 'analytics'), 35, $options));
}
}
+366
View File
@@ -0,0 +1,366 @@
<?php
// This file defines settingpages and externalpages under the "appearance" category
$capabilities = array(
'moodle/my:configsyspages',
'moodle/tag:manage'
);
if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // speedup for non-admins, add all caps used on this page
// Logos section.
$temp = new admin_settingpage('logos', new lang_string('logossettings', 'admin'));
// Logo file setting.
$title = get_string('logo', 'admin');
$description = get_string('logo_desc', 'admin');
$setting = new admin_setting_configstoredfile('core_admin/logo', $title, $description, 'logo', 0,
['maxfiles' => 1, 'accepted_types' => ['.jpg', '.png']]);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
// Small logo file setting.
$title = get_string('logocompact', 'admin');
$description = get_string('logocompact_desc', 'admin');
$setting = new admin_setting_configstoredfile('core_admin/logocompact', $title, $description, 'logocompact', 0,
['maxfiles' => 1, 'accepted_types' => ['.jpg', '.png']]);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
// Favicon file setting.
$title = get_string('favicon', 'admin');
$description = get_string('favicon_desc', 'admin');
$setting = new admin_setting_configstoredfile('core_admin/favicon', $title, $description, 'favicon', 0,
['maxfiles' => 1, 'accepted_types' => ['image']]);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
$ADMIN->add('appearance', $temp);
// Course colours section.
$temp = new admin_settingpage('coursecolors', new lang_string('coursecolorsettings', 'admin'));
$temp->add(new admin_setting_heading('coursecolorheading', '',
new lang_string('coursecolorheading_desc', 'admin')));
$basecolors = ['#81ecec', '#74b9ff', '#a29bfe', '#dfe6e9', '#00b894',
'#0984e3', '#b2bec3', '#fdcb6e', '#fd79a8', '#6c5ce7'];
foreach ($basecolors as $key => $color) {
$number = $key + 1;
$name = 'core_admin/coursecolor' . $number;
$title = get_string('coursecolor', 'admin', $number);
$setting = new admin_setting_configcolourpicker($name, $title, '', $color);
$temp->add($setting);
}
$ADMIN->add('appearance', $temp);
// Calendar settings.
$temp = new admin_settingpage('calendar', new lang_string('calendarsettings','admin'));
$temp->add(new admin_setting_configselect('calendartype', new lang_string('calendartype', 'admin'),
new lang_string('calendartype_desc', 'admin'), 'gregorian', \core_calendar\type_factory::get_list_of_calendar_types()));
$temp->add(new admin_setting_special_adminseesall());
//this is hacky because we do not want to include the stuff from calendar/lib.php
$temp->add(new admin_setting_configselect('calendar_site_timeformat', new lang_string('pref_timeformat', 'calendar'),
new lang_string('explain_site_timeformat', 'calendar'), '0',
array('0' => new lang_string('default', 'calendar'),
'%I:%M %p' => new lang_string('timeformat_12', 'calendar'),
'%H:%M' => new lang_string('timeformat_24', 'calendar'))));
$temp->add(new admin_setting_configselect('calendar_startwday', new lang_string('configstartwday', 'admin'),
new lang_string('helpstartofweek', 'admin'), get_string('firstdayofweek', 'langconfig'),
array(
0 => new lang_string('sunday', 'calendar'),
1 => new lang_string('monday', 'calendar'),
2 => new lang_string('tuesday', 'calendar'),
3 => new lang_string('wednesday', 'calendar'),
4 => new lang_string('thursday', 'calendar'),
5 => new lang_string('friday', 'calendar'),
6 => new lang_string('saturday', 'calendar')
)));
$temp->add(new admin_setting_special_calendar_weekend());
$options = array(365 => new lang_string('numyear', '', 1),
270 => new lang_string('nummonths', '', 9),
180 => new lang_string('nummonths', '', 6),
150 => new lang_string('nummonths', '', 5),
120 => new lang_string('nummonths', '', 4),
90 => new lang_string('nummonths', '', 3),
60 => new lang_string('nummonths', '', 2),
30 => new lang_string('nummonth', '', 1),
21 => new lang_string('numweeks', '', 3),
14 => new lang_string('numweeks', '', 2),
7 => new lang_string('numweek', '', 1),
6 => new lang_string('numdays', '', 6),
5 => new lang_string('numdays', '', 5),
4 => new lang_string('numdays', '', 4),
3 => new lang_string('numdays', '', 3),
2 => new lang_string('numdays', '', 2),
1 => new lang_string('numday', '', 1));
$temp->add(new admin_setting_configselect('calendar_lookahead', new lang_string('configlookahead', 'admin'), new lang_string('helpupcominglookahead', 'admin'), 21, $options));
$options = array();
for ($i=1; $i<=20; $i++) {
$options[$i] = $i;
}
$temp->add(new admin_setting_configselect('calendar_maxevents',new lang_string('configmaxevents','admin'),new lang_string('helpupcomingmaxevents', 'admin'),10,$options));
$temp->add(new admin_setting_configcheckbox('enablecalendarexport', new lang_string('enablecalendarexport', 'admin'), new lang_string('configenablecalendarexport','admin'), 1));
// Calendar custom export settings.
$days = array(365 => new lang_string('numdays', '', 365),
180 => new lang_string('numdays', '', 180),
150 => new lang_string('numdays', '', 150),
120 => new lang_string('numdays', '', 120),
90 => new lang_string('numdays', '', 90),
60 => new lang_string('numdays', '', 60),
30 => new lang_string('numdays', '', 30),
5 => new lang_string('numdays', '', 5));
$temp->add(new admin_setting_configcheckbox('calendar_customexport', new lang_string('configcalendarcustomexport', 'admin'), new lang_string('helpcalendarcustomexport','admin'), 1));
$temp->add(new admin_setting_configselect('calendar_exportlookahead', new lang_string('configexportlookahead','admin'), new lang_string('helpexportlookahead', 'admin'), 365, $days));
$temp->add(new admin_setting_configselect('calendar_exportlookback', new lang_string('configexportlookback','admin'), new lang_string('helpexportlookback', 'admin'), 5, $days));
$temp->add(new admin_setting_configtext('calendar_exportsalt', new lang_string('calendarexportsalt','admin'), new lang_string('configcalendarexportsalt', 'admin'), random_string(60)));
$temp->add(new admin_setting_configcheckbox('calendar_showicalsource', new lang_string('configshowicalsource', 'admin'), new lang_string('helpshowicalsource','admin'), 1));
$ADMIN->add('appearance', $temp);
// blog
$temp = new admin_settingpage('blog', new lang_string('blog','blog'), 'moodle/site:config', empty($CFG->enableblogs));
$temp->add(new admin_setting_configcheckbox('useblogassociations', new lang_string('useblogassociations', 'blog'), new lang_string('configuseblogassociations','blog'), 1));
$temp->add(new admin_setting_bloglevel('bloglevel', new lang_string('bloglevel', 'admin'), new lang_string('configbloglevel', 'admin'), 4, array(BLOG_GLOBAL_LEVEL => new lang_string('worldblogs','blog'),
BLOG_SITE_LEVEL => new lang_string('siteblogs','blog'),
BLOG_USER_LEVEL => new lang_string('personalblogs','blog'))));
$temp->add(new admin_setting_configcheckbox('useexternalblogs', new lang_string('useexternalblogs', 'blog'), new lang_string('configuseexternalblogs','blog'), 1));
$temp->add(new admin_setting_configselect('externalblogcrontime', new lang_string('externalblogcrontime', 'blog'), new lang_string('configexternalblogcrontime', 'blog'), 86400,
array(43200 => new lang_string('numhours', '', 12),
86400 => new lang_string('numhours', '', 24),
172800 => new lang_string('numdays', '', 2),
604800 => new lang_string('numdays', '', 7))));
$temp->add(new admin_setting_configtext('maxexternalblogsperuser', new lang_string('maxexternalblogsperuser','blog'), new lang_string('configmaxexternalblogsperuser', 'blog'), 1));
$temp->add(new admin_setting_configcheckbox('blogusecomments', new lang_string('enablecomments', 'admin'), new lang_string('configenablecomments', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('blogshowcommentscount', new lang_string('showcommentscount', 'admin'), new lang_string('configshowcommentscount', 'admin'), 1));
$ADMIN->add('appearance', $temp);
// Navigation settings
$temp = new admin_settingpage('navigation', new lang_string('navigation'));
$temp->add(new admin_setting_configcheckbox(
'enabledashboard',
new lang_string('enabledashboard', 'admin'),
new lang_string('enabledashboard_help', 'admin'),
1
));
$choices = [HOMEPAGE_SITE => new lang_string('home')];
if (!isset($CFG->enabledashboard) || $CFG->enabledashboard) {
$choices[HOMEPAGE_MY] = new lang_string('mymoodle', 'admin');
}
$choices[HOMEPAGE_MYCOURSES] = new lang_string('mycourses', 'admin');
$choices[HOMEPAGE_USER] = new lang_string('userpreference', 'admin');
$temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'),
new lang_string('configdefaulthomepage', 'admin'), get_default_home_page(), $choices));
if (!isset($CFG->enabledashboard) || $CFG->enabledashboard) {
$temp->add(new admin_setting_configcheckbox(
'allowguestmymoodle',
new lang_string('allowguestmymoodle', 'admin'),
new lang_string('configallowguestmymoodle', 'admin'),
1
));
}
$temp->add(new admin_setting_configcheckbox('navshowfullcoursenames', new lang_string('navshowfullcoursenames', 'admin'), new lang_string('navshowfullcoursenames_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));
$sortoptions = array(
'sortorder' => new lang_string('sort_sortorder', 'admin'),
'fullname' => new lang_string('sort_fullname', 'admin'),
'shortname' => new lang_string('sort_shortname', 'admin'),
'idnumber' => new lang_string('sort_idnumber', 'admin'),
);
$temp->add(new admin_setting_configselect('navsortmycoursessort', new lang_string('navsortmycoursessort', 'admin'), new lang_string('navsortmycoursessort_help', 'admin'), 'sortorder', $sortoptions));
$temp->add(new admin_setting_configcheckbox('navsortmycourseshiddenlast',
new lang_string('navsortmycourseshiddenlast', 'admin'),
new lang_string('navsortmycourseshiddenlast_help', 'admin'),
1));
$temp->add(new admin_setting_configtext('navcourselimit', new lang_string('navcourselimit', 'admin'),
new lang_string('confignavcourselimit', 'admin'), 10, PARAM_INT));
$temp->add(new admin_setting_configcheckbox('usesitenameforsitepages', new lang_string('usesitenameforsitepages', 'admin'), new lang_string('configusesitenameforsitepages', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('linkadmincategories', new lang_string('linkadmincategories', 'admin'), new lang_string('linkadmincategories_help', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('navshowfrontpagemods', new lang_string('navshowfrontpagemods', 'admin'), new lang_string('navshowfrontpagemods_help', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('navadduserpostslinks', new lang_string('navadduserpostslinks', 'admin'), new lang_string('navadduserpostslinks_help', 'admin'), 1));
$ADMIN->add('appearance', $temp);
// "htmlsettings" settingpage
$temp = new admin_settingpage('htmlsettings', new lang_string('htmlsettings', 'admin'));
$sitenameintitleoptions = [
'shortname' => new lang_string('shortname'),
'fullname' => new lang_string('fullname'),
];
$sitenameintitleconfig = new admin_setting_configselect(
'sitenameintitle',
new lang_string('sitenameintitle', 'admin'),
new lang_string('sitenameintitle_help', 'admin'),
'shortname',
$sitenameintitleoptions
);
$temp->add($sitenameintitleconfig);
$temp->add(new admin_setting_configcheckbox('formatstringstriptags', new lang_string('stripalltitletags', 'admin'), new lang_string('configstripalltitletags', 'admin'), 1));
$temp->add(new admin_setting_emoticons());
$ADMIN->add('appearance', $temp);
$ADMIN->add('appearance', new admin_externalpage('resetemoticons', new lang_string('emoticonsreset', 'admin'),
new moodle_url('/admin/resetemoticons.php'), 'moodle/site:config', true));
// "documentation" settingpage
$temp = new admin_settingpage('documentation', new lang_string('moodledocs'));
$temp->add(new admin_setting_configtext('docroot', new lang_string('docroot', 'admin'), new lang_string('configdocroot', 'admin'), 'https://docs.moodle.org', PARAM_URL));
$ltemp = array('' => get_string('forceno'));
$ltemp += get_string_manager()->get_list_of_translations(true);
$temp->add(new admin_setting_configselect('doclang', get_string('doclang', 'admin'), get_string('configdoclang', 'admin'), '', $ltemp));
$temp->add(new admin_setting_configcheckbox('doctonewwindow', new lang_string('doctonewwindow', 'admin'), new lang_string('configdoctonewwindow', 'admin'), 0));
$temp->add(new admin_setting_configtext(
'coursecreationguide',
new lang_string('coursecreationguide', 'admin'),
new lang_string('coursecreationguide_help', 'admin'),
'https://moodle.academy/coursequickstart',
PARAM_URL
));
$ADMIN->add('appearance', $temp);
if (!empty($CFG->enabledashboard)) {
$temp = new admin_externalpage('mypage', new lang_string('mypage', 'admin'), $CFG->wwwroot . '/my/indexsys.php',
'moodle/my:configsyspages');
$ADMIN->add('appearance', $temp);
}
$temp = new admin_externalpage('profilepage', new lang_string('myprofile', 'admin'), $CFG->wwwroot . '/user/profilesys.php',
'moodle/my:configsyspages');
$ADMIN->add('appearance', $temp);
// coursecontact is the person responsible for course - usually manages enrolments, receives notification, etc.
$temp = new admin_settingpage('coursecontact', new lang_string('courses'));
$temp->add(new admin_setting_special_coursecontact());
$temp->add(new admin_setting_configcheckbox('coursecontactduplicates',
new lang_string('coursecontactduplicates', 'admin'),
new lang_string('coursecontactduplicates_desc', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('courselistshortnames',
new lang_string('courselistshortnames', 'admin'),
new lang_string('courselistshortnames_desc', 'admin'), 0));
$temp->add(new admin_setting_configtext('coursesperpage', new lang_string('coursesperpage', 'admin'), new lang_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
$temp->add(new admin_setting_configtext('courseswithsummarieslimit', new lang_string('courseswithsummarieslimit', 'admin'), new lang_string('configcourseswithsummarieslimit', 'admin'), 10, PARAM_INT));
$temp->add(new admin_setting_configtext('courseoverviewfileslimit', new lang_string('courseoverviewfileslimit'),
new lang_string('configcourseoverviewfileslimit', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_filetypes('courseoverviewfilesext', new lang_string('courseoverviewfilesext'),
new lang_string('configcourseoverviewfilesext', 'admin'), 'web_image'
));
$temp->add(new admin_setting_configtext('coursegraceperiodbefore', new lang_string('coursegraceperiodbefore', 'admin'),
new lang_string('configcoursegraceperiodbefore', 'admin'), 0, PARAM_INT));
$temp->add(new admin_setting_configtext('coursegraceperiodafter', new lang_string('coursegraceperiodafter', 'admin'),
new lang_string('configcoursegraceperiodafter', 'admin'), 0, PARAM_INT));
$ADMIN->add('appearance', $temp);
$temp = new admin_settingpage('ajax', new lang_string('ajaxuse'));
$temp->add(new admin_setting_configcheckbox('yuicomboloading', new lang_string('yuicomboloading', 'admin'), new lang_string('configyuicomboloading', 'admin'), 1));
$setting = new admin_setting_configcheckbox('cachejs', new lang_string('cachejs', 'admin'), new lang_string('cachejs_help', 'admin'), 1);
$setting->set_updatedcallback('js_reset_all_caches');
$temp->add($setting);
$ADMIN->add('appearance', $temp);
// Link to tag management interface.
$url = new moodle_url('/tag/manage.php');
$hidden = empty($CFG->usetags);
$page = new admin_externalpage('managetags', new lang_string('managetags', 'tag'), $url, 'moodle/tag:manage', $hidden);
$ADMIN->add('appearance', $page);
$temp = new admin_settingpage('additionalhtml', new lang_string('additionalhtml', 'admin'));
$temp->add(new admin_setting_heading('additionalhtml_heading', new lang_string('additionalhtml_heading', 'admin'), new lang_string('additionalhtml_desc', 'admin')));
$temp->add(new admin_setting_configtextarea('additionalhtmlhead', new lang_string('additionalhtmlhead', 'admin'), new lang_string('additionalhtmlhead_desc', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtextarea('additionalhtmltopofbody', new lang_string('additionalhtmltopofbody', 'admin'), new lang_string('additionalhtmltopofbody_desc', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtextarea('additionalhtmlfooter', new lang_string('additionalhtmlfooter', 'admin'), new lang_string('additionalhtmlfooter_desc', 'admin'), '', PARAM_RAW));
$ADMIN->add('appearance', $temp);
$setting = new admin_setting_configcheckbox('cachetemplates', new lang_string('cachetemplates', 'admin'),
new lang_string('cachetemplates_help', 'admin'), 1);
$setting->set_updatedcallback('template_reset_all_caches');
$temp = new admin_settingpage('templates', new lang_string('templates', 'admin'));
$temp->add($setting);
$ADMIN->add('appearance', $temp);
// Advanced theme settings page.
$temp = new admin_settingpage('themesettingsadvanced', new lang_string('themesettingsadvanced', 'admin'));
$setting = new admin_setting_configtext('themelist', new lang_string('themelist', 'admin'),
new lang_string('configthemelist', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$setting = new admin_setting_configcheckbox('themedesignermode', new lang_string('themedesignermode', 'admin'),
new lang_string('configthemedesignermode', 'admin'), 0);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
$setting = new admin_setting_configcheckbox('allowuserthemes', new lang_string('allowuserthemes', 'admin'),
new lang_string('configallowuserthemes', 'admin'), 0);
$setting->set_updatedcallback('theme_purge_used_in_context_caches');
$temp->add($setting);
$setting = new admin_setting_configcheckbox('allowcoursethemes', new lang_string('allowcoursethemes', 'admin'),
new lang_string('configallowcoursethemes', 'admin'), 0);
$setting->set_updatedcallback('theme_purge_used_in_context_caches');
$temp->add($setting);
$setting = new admin_setting_configcheckbox('allowcategorythemes', new lang_string('allowcategorythemes', 'admin'),
new lang_string('configallowcategorythemes', 'admin'), 0);
$setting->set_updatedcallback('theme_purge_used_in_context_caches');
$temp->add($setting);
$setting = new admin_setting_configcheckbox('allowcohortthemes', new lang_string('allowcohortthemes', 'admin'),
new lang_string('configallowcohortthemes', 'admin'), 0);
$setting->set_updatedcallback('theme_purge_used_in_context_caches');
$temp->add($setting);
$temp->add(new admin_setting_configcheckbox('allowthemechangeonurl', new lang_string('allowthemechangeonurl', 'admin'),
new lang_string('configallowthemechangeonurl', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'),
new lang_string('configallowuserblockhiding', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('langmenuinsecurelayout',
new lang_string('langmenuinsecurelayout', 'admin'),
new lang_string('langmenuinsecurelayout_desc', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('logininfoinsecurelayout',
new lang_string('logininfoinsecurelayout', 'admin'),
new lang_string('logininfoinsecurelayout_desc', 'admin'), 0));
$temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'),
new lang_string('configcustommenuitems', 'admin'), '', PARAM_RAW, '50', '10'));
$defaultsettingcustomusermenuitems = [
'profile,moodle|/user/profile.php',
'grades,grades|/grade/report/mygrades.php',
'calendar,core_calendar|/calendar/view.php?view=month',
'privatefiles,moodle|/user/files.php',
'reports,core_reportbuilder|/reportbuilder/index.php',
];
$temp->add(new admin_setting_configtextarea(
'customusermenuitems',
new lang_string('customusermenuitems', 'admin'),
new lang_string('configcustomusermenuitems', 'admin'),
implode("\n", $defaultsettingcustomusermenuitems),
PARAM_RAW,
'50',
'10'
));
$ADMIN->add('appearance', $temp);
// Theme selector page.
$ADMIN->add('appearance', new admin_externalpage('themeselector',
new lang_string('themeselector', 'admin'), $CFG->wwwroot . '/admin/themeselector.php'));
// Settings page for each theme.
$ADMIN->add('appearance', new admin_category('themes', new lang_string('themesettingscustom', 'admin')));
foreach (core_component::get_plugin_list('theme') as $theme => $themedir) {
$settingspath = "$themedir/settings.php";
if (file_exists($settingspath)) {
$settings = new admin_settingpage("themesetting$theme", new lang_string('pluginname', "theme_$theme"),
'moodle/site:config', true
);
include($settingspath);
// Add settings if not hidden (to avoid displaying the section if it appears empty in the UI).
if ($settings && !$settings->hidden) {
$ADMIN->add('themes', $settings);
}
}
}
} // end of speedup
+102
View File
@@ -0,0 +1,102 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file defines settingpages and externalpages under the "badges" section
*
* @package core
* @subpackage badges
* @copyright 2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Yuliya Bozhko <yuliya.bozhko@totaralms.com>
*/
global $SITE;
if (($hassiteconfig || has_any_capability(array(
'moodle/badges:viewawarded',
'moodle/badges:createbadge',
'moodle/badges:manageglobalsettings',
'moodle/badges:awardbadge',
'moodle/badges:configurecriteria',
'moodle/badges:configuremessages',
'moodle/badges:configuredetails',
'moodle/badges:deletebadge'), $systemcontext))) {
require_once($CFG->libdir . '/badgeslib.php');
$globalsettings = new admin_settingpage('badgesettings', new lang_string('badgesettings', 'badges'),
array('moodle/badges:manageglobalsettings'), empty($CFG->enablebadges));
$globalsettings->add(new admin_setting_configtext('badges_defaultissuername',
new lang_string('defaultissuername', 'badges'),
new lang_string('defaultissuername_desc', 'badges'),
$SITE->fullname ? $SITE->fullname : $SITE->shortname, PARAM_TEXT));
$globalsettings->add(new admin_setting_configtext('badges_defaultissuercontact',
new lang_string('defaultissuercontact', 'badges'),
new lang_string('defaultissuercontact_desc', 'badges'),
get_config('moodle','supportemail'), PARAM_EMAIL));
$globalsettings->add(new admin_setting_configtext('badges_badgesalt',
new lang_string('badgesalt', 'badges'),
new lang_string('badgesalt_desc', 'badges'),
'badges' . $SITE->timecreated, PARAM_ALPHANUM));
$globalsettings->add(new admin_setting_configcheckbox('badges_allowcoursebadges',
new lang_string('allowcoursebadges', 'badges'),
new lang_string('allowcoursebadges_desc', 'badges'), 1));
$globalsettings->add(new admin_setting_configcheckbox('badges_allowexternalbackpack',
new lang_string('allowexternalbackpack', 'badges'),
new lang_string('allowexternalbackpack_desc', 'badges'), 1));
$ADMIN->add('badges', $globalsettings);
$ADMIN->add('badges',
new admin_externalpage('managebadges',
new lang_string('managebadges', 'badges'),
new moodle_url('/badges/index.php', array('type' => BADGE_TYPE_SITE)),
array(
'moodle/badges:viewawarded',
'moodle/badges:createbadge',
'moodle/badges:awardbadge',
'moodle/badges:configurecriteria',
'moodle/badges:configuremessages',
'moodle/badges:configuredetails',
'moodle/badges:deletebadge'
),
empty($CFG->enablebadges)
)
);
$ADMIN->add('badges',
new admin_externalpage('newbadge',
new lang_string('newbadge', 'badges'),
new moodle_url('/badges/newbadge.php', array('type' => BADGE_TYPE_SITE)),
array('moodle/badges:createbadge'), empty($CFG->enablebadges)
)
);
$ADMIN->add('badges',
new admin_externalpage('managebackpacks',
new lang_string('managebackpacks', 'badges'),
new moodle_url('/badges/backpacks.php'),
array('moodle/badges:manageglobalsettings'), empty($CFG->enablebadges) || empty($CFG->badges_allowexternalbackpack)
)
);
}
+48
View File
@@ -0,0 +1,48 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* File.
*
* @package core_competency
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
// Save processing when the user will not be able to access anything.
if (has_capability('moodle/site:config', $systemcontext)) {
$parentname = 'competencies';
// Settings page.
$iscompetencyenabled = get_config('core_competency', 'enabled');
$settings = new admin_settingpage('competencysettings', new lang_string('competenciessettings', 'core_competency'),
'moodle/site:config', !$iscompetencyenabled);
if ($iscompetencyenabled) {
$ADMIN->add($parentname, $settings);
}
// Load the full tree of settings.
if ($ADMIN->fulltree) {
$setting = new admin_setting_configcheckbox('core_competency/pushcourseratingstouserplans',
new lang_string('pushcourseratingstouserplans', 'core_competency'),
new lang_string('pushcourseratingstouserplans_desc', 'core_competency'), 1);
$settings->add($setting);
}
}
+754
View File
@@ -0,0 +1,754 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file defines settingpages and externalpages under the "courses" category
*
* @package core
* @copyright 2002 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/pdflib.php');
use core_admin\local\settings\filesize;
$capabilities = array(
'moodle/backup:backupcourse',
'moodle/category:manage',
'moodle/course:create',
'moodle/site:approvecourse',
'moodle/restore:restorecourse'
);
if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
// Speedup for non-admins, add all caps used on this page.
$ADMIN->add('courses',
new admin_externalpage('coursemgmt', new lang_string('coursemgmt', 'admin'),
$CFG->wwwroot . '/course/management.php',
array('moodle/category:manage', 'moodle/course:create')
)
);
$ADMIN->add('courses',
new admin_externalpage('addcategory', new lang_string('addcategory', 'admin'),
new moodle_url('/course/editcategory.php', array('parent' => 0)),
array('moodle/category:manage')
)
);
$ADMIN->add('courses',
new admin_externalpage('addnewcourse', new lang_string('addnewcourse'),
new moodle_url('/course/edit.php', array('category' => 0)),
array('moodle/category:manage')
)
);
$ADMIN->add('courses',
new admin_externalpage('restorecourse', new lang_string('restorecourse', 'admin'),
new moodle_url('/backup/restorefile.php', array('contextid' => context_system::instance()->id)),
array('moodle/restore:restorecourse')
)
);
// Download course content.
$downloadcoursedefaulturl = new moodle_url('/admin/settings.php', ['section' => 'coursesettings']);
$temp = new admin_settingpage('downloadcoursecontent', new lang_string('downloadcoursecontent', 'course'));
$temp->add(new admin_setting_configcheckbox('downloadcoursecontentallowed',
new lang_string('downloadcoursecontentallowed', 'admin'),
new lang_string('downloadcoursecontentallowed_desc', 'admin', $downloadcoursedefaulturl->out()), 0));
// 50MB default maximum size per file when downloading course content.
$defaultmaxdownloadsize = 50 * filesize::UNIT_MB;
$temp->add(new filesize('maxsizeperdownloadcoursefile', new lang_string('maxsizeperdownloadcoursefile', 'admin'),
new lang_string('maxsizeperdownloadcoursefile_desc', 'admin'), $defaultmaxdownloadsize, filesize::UNIT_MB));
$temp->hide_if('maxsizeperdownloadcoursefile', 'downloadcoursecontentallowed');
$ADMIN->add('courses', $temp);
// "courserequests" settingpage.
$temp = new admin_settingpage('courserequest', new lang_string('courserequest'));
$temp->add(new admin_setting_configcheckbox('enablecourserequests',
new lang_string('enablecourserequests', 'admin'),
new lang_string('configenablecourserequests', 'admin'), 1));
$temp->add(new admin_settings_coursecat_select('defaultrequestcategory',
new lang_string('defaultrequestcategory', 'admin'),
new lang_string('configdefaultrequestcategory', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('lockrequestcategory',
new lang_string('lockrequestcategory', 'admin'),
new lang_string('configlockrequestcategory', 'admin'), 0));
$temp->add(new admin_setting_users_with_capability(
'courserequestnotify',
new lang_string('courserequestnotify', 'admin'),
new lang_string('configcourserequestnotify2', 'admin'),
[],
'moodle/site:approvecourse'
));
$ADMIN->add('courses', $temp);
// Pending course requests.
if (!empty($CFG->enablecourserequests)) {
$ADMIN->add('courses', new admin_externalpage('coursespending', new lang_string('pendingrequests'),
$CFG->wwwroot . '/course/pending.php', array('moodle/site:approvecourse')));
}
// Add a category for the course Default settings.
$ADMIN->add('courses', new admin_category('coursedefaultsettings', new lang_string('defaultsettingscategory', 'course')));
// Course Default Settings Page.
// NOTE: these settings must be applied after all other settings because they depend on them.
// Main course settings.
$temp = new admin_settingpage('coursesettings', new lang_string('coursesettings'));
require_once($CFG->dirroot.'/course/lib.php');
$choices = array();
$choices['0'] = new lang_string('hide');
$choices['1'] = new lang_string('show');
$temp->add(new admin_setting_configselect('moodlecourse/visible', new lang_string('visible'), new lang_string('visible_help'),
1, $choices));
// Enable/disable download course content.
$choices = [
DOWNLOAD_COURSE_CONTENT_DISABLED => new lang_string('no'),
DOWNLOAD_COURSE_CONTENT_ENABLED => new lang_string('yes'),
];
$downloadcontentsitedefault = new admin_setting_configselect('moodlecourse/downloadcontentsitedefault',
new lang_string('enabledownloadcoursecontent', 'course'),
new lang_string('downloadcoursecontent_help', 'course'), 0, $choices);
$downloadcontentsitedefault->add_dependent_on('downloadcoursecontentallowed');
$temp->add($downloadcontentsitedefault);
$temp->add(
new admin_setting_configtext(
'moodlecourse/participantsperpage',
new lang_string('participants:perpage', 'course'),
new lang_string('participants:perpage_help', 'course'),
20
)
);
// Course format.
$temp->add(new admin_setting_heading('courseformathdr', new lang_string('type_format', 'plugin'), ''));
$courseformats = get_sorted_course_formats(true);
$formcourseformats = array();
foreach ($courseformats as $courseformat) {
$formcourseformats[$courseformat] = new lang_string('pluginname', "format_$courseformat");
}
$temp->add(new admin_setting_configselect('moodlecourse/format', new lang_string('format'), new lang_string('coursehelpformat'),
'topics', $formcourseformats));
$temp->add(new admin_setting_configtext('moodlecourse/maxsections', new lang_string('maxnumberweeks'),
new lang_string('maxnumberweeks_desc'), 52));
$temp->add(new admin_settings_num_course_sections('moodlecourse/numsections', new lang_string('numberweeks'),
new lang_string('coursehelpnumberweeks'), 4));
$choices = array();
$choices['0'] = new lang_string('hiddensectionscollapsed');
$choices['1'] = new lang_string('hiddensectionsinvisible');
$temp->add(new admin_setting_configselect('moodlecourse/hiddensections', new lang_string('hiddensections'),
new lang_string('coursehelphiddensections'), 1, $choices));
$choices = array();
$choices[COURSE_DISPLAY_SINGLEPAGE] = new lang_string('coursedisplay_single');
$choices[COURSE_DISPLAY_MULTIPAGE] = new lang_string('coursedisplay_multi');
$temp->add(new admin_setting_configselect('moodlecourse/coursedisplay', new lang_string('coursedisplay'),
new lang_string('coursedisplay_help'), COURSE_DISPLAY_SINGLEPAGE, $choices));
$temp->add(new admin_setting_configcheckbox('moodlecourse/courseenddateenabled', get_string('courseenddateenabled'),
get_string('courseenddateenabled_desc'), 1));
$temp->add(new admin_setting_configduration('moodlecourse/courseduration', get_string('courseduration'),
get_string('courseduration_desc'), YEARSECS));
// Appearance.
$temp->add(new admin_setting_heading('appearancehdr', new lang_string('appearance'), ''));
$languages = array();
$languages[''] = new lang_string('forceno');
$languages += get_string_manager()->get_list_of_translations();
$temp->add(new admin_setting_configselect('moodlecourse/lang', new lang_string('forcelanguage'), '', key($languages),
$languages));
$options = range(0, 10);
$temp->add(new admin_setting_configselect('moodlecourse/newsitems', new lang_string('newsitemsnumber'),
new lang_string('coursehelpnewsitemsnumber'), 5, $options));
$temp->add(new admin_setting_configselect('moodlecourse/showgrades', new lang_string('showgrades'),
new lang_string('coursehelpshowgrades'), 1, array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/showreports', new lang_string('showreports'), '', 0,
array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/showactivitydates',
new lang_string('showactivitydates'),
new lang_string('showactivitydates_help'), 1, [
0 => new lang_string('no'),
1 => new lang_string('yes')
]
));
// Files and uploads.
$temp->add(new admin_setting_heading('filesanduploadshdr', new lang_string('filesanduploads'), ''));
if (!empty($CFG->legacyfilesinnewcourses)) {
$choices = array('0'=>new lang_string('no'), '2'=>new lang_string('yes'));
$temp->add(new admin_setting_configselect('moodlecourse/legacyfiles', new lang_string('courselegacyfiles'),
new lang_string('courselegacyfiles_help'), key($choices), $choices));
}
$currentmaxbytes = get_config('moodlecourse', 'maxbytes');
if (isset($CFG->maxbytes)) {
$choices = get_max_upload_sizes($CFG->maxbytes, 0, 0, $currentmaxbytes);
} else {
$choices = get_max_upload_sizes(0, 0, 0, $currentmaxbytes);
}
$temp->add(new admin_setting_configselect('moodlecourse/maxbytes', new lang_string('maximumupload'),
new lang_string('coursehelpmaximumupload'), key($choices), $choices));
if (!empty($CFG->enablepdfexportfont)) {
$pdf = new \pdf;
$fontlist = $pdf->get_export_fontlist();
// Show the option if the font is defined more than one.
if (count($fontlist) > 1) {
$temp->add(new admin_setting_configselect('moodlecourse/pdfexportfont',
new lang_string('pdfexportfont', 'course'),
new lang_string('pdfexportfont_help', 'course'),
'freesans', $fontlist
));
}
}
// Completion tracking.
$temp->add(new admin_setting_heading('progress', new lang_string('completion','completion'), ''));
$temp->add(new admin_setting_configselect('moodlecourse/enablecompletion', new lang_string('completion', 'completion'),
new lang_string('enablecompletion_help', 'completion'), 1, array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
// Display completion conditions.
$temp->add(new admin_setting_configselect('moodlecourse/showcompletionconditions',
new lang_string('showcompletionconditions', 'completion'),
new lang_string('showcompletionconditions_help', 'completion'), 1, [
0 => new lang_string('no'),
1 => new lang_string('yes')
]
));
// Groups.
$temp->add(new admin_setting_heading('groups', new lang_string('groups', 'group'), ''));
$choices = array();
$choices[NOGROUPS] = new lang_string('groupsnone', 'group');
$choices[SEPARATEGROUPS] = new lang_string('groupsseparate', 'group');
$choices[VISIBLEGROUPS] = new lang_string('groupsvisible', 'group');
$temp->add(new admin_setting_configselect('moodlecourse/groupmode', new lang_string('groupmode'), '', key($choices),$choices));
$temp->add(new admin_setting_configselect('moodlecourse/groupmodeforce', new lang_string('force'), new lang_string('coursehelpforce'), 0,array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
// Communication.
$temp->add(new admin_setting_heading('communication',
new lang_string('communication', 'core_communication'), ''));
list($communicationproviders, $defaulprovider) = \core_communication\api::
get_enabled_providers_and_default();
$temp->add(new admin_setting_configselect('moodlecourse/coursecommunicationprovider',
new lang_string('selectcommunicationprovider', 'communication'),
new lang_string('coursecommunication_desc', 'course'),
$defaulprovider, $communicationproviders));
$ADMIN->add('coursedefaultsettings', $temp);
if (!empty($CFG->enablecompletion)) {
$ADMIN->add('coursedefaultsettings', new admin_externalpage(
'sitedefaultcompletion',
new lang_string('defaultcompletion', 'completion'),
new moodle_url('/course/defaultcompletion.php', ['id' => $SITE->id]),
['moodle/course:manageactivities'])
);
}
$ADMIN->add('coursedefaultsettings', new admin_externalpage(
'course_customfield',
new lang_string('course_customfield', 'admin'),
$CFG->wwwroot . '/course/customfield.php',
['moodle/course:configurecustomfields'])
);
$temp = new admin_settingpage('activitychoosersettings', new lang_string('activitychoosersettings', 'course'));
// Tab mode for the activity chooser.
$temp->add(
new admin_setting_configselect(
'activitychoosertabmode',
new lang_string('activitychoosertabmode', 'course'),
new lang_string('activitychoosertabmode_desc', 'course'),
3,
[
3 => new lang_string('activitychoosertabmodefour', 'course'),
4 => new lang_string('activitychoosertabmodefive', 'course'),
5 => new lang_string('activitychoosertabmodesix', 'course'),
0 => new lang_string('activitychoosertabmodeone', 'course'),
1 => new lang_string('activitychoosertabmodetwo', 'course'),
2 => new lang_string('activitychoosertabmodethree', 'course'),
]
)
);
// Add a category for the Groups.
$ADMIN->add('courses', new admin_category('groups', new lang_string('groups')));
$ADMIN->add(
'groups',
new admin_externalpage(
'group_customfield',
new lang_string('group_customfield', 'admin'),
$CFG->wwwroot . '/group/customfield.php',
['moodle/group:configurecustomfields']
)
);
$ADMIN->add(
'groups',
new admin_externalpage(
'grouping_customfield',
new lang_string('grouping_customfield', 'admin'),
$CFG->wwwroot . '/group/grouping_customfield.php',
['moodle/group:configurecustomfields']
)
);
// Add a category for the Activity Chooser.
$ADMIN->add('courses', new admin_category('activitychooser', new lang_string('activitychoosercategory', 'course')));
$temp = new admin_settingpage('activitychoosersettings', new lang_string('activitychoosersettings', 'course'));
// Tab mode for the activity chooser.
$temp->add(
new admin_setting_configselect(
'activitychoosertabmode',
new lang_string('activitychoosertabmode', 'course'),
new lang_string('activitychoosertabmode_desc', 'course'),
3,
[
3 => new lang_string('activitychoosertabmodefour', 'course'),
4 => new lang_string('activitychoosertabmodefive', 'course'),
5 => new lang_string('activitychoosertabmodesix', 'course'),
0 => new lang_string('activitychoosertabmodeone', 'course'),
1 => new lang_string('activitychoosertabmodetwo', 'course'),
2 => new lang_string('activitychoosertabmodethree', 'course'),
]
)
);
// Build a list of plugins that use the footer callback.
$pluginswithfunction = get_plugins_with_function('custom_chooser_footer', 'lib.php');
$pluginsoptions = [];
$pluginsoptions[COURSE_CHOOSER_FOOTER_NONE] = get_string('activitychooserhidefooter', 'course');
if ($pluginswithfunction) {
foreach ($pluginswithfunction as $plugintype => $plugins) {
foreach ($plugins as $pluginname => $pluginfunction) {
$plugin = $plugintype.'_'.$pluginname;
$pluginsoptions[$plugin] = get_string('pluginname', $plugin);
}
}
}
// Select what plugin to show in the footer.
$temp->add(
new admin_setting_configselect(
'activitychooseractivefooter',
new lang_string('activitychooseractivefooter', 'course'),
new lang_string('activitychooseractivefooter_desc', 'course'),
COURSE_CHOOSER_FOOTER_NONE,
$pluginsoptions
)
);
$ADMIN->add('activitychooser', $temp);
$ADMIN->add('activitychooser',
new admin_externalpage('activitychooserrecommended', new lang_string('activitychooserrecommendations', 'course'),
new moodle_url('/course/recommendations.php'),
array('moodle/course:recommendactivity')
)
);
// Add a category for backups.
$ADMIN->add('courses', new admin_category('backups', new lang_string('backups','admin')));
// Create a page for general backups configuration and defaults.
$temp = new admin_settingpage('backupgeneralsettings', new lang_string('generalbackdefaults', 'backup'), 'moodle/backup:backupcourse');
// General configuration section.
$temp->add(new admin_setting_configselect('backup/loglifetime', new lang_string('loglifetime', 'backup'), new lang_string('configloglifetime', 'backup'), 30, array(
1 => new lang_string('numdays', '', 1),
2 => new lang_string('numdays', '', 2),
3 => new lang_string('numdays', '', 3),
5 => new lang_string('numdays', '', 5),
7 => new lang_string('numdays', '', 7),
10 => new lang_string('numdays', '', 10),
14 => new lang_string('numdays', '', 14),
20 => new lang_string('numdays', '', 20),
30 => new lang_string('numdays', '', 30),
60 => new lang_string('numdays', '', 60),
90 => new lang_string('numdays', '', 90),
120 => new lang_string('numdays', '', 120),
180 => new lang_string('numdays', '', 180),
365 => new lang_string('numdays', '', 365)
)));
// General defaults section.
$temp->add(new admin_setting_heading('generalsettings', new lang_string('generalsettings', 'backup'), ''));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_users', new lang_string('generalusers','backup'), new lang_string('configgeneralusers','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_anonymize', new lang_string('generalanonymize','backup'), new lang_string('configgeneralanonymize','backup'), array('value'=>0, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock(
'backup/backup_general_files',
new lang_string('generalfiles', 'backup'),
new lang_string('configgeneralfiles', 'backup'),
array('value' => '1', 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_comments', new lang_string('generalcomments','backup'), new lang_string('configgeneralcomments','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_badges', new lang_string('generalbadges','backup'), new lang_string('configgeneralbadges','backup'), array('value'=>1,'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_calendarevents', new lang_string('generalcalendarevents','backup'), new lang_string('configgeneralcalendarevents','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_userscompletion', new lang_string('generaluserscompletion','backup'), new lang_string('configgeneraluserscompletion','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_logs', new lang_string('generallogs','backup'), new lang_string('configgenerallogs','backup'), array('value'=>0, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_histories', new lang_string('generalhistories','backup'), new lang_string('configgeneralhistories','backup'), array('value'=>0, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_questionbank', new lang_string('generalquestionbank','backup'), new lang_string('configgeneralquestionbank','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_groups',
new lang_string('generalgroups', 'backup'), new lang_string('configgeneralgroups', 'backup'),
array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_competencies', new lang_string('generalcompetencies','backup'), new lang_string('configgeneralcompetencies','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_contentbankcontent',
new lang_string('generalcontentbankcontent', 'backup'),
new lang_string('configgeneralcontentbankcontent', 'backup'),
['value' => 1, 'locked' => 0])
);
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_xapistate',
new lang_string('generalxapistate', 'backup'),
new lang_string('configgeneralxapistate', 'backup'),
['value' => 1, 'locked' => 0])
);
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), array('value' => 1, 'locked' => 0)));
$ADMIN->add('backups', $temp);
// Create a page for general import configuration and defaults.
$temp = new admin_settingpage('importgeneralsettings', new lang_string('importgeneralsettings', 'backup'), 'moodle/backup:backupcourse');
$temp->add(new admin_setting_configtext('backup/import_general_maxresults', new lang_string('importgeneralmaxresults', 'backup'), new lang_string('importgeneralmaxresults_desc', 'backup'), 10));
$temp->add(new admin_setting_configcheckbox('backup/import_general_duplicate_admin_allowed',
new lang_string('importgeneralduplicateadminallowed', 'backup'),
new lang_string('importgeneralduplicateadminallowed_desc', 'backup'), 0));
// Import defaults section.
$temp->add(new admin_setting_heading('importsettings', new lang_string('importsettings', 'backup'), ''));
$temp->add(new admin_setting_configcheckbox_with_lock(
'backup/backup_import_permissions',
new lang_string('generalpermissions', 'backup'),
new lang_string('configgeneralpermissions', 'backup'),
array('value' => 0, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_calendarevents', new lang_string('generalcalendarevents','backup'), new lang_string('configgeneralcalendarevents','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_questionbank', new lang_string('generalquestionbank','backup'), new lang_string('configgeneralquestionbank','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_groups',
new lang_string('generalgroups', 'backup'), new lang_string('configgeneralgroups', 'backup'),
array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_competencies', new lang_string('generalcompetencies','backup'), new lang_string('configgeneralcompetencies','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock(
'backup/backup_import_contentbankcontent',
new lang_string('generalcontentbankcontent', 'backup'),
new lang_string('configgeneralcontentbankcontent', 'backup'),
['value' => 1, 'locked' => 0])
);
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), array('value' => 1, 'locked' => 0)));
$ADMIN->add('backups', $temp);
// Create a page for automated backups configuration and defaults.
$temp = new admin_settingpage('automated', new lang_string('automatedsetup','backup'), 'moodle/backup:backupcourse');
// Automated configuration section.
$temp->add(new admin_setting_configselect('backup/backup_auto_active', new lang_string('active'), new lang_string('autoactivedescription', 'backup'), 0, array(
0 => new lang_string('autoactivedisabled', 'backup'),
1 => new lang_string('autoactiveenabled', 'backup'),
2 => new lang_string('autoactivemanual', 'backup')
)));
$temp->add(new admin_setting_special_backupdays());
$temp->add(new admin_setting_configtime('backup/backup_auto_hour', 'backup_auto_minute', new lang_string('executeat'),
new lang_string('backupexecuteathelp'), array('h' => 0, 'm' => 0)));
$storageoptions = array(
0 => new lang_string('storagecourseonly', 'backup'),
1 => new lang_string('storageexternalonly', 'backup'),
2 => new lang_string('storagecourseandexternal', 'backup')
);
$temp->add(new admin_setting_configselect('backup/backup_auto_storage', new lang_string('automatedstorage', 'backup'), new lang_string('automatedstoragehelp', 'backup'), 0, $storageoptions));
$temp->add(new admin_setting_special_backup_auto_destination());
$maxkeptoptions = array(
0 => new lang_string('all'), 1 => '1',
2 => '2',
3 => '3',
4 => '4',
5 => '5',
10 => '10',
20 => '20',
30 => '30',
40 => '40',
50 => '50',
100 => '100',
200 => '200',
300 => '300',
400 => '400',
500 => '500');
$temp->add(new admin_setting_configselect('backup/backup_auto_max_kept', new lang_string('automatedmaxkept', 'backup'),
new lang_string('automatedmaxkepthelp', 'backup'), 1, $maxkeptoptions));
$automateddeletedaysoptions = array(
0 => new lang_string('never'),
1000 => new lang_string('numdays', '', 1000),
365 => new lang_string('numdays', '', 365),
180 => new lang_string('numdays', '', 180),
150 => new lang_string('numdays', '', 150),
120 => new lang_string('numdays', '', 120),
90 => new lang_string('numdays', '', 90),
60 => new lang_string('numdays', '', 60),
35 => new lang_string('numdays', '', 35),
10 => new lang_string('numdays', '', 10),
5 => new lang_string('numdays', '', 5),
2 => new lang_string('numdays', '', 2)
);
$temp->add(new admin_setting_configselect('backup/backup_auto_delete_days', new lang_string('automateddeletedays', 'backup'),
'', 0, $automateddeletedaysoptions));
$minkeptoptions = array(
0 => new lang_string('none'),
1 => '1',
2 => '2',
5 => '5',
10 => '10',
20 => '20',
30 => '30',
40 => '40',
50 => '50',
100 => '100',
200 => '200',
300 => '300',
400 => '400'
);
$temp->add(new admin_setting_configselect('backup/backup_auto_min_kept', new lang_string('automatedminkept', 'backup'),
new lang_string('automatedminkepthelp', 'backup'), 0, $minkeptoptions));
$temp->add(new admin_setting_configcheckbox('backup/backup_shortname', new lang_string('backup_shortname', 'admin'), new lang_string('backup_shortnamehelp', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_skip_hidden', new lang_string('skiphidden', 'backup'), new lang_string('skiphiddenhelp', 'backup'), 1));
$temp->add(new admin_setting_configselect('backup/backup_auto_skip_modif_days', new lang_string('skipmodifdays', 'backup'), new lang_string('skipmodifdayshelp', 'backup'), 30, array(
0 => new lang_string('never'),
1 => new lang_string('numdays', '', 1),
2 => new lang_string('numdays', '', 2),
3 => new lang_string('numdays', '', 3),
5 => new lang_string('numdays', '', 5),
7 => new lang_string('numdays', '', 7),
10 => new lang_string('numdays', '', 10),
14 => new lang_string('numdays', '', 14),
20 => new lang_string('numdays', '', 20),
30 => new lang_string('numdays', '', 30),
60 => new lang_string('numdays', '', 60),
90 => new lang_string('numdays', '', 90),
120 => new lang_string('numdays', '', 120),
180 => new lang_string('numdays', '', 180),
365 => new lang_string('numdays', '', 365)
)));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_skip_modif_prev', new lang_string('skipmodifprev', 'backup'), new lang_string('skipmodifprevhelp', 'backup'), 0));
// Automated defaults section.
$temp->add(new admin_setting_heading('automatedsettings', new lang_string('automatedsettings','backup'), new lang_string('recyclebin_desc', 'backup')));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_users', new lang_string('generalusers', 'backup'), new lang_string('configgeneralusers', 'backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_activities', new lang_string('generalactivities', 'backup'),
new lang_string('backupautoactivitiesdescription', 'backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), 1));
$temp->add(new admin_setting_configcheckbox(
'backup/backup_auto_files',
new lang_string('generalfiles', 'backup'),
new lang_string('configgeneralfiles', 'backup'), '1'));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_comments', new lang_string('generalcomments','backup'), new lang_string('configgeneralcomments','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_badges', new lang_string('generalbadges','backup'), new lang_string('configgeneralbadges','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_calendarevents', new lang_string('generalcalendarevents','backup'), new lang_string('configgeneralcalendarevents','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_userscompletion', new lang_string('generaluserscompletion','backup'), new lang_string('configgeneraluserscompletion','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_logs', new lang_string('generallogs', 'backup'), new lang_string('configgenerallogs', 'backup'), 0));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_histories', new lang_string('generalhistories','backup'), new lang_string('configgeneralhistories','backup'), 0));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_questionbank', new lang_string('generalquestionbank','backup'), new lang_string('configgeneralquestionbank','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_groups', new lang_string('generalgroups', 'backup'),
new lang_string('configgeneralgroups', 'backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_competencies', new lang_string('generalcompetencies','backup'), new lang_string('configgeneralcompetencies','backup'), 1));
$temp->add(new admin_setting_configcheckbox(
'backup/backup_auto_contentbankcontent',
new lang_string('generalcontentbankcontent', 'backup'),
new lang_string('configgeneralcontentbankcontent', 'backup'),
1)
);
$temp->add(new admin_setting_configcheckbox(
'backup/backup_auto_xapistate',
new lang_string('generalxapistate', 'backup'),
new lang_string('configgeneralxapistate', 'backup'),
1)
);
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), 1));
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_messages', new lang_string('messages', 'message'), new lang_string('backupmessageshelp','message'), 0));
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blogs', new lang_string('blogs', 'blog'), new lang_string('backupblogshelp','blog'), 0));
$ADMIN->add('backups', $temp);
// Create a page for general restore configuration and defaults.
$temp = new admin_settingpage('restoregeneralsettings', new lang_string('generalrestoredefaults', 'backup'));
// General restore defaults.
$temp->add(new admin_setting_heading('generalsettings', new lang_string('generalrestoresettings', 'backup'), ''));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_users',
new lang_string('generalusers', 'backup'), new lang_string('configrestoreusers', 'backup'),
array('value' => 1, 'locked' => 0)));
// Can not use actual constants here because we'd need to include 100 of backup/restore files.
$options = [
0/*backup::ENROL_NEVER*/ => get_string('rootsettingenrolments_never', 'backup'),
1/*backup::ENROL_WITHUSERS*/ => get_string('rootsettingenrolments_withusers', 'backup'),
2/*backup::ENROL_ALWAYS*/ => get_string('rootsettingenrolments_always', 'backup'),
];
$temp->add(new admin_setting_configselect_with_lock('restore/restore_general_enrolments',
new lang_string('generalenrolments', 'backup'), new lang_string('configrestoreenrolments', 'backup'),
array('value' => 1/*backup::ENROL_WITHUSERS*/, 'locked' => 0), $options));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_role_assignments',
new lang_string('generalroleassignments', 'backup'),
new lang_string('configrestoreroleassignments', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_permissions',
new lang_string('generalpermissions', 'backup'),
new lang_string('configrestorepermissions', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_activities',
new lang_string('generalactivities', 'backup'),
new lang_string('configrestoreactivities', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_blocks',
new lang_string('generalblocks', 'backup'),
new lang_string('configrestoreblocks', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_filters',
new lang_string('generalfilters', 'backup'),
new lang_string('configrestorefilters', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_comments',
new lang_string('generalcomments', 'backup'),
new lang_string('configrestorecomments', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_badges',
new lang_string('generalbadges', 'backup'),
new lang_string('configrestorebadges', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_calendarevents',
new lang_string('generalcalendarevents', 'backup'),
new lang_string('configrestorecalendarevents', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_userscompletion',
new lang_string('generaluserscompletion', 'backup'),
new lang_string('configrestoreuserscompletion', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_logs',
new lang_string('generallogs', 'backup'),
new lang_string('configrestorelogs', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_histories',
new lang_string('generalhistories', 'backup'),
new lang_string('configrestorehistories', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_groups',
new lang_string('generalgroups', 'backup'), new lang_string('configrestoregroups', 'backup'),
array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_competencies',
new lang_string('generalcompetencies', 'backup'),
new lang_string('configrestorecompetencies', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_contentbankcontent',
new lang_string('generalcontentbankcontent', 'backup'),
new lang_string('configrestorecontentbankcontent', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_xapistate',
new lang_string('generalxapistate', 'backup'),
new lang_string('configrestorexapistate', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), array('value' => 1, 'locked' => 0)));
// Restore defaults when merging into another course.
$temp->add(new admin_setting_heading('mergerestoredefaults', new lang_string('mergerestoredefaults', 'backup'), ''));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_merge_overwrite_conf',
new lang_string('setting_overwrite_conf', 'backup'),
new lang_string('config_overwrite_conf', 'backup'), array('value' => 0, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_merge_course_fullname',
new lang_string('setting_overwrite_course_fullname', 'backup'),
new lang_string('config_overwrite_course_fullname', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_merge_course_shortname',
new lang_string('setting_overwrite_course_shortname', 'backup'),
new lang_string('config_overwrite_course_shortname', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_merge_course_startdate',
new lang_string('setting_overwrite_course_startdate', 'backup'),
new lang_string('config_overwrite_course_startdate', 'backup'), array('value' => 1, 'locked' => 0)));
// Restore defaults when replacing course contents.
$temp->add(new admin_setting_heading('replacerestoredefaults', new lang_string('replacerestoredefaults', 'backup'), ''));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_replace_overwrite_conf',
new lang_string('setting_overwrite_conf', 'backup'),
new lang_string('config_overwrite_conf', 'backup'), array('value' => 0, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_replace_course_fullname',
new lang_string('setting_overwrite_course_fullname', 'backup'),
new lang_string('config_overwrite_course_fullname', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_replace_course_shortname',
new lang_string('setting_overwrite_course_shortname', 'backup'),
new lang_string('config_overwrite_course_shortname', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_replace_course_startdate',
new lang_string('setting_overwrite_course_startdate', 'backup'),
new lang_string('config_overwrite_course_startdate', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configselect_with_lock('restore/restore_replace_keep_roles_and_enrolments',
new lang_string('setting_keep_roles_and_enrolments', 'backup'),
new lang_string('config_keep_roles_and_enrolments', 'backup'), array('value' => 0, 'locked' => 0),
array(1 => get_string('yes'), 0 => get_string('no'))));
$temp->add(new admin_setting_configselect_with_lock('restore/restore_replace_keep_groups_and_groupings',
new lang_string('setting_keep_groups_and_groupings', 'backup'),
new lang_string('config_keep_groups_and_groupings', 'backup'), array('value' => 0, 'locked' => 0),
array(1 => get_string('yes'), 0 => get_string('no'))));
$ADMIN->add('backups', $temp);
// Create a page for asynchronous backup and restore configuration and defaults.
$temp = new admin_settingpage('asyncgeneralsettings', new lang_string('asyncgeneralsettings', 'backup'));
$temp->add(new admin_setting_configcheckbox('enableasyncbackup', new lang_string('enableasyncbackup', 'backup'),
new lang_string('enableasyncbackup_help', 'backup'), 1, 1, 0));
$temp->add(new admin_setting_configcheckbox(
'backup/backup_async_message_users',
new lang_string('asyncemailenable', 'backup'),
new lang_string('asyncemailenabledetail', 'backup'), 1));
$temp->hide_if('backup/backup_async_message_users', 'enableasyncbackup');
$temp->add(new admin_setting_configtext(
'backup/backup_async_message_subject',
new lang_string('asyncmessagesubject', 'backup'),
new lang_string('asyncmessagesubjectdetail', 'backup'),
new lang_string('asyncmessagesubjectdefault', 'backup')));
$temp->hide_if('backup/backup_async_message_subject', 'backup/backup_async_message_users');
$temp->add(new admin_setting_confightmleditor(
'backup/backup_async_message',
new lang_string('asyncmessagebody', 'backup'),
new lang_string('asyncmessagebodydetail', 'backup'),
new lang_string('asyncmessagebodydefault', 'backup')));
$temp->hide_if('backup/backup_async_message', 'backup/backup_async_message_users');
$ADMIN->add('backups', $temp);
}
+127
View File
@@ -0,0 +1,127 @@
<?php
// * Miscellaneous settings
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
// Experimental settings page
$ADMIN->add('development', new admin_category('experimental', new lang_string('experimental','admin')));
$temp = new admin_settingpage('experimentalsettings', new lang_string('experimentalsettings', 'admin'));
//TODO: Re-enable cc-import once re-implemented in 2.0.x
//$temp->add(new admin_setting_configcheckbox('enableimsccimport', new lang_string('enable_cc_import', 'imscc'), new lang_string('enable_cc_import_description', 'imscc'), 0));
$temp->add(new admin_setting_configcheckbox('dndallowtextandlinks', new lang_string('dndallowtextandlinks', 'admin'), new lang_string('configdndallowtextandlinks', 'admin'), 0));
$temp->add(new admin_setting_configexecutable('pathtosassc', new lang_string('pathtosassc', 'admin'), new lang_string('pathtosassc_help', 'admin'), ''));
$temp->add(new admin_setting_configcheckbox('contextlocking', new lang_string('contextlocking', 'core_admin'),
new lang_string('contextlocking_desc', 'core_admin'), 0));
$temp->add(new admin_setting_configcheckbox(
'contextlockappliestoadmin',
new lang_string('contextlockappliestoadmin', 'core_admin'),
new lang_string('contextlockappliestoadmin_desc', 'core_admin'),
1
));
$temp->add(new admin_setting_configcheckbox('forceclean', new lang_string('forceclean', 'core_admin'),
new lang_string('forceclean_desc', 'core_admin'), 0));
// Relative course dates mode setting.
$temp->add(new admin_setting_configcheckbox('enablecourserelativedates',
new lang_string('enablecourserelativedates', 'core_admin'),
new lang_string('enablecourserelativedates_desc', 'core_admin'), 0));
// Sharing to MoodleNet setting.
$temp->add(new admin_setting_configcheckbox('enablesharingtomoodlenet',
new lang_string('enablesharingtomoodlenet', 'core_admin'),
new lang_string('enablesharingtomoodlenet_desc', 'core_admin'), 0));
// New communication subsystem setting.
$temp->add(new admin_setting_configcheckbox('enablecommunicationsubsystem',
new lang_string('enablecommunicationsubsystem', 'core_admin'),
new lang_string('enablecommunicationsubsystem_desc', 'core_admin'), 0));
$ADMIN->add('experimental', $temp);
// "debugging" settingpage
$temp = new admin_settingpage('debugging', new lang_string('debugging', 'admin'));
$temp->add(new admin_setting_special_debug());
$temp->add(new admin_setting_configcheckbox('debugdisplay', new lang_string('debugdisplay', 'admin'),
new lang_string('configdebugdisplay', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('perfdebug', new lang_string('perfdebug', 'admin'), new lang_string('configperfdebug', 'admin'), '7', '15', '7'));
$temp->add(new admin_setting_configcheckbox('debugstringids', new lang_string('debugstringids', 'admin'), new lang_string('debugstringids_desc', 'admin'), 0));
$temp->add(new admin_setting_configselect('debugsqltrace',
new lang_string('debugsqltrace', 'admin'),
new lang_string('debugsqltrace_desc', 'admin'), 0, array(
0 => new lang_string('disabled', 'admin'),
1 => new lang_string('debugsqltrace1', 'admin'),
2 => new lang_string('debugsqltrace2', 'admin'),
100 => new lang_string('debugsqltrace100', 'admin'))));
$temp->add(new admin_setting_configcheckbox('debugvalidators', new lang_string('debugvalidators', 'admin'), new lang_string('configdebugvalidators', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('debugpageinfo', new lang_string('debugpageinfo', 'admin'), new lang_string('configdebugpageinfo', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('debugtemplateinfo', new lang_string('debugtemplateinfo', 'admin'), new lang_string('debugtemplateinfo_desc', 'admin'), 0));
$ADMIN->add('development', $temp);
// "Profiling" settingpage (conditionally if the 'xhprof' extension is available only).
$xhprofenabled = extension_loaded('tideways_xhprof');
$xhprofenabled = $xhprofenabled || extension_loaded('tideways');
$xhprofenabled = $xhprofenabled || extension_loaded('xhprof');
$temp = new admin_settingpage('profiling', new lang_string('profiling', 'admin'), 'moodle/site:config', !$xhprofenabled);
// Main profiling switch.
$temp->add(new admin_setting_configcheckbox('profilingenabled', new lang_string('profilingenabled', 'admin'), new lang_string('profilingenabled_help', 'admin'), false));
// List of URLs that will be automatically profiled.
$temp->add(new admin_setting_configtextarea('profilingincluded', new lang_string('profilingincluded', 'admin'), new lang_string('profilingincluded_help', 'admin'), ''));
// List of URLs that won't be profiled ever.
$temp->add(new admin_setting_configtextarea('profilingexcluded', new lang_string('profilingexcluded', 'admin'), new lang_string('profilingexcluded_help', 'admin'), ''));
// Allow random profiling each XX requests.
$temp->add(new admin_setting_configtext('profilingautofrec', new lang_string('profilingautofrec', 'admin'), new lang_string('profilingautofrec_help', 'admin'), 0, PARAM_INT));
// Allow PROFILEME/DONTPROFILEME GPC.
$temp->add(new admin_setting_configcheckbox('profilingallowme', new lang_string('profilingallowme', 'admin'), new lang_string('profilingallowme_help', 'admin'), false));
// Allow PROFILEALL/PROFILEALLSTOP GPC.
$temp->add(new admin_setting_configcheckbox('profilingallowall', new lang_string('profilingallowall', 'admin'), new lang_string('profilingallowall_help', 'admin'), false));
$temp->add(new admin_setting_configtext('profilingslow', new lang_string('profilingslow', 'admin'),
new lang_string('profilingslow_help', 'admin'), 0, PARAM_FLOAT));
// TODO: Allow to skip PHP functions (XHPROF_FLAGS_NO_BUILTINS)
// TODO: Allow to skip call_user functions (ignored_functions array)
// Specify the life time (in minutes) of profiling runs.
$temp->add(new admin_setting_configselect('profilinglifetime', new lang_string('profilinglifetime', 'admin'), new lang_string('profilinglifetime_help', 'admin'), 24*60, array(
0 => new lang_string('neverdeleteruns', 'admin'),
30*24*60 => new lang_string('numdays', '', 30),
15*24*60 => new lang_string('numdays', '', 15),
7*24*60 => new lang_string('numdays', '', 7),
4*24*60 => new lang_string('numdays', '', 4),
2*24*60 => new lang_string('numdays', '', 2),
24*60 => new lang_string('numhours', '', 24),
16*80 => new lang_string('numhours', '', 16),
8*60 => new lang_string('numhours', '', 8),
4*60 => new lang_string('numhours', '', 4),
2*60 => new lang_string('numhours', '', 2),
60 => new lang_string('numminutes', '', 60),
30 => new lang_string('numminutes', '', 30),
15 => new lang_string('numminutes', '', 15))));
// Define the prefix to be added to imported profiling runs.
$temp->add(new admin_setting_configtext('profilingimportprefix',
new lang_string('profilingimportprefix', 'admin'),
new lang_string('profilingimportprefix_desc', 'admin'), '(I)', PARAM_TAG, 10));
// Add the 'profiling' page to admin block.
$ADMIN->add('development', $temp);
// Web service test clients DO NOT COMMIT : THE EXTERNAL WEB PAGE IS NOT AN ADMIN PAGE !!!!!
$ADMIN->add('development', new admin_externalpage('testclient', new lang_string('testclient', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/testclient.php"));
if ($CFG->mnet_dispatcher_mode !== 'off') {
$ADMIN->add('development', new admin_externalpage('mnettestclient', new lang_string('testclient', 'mnet'), "$CFG->wwwroot/$CFG->admin/mnet/testclient.php"));
}
$ADMIN->add('development', new admin_externalpage('purgecaches', new lang_string('purgecachespage', 'admin'),
"$CFG->wwwroot/$CFG->admin/purgecaches.php"));
$ADMIN->add('development', new admin_externalpage('thirdpartylibs', new lang_string('thirdpartylibs','admin'), "$CFG->wwwroot/$CFG->admin/thirdpartylibs.php"));
$ADMIN->add('development', new admin_externalpage('hooksoverview',
new lang_string('hooksoverview', 'admin'), "$CFG->wwwroot/$CFG->admin/hooks.php"));
} // end of speedup
+74
View File
@@ -0,0 +1,74 @@
<?php
// This file defines everything related to frontpage
if (!during_initial_install()) { //do not use during installation
$frontpagecontext = context_course::instance(SITEID);
if ($hassiteconfig or has_any_capability(array(
'moodle/course:update',
'moodle/role:assign',
'moodle/restore:restorecourse',
'moodle/backup:backupcourse',
'moodle/course:managefiles',
'moodle/question:add',
'moodle/question:editmine',
'moodle/question:editall',
'moodle/question:viewmine',
'moodle/question:viewall',
'moodle/question:movemine',
'moodle/question:moveall'), $frontpagecontext)) {
// "frontpage" settingpage
$temp = new admin_settingpage('frontpagesettings', new lang_string('frontpagesettings','admin'), 'moodle/course:update', false, $frontpagecontext);
$temp->add(new admin_setting_sitesettext('fullname', new lang_string('fullsitename'), '', NULL)); // no default
$temp->add(new admin_setting_sitesettext('shortname', new lang_string('shortsitename'), '', NULL)); // no default
$temp->add(new admin_setting_special_frontpagedesc());
$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
$options = array();
$options[] = new lang_string('unlimited');
for ($i=1; $i<100; $i++) {
$options[$i] = $i;
}
$temp->add(new admin_setting_configselect('maxcategorydepth', new lang_string('configsitemaxcategorydepth','admin'), new lang_string('configsitemaxcategorydepthhelp','admin'), 2, $options));
$temp->add(new admin_setting_configtext('frontpagecourselimit', new lang_string('configfrontpagecourselimit','admin'), new lang_string('configfrontpagecourselimithelp','admin'), 200, PARAM_INT));
$temp->add(new admin_setting_sitesetcheckbox('numsections', new lang_string('sitesection'), new lang_string('sitesectionhelp','admin'), 1));
$temp->add(new admin_setting_sitesetselect('newsitems', new lang_string('newsitemsnumber'), '', 3,
array('0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10')));
$temp->add(new admin_setting_configtext('commentsperpage', new lang_string('commentsperpage', 'admin'), '', 15, PARAM_INT));
// front page default role
$options = array(0=>new lang_string('none')); // roles to choose from
$defaultfrontpageroleid = 0;
$roles = role_fix_names(get_all_roles(), null, ROLENAME_ORIGINALANDSHORT);
foreach ($roles as $role) {
if (empty($role->archetype) or $role->archetype === 'guest' or $role->archetype === 'frontpage' or $role->archetype === 'student') {
$options[$role->id] = $role->localname;
if ($role->archetype === 'frontpage' && !$defaultfrontpageroleid) {
$defaultfrontpageroleid = $role->id;
}
}
}
if ($defaultfrontpageroleid and (!isset($CFG->defaultfrontpageroleid) or $CFG->defaultfrontpageroleid)) {
//frotpage role may not exist in old upgraded sites
unset($options[0]);
}
$temp->add(new admin_setting_configselect('defaultfrontpageroleid', new lang_string('frontpagedefaultrole', 'admin'), '', $defaultfrontpageroleid, $options));
$ADMIN->add('frontpage', $temp);
}
}
+225
View File
@@ -0,0 +1,225 @@
<?php
// This file defines settingpages and externalpages under the "grades" section
if (has_capability('moodle/grade:manage', $systemcontext)
or has_capability('moodle/grade:manageletters', $systemcontext)) { // speedup for non-admins, add all caps used on this page
require_once $CFG->libdir.'/grade/constants.php';
$display_types = array(GRADE_DISPLAY_TYPE_REAL => new lang_string('real', 'grades'),
GRADE_DISPLAY_TYPE_PERCENTAGE => new lang_string('percentage', 'grades'),
GRADE_DISPLAY_TYPE_LETTER => new lang_string('letter', 'grades'),
GRADE_DISPLAY_TYPE_REAL_PERCENTAGE => new lang_string('realpercentage', 'grades'),
GRADE_DISPLAY_TYPE_REAL_LETTER => new lang_string('realletter', 'grades'),
GRADE_DISPLAY_TYPE_LETTER_REAL => new lang_string('letterreal', 'grades'),
GRADE_DISPLAY_TYPE_LETTER_PERCENTAGE => new lang_string('letterpercentage', 'grades'),
GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER => new lang_string('percentageletter', 'grades'),
GRADE_DISPLAY_TYPE_PERCENTAGE_REAL => new lang_string('percentagereal', 'grades')
);
asort($display_types);
// General settings
$temp = new admin_settingpage('gradessettings', new lang_string('generalsettings', 'grades'), 'moodle/grade:manage');
if ($ADMIN->fulltree) {
// new CFG variable for gradebook (what roles to display)
$temp->add(new admin_setting_special_gradebookroles());
// enable outcomes checkbox now in subsystems area
$temp->add(new admin_setting_grade_profilereport());
$temp->add(new admin_setting_configselect('grade_aggregationposition', new lang_string('aggregationposition', 'grades'),
new lang_string('aggregationposition_help', 'grades'), GRADE_REPORT_AGGREGATION_POSITION_LAST,
array(GRADE_REPORT_AGGREGATION_POSITION_FIRST => new lang_string('positionfirst', 'grades'),
GRADE_REPORT_AGGREGATION_POSITION_LAST => new lang_string('positionlast', 'grades'))));
$temp->add(new admin_setting_regradingcheckbox('grade_includescalesinaggregation', new lang_string('includescalesinaggregation', 'grades'), new lang_string('includescalesinaggregation_help', 'grades'), 1));
$temp->add(new admin_setting_configcheckbox('grade_hiddenasdate', new lang_string('hiddenasdate', 'grades'), new lang_string('hiddenasdate_help', 'grades'), 0));
// enable publishing in exports/imports
$temp->add(new admin_setting_configcheckbox('gradepublishing', new lang_string('gradepublishing', 'grades'), new lang_string('gradepublishing_help', 'grades'), 0));
$temp->add(new admin_setting_configcheckbox('grade_export_exportfeedback', new lang_string('exportfeedback', 'grades'),
new lang_string('exportfeedback_desc', 'grades'), 0));
$temp->add(new admin_setting_configselect('grade_export_displaytype', new lang_string('gradeexportdisplaytype', 'grades'),
new lang_string('gradeexportdisplaytype_desc', 'grades'), GRADE_DISPLAY_TYPE_REAL, $display_types));
$temp->add(new admin_setting_configselect('grade_export_decimalpoints', new lang_string('gradeexportdecimalpoints', 'grades'),
new lang_string('gradeexportdecimalpoints_desc', 'grades'), 2,
array( '0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5')));
$setting = new admin_setting_configtext('grade_export_userprofilefields',
new lang_string('gradeexportuserprofilefields', 'grades'),
new lang_string('gradeexportuserprofilefields_desc', 'grades'),
'firstname,lastname,idnumber,institution,department,email', PARAM_TEXT);
$setting->set_force_ltr(true);
$temp->add($setting);
$setting = new admin_setting_configtext('grade_export_customprofilefields',
new lang_string('gradeexportcustomprofilefields', 'grades'),
new lang_string('gradeexportcustomprofilefields_desc', 'grades'), '', PARAM_TEXT);
$setting->set_force_ltr(true);
$temp->add($setting);
$temp->add(new admin_setting_configcheckbox('recovergradesdefault', new lang_string('recovergradesdefault', 'grades'), new lang_string('recovergradesdefault_help', 'grades'), 0));
$temp->add(new admin_setting_special_gradeexport());
$temp->add(new admin_setting_special_gradeexportdefault());
$temp->add(new admin_setting_special_gradelimiting());
$temp->add(new admin_setting_configcheckbox('grade_report_showmin',
get_string('minimum_show', 'grades'),
get_string('minimum_show_help', 'grades'), '1'));
$temp->add(new admin_setting_special_gradepointmax());
$temp->add(new admin_setting_special_gradepointdefault());
$temp->add(new admin_setting_special_grademinmaxtouse());
$temp->add(new admin_setting_my_grades_report());
$temp->add(new admin_setting_configtext('gradereport_mygradeurl', new lang_string('externalurl', 'grades'),
new lang_string('externalurl_desc', 'grades'), ''));
}
$ADMIN->add('grades', $temp);
/// Grade category settings
$temp = new admin_settingpage('gradecategorysettings', new lang_string('gradecategorysettings', 'grades'), 'moodle/grade:manage');
if ($ADMIN->fulltree) {
$temp->add(new admin_setting_configcheckbox('grade_hideforcedsettings', new lang_string('hideforcedsettings', 'grades'), new lang_string('hideforcedsettings_help', 'grades'), '1'));
$strnoforce = new lang_string('noforce', 'grades');
// Aggregation type
$options = array(GRADE_AGGREGATE_MEAN =>new lang_string('aggregatemean', 'grades'),
GRADE_AGGREGATE_WEIGHTED_MEAN =>new lang_string('aggregateweightedmean', 'grades'),
GRADE_AGGREGATE_WEIGHTED_MEAN2 =>new lang_string('aggregateweightedmean2', 'grades'),
GRADE_AGGREGATE_EXTRACREDIT_MEAN=>new lang_string('aggregateextracreditmean', 'grades'),
GRADE_AGGREGATE_MEDIAN =>new lang_string('aggregatemedian', 'grades'),
GRADE_AGGREGATE_MIN =>new lang_string('aggregatemin', 'grades'),
GRADE_AGGREGATE_MAX =>new lang_string('aggregatemax', 'grades'),
GRADE_AGGREGATE_MODE =>new lang_string('aggregatemode', 'grades'),
GRADE_AGGREGATE_SUM =>new lang_string('aggregatesum', 'grades'));
$defaultvisible = array(GRADE_AGGREGATE_SUM);
$defaults = array('value' => GRADE_AGGREGATE_SUM, 'forced' => false);
$temp->add(new admin_setting_gradecat_combo('grade_aggregation', new lang_string('aggregation', 'grades'), new lang_string('aggregation_help', 'grades'), $defaults, $options));
$temp->add(new admin_setting_configmultiselect('grade_aggregations_visible', new lang_string('aggregationsvisible', 'grades'),
new lang_string('aggregationsvisiblehelp', 'grades'), $defaultvisible, $options));
$options = array(0 => new lang_string('no'), 1 => new lang_string('yes'));
$defaults = array('value' => 1, 'forced' => false);
$temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', new lang_string('aggregateonlygraded', 'grades'),
new lang_string('aggregateonlygraded_help', 'grades'), $defaults, $options));
$defaults = array('value' => 0, 'forced' => false);
$temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', new lang_string('aggregateoutcomes', 'grades'),
new lang_string('aggregateoutcomes_help', 'grades'), $defaults, $options));
$options = array(0 => new lang_string('none'));
for ($i=1; $i<=20; $i++) {
$options[$i] = $i;
}
$defaults['value'] = 0;
$defaults['forced'] = true;
$temp->add(new admin_setting_gradecat_combo('grade_keephigh', new lang_string('keephigh', 'grades'),
new lang_string('keephigh_help', 'grades'), $defaults, $options));
$defaults['forced'] = false;
$temp->add(new admin_setting_gradecat_combo('grade_droplow', new lang_string('droplow', 'grades'),
new lang_string('droplow_help', 'grades'), $defaults, $options));
$temp->add(new admin_setting_configcheckbox('grade_overridecat', new lang_string('overridecat', 'grades'),
new lang_string('overridecat_help', 'grades'), 1));
}
$ADMIN->add('grades', $temp);
/// Grade item settings
$temp = new admin_settingpage('gradeitemsettings', new lang_string('gradeitemsettings', 'grades'), 'moodle/grade:manage');
if ($ADMIN->fulltree) {
$temp->add(new admin_setting_configselect('grade_displaytype', new lang_string('gradedisplaytype', 'grades'),
new lang_string('gradedisplaytype_help', 'grades'), GRADE_DISPLAY_TYPE_REAL, $display_types));
$temp->add(new admin_setting_configselect('grade_decimalpoints', new lang_string('decimalpoints', 'grades'),
new lang_string('decimalpoints_help', 'grades'), 2,
array( '0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5')));
}
$ADMIN->add('grades', $temp);
/// Scales and outcomes
$scales = new admin_externalpage('scales', new lang_string('scales'), $CFG->wwwroot.'/grade/edit/scale/index.php', 'moodle/grade:manage');
$ADMIN->add('grades', $scales);
if (!empty($CFG->enableoutcomes)) {
$outcomes = new admin_externalpage('outcomes', new lang_string('outcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/index.php', 'moodle/grade:manage');
$ADMIN->add('grades', $outcomes);
}
$letters = new admin_externalpage('letters', new lang_string('letters', 'grades'), $CFG->wwwroot.'/grade/edit/letter/index.php', 'moodle/grade:manageletters');
$ADMIN->add('grades', $letters);
// The plugins must implement a settings.php file that adds their admin settings to the $settings object
// Reports
$ADMIN->add('grades', new admin_category('gradereports', new lang_string('reportsettings', 'grades')));
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/settings.php')) {
$settings = new admin_settingpage('gradereport'.$plugin, new lang_string('pluginname', 'gradereport_'.$plugin), 'moodle/grade:manage');
include($plugindir.'/settings.php');
if ($settings) {
$ADMIN->add('gradereports', $settings);
}
}
}
// Imports
$ADMIN->add('grades', new admin_category('gradeimports', new lang_string('importsettings', 'grades')));
foreach (core_component::get_plugin_list('gradeimport') as $plugin => $plugindir) {
// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/settings.php')) {
$settings = new admin_settingpage('gradeimport'.$plugin, new lang_string('pluginname', 'gradeimport_'.$plugin), 'moodle/grade:manage');
include($plugindir.'/settings.php');
if ($settings) {
$ADMIN->add('gradeimports', $settings);
}
}
}
// Exports
$ADMIN->add('grades', new admin_category('gradeexports', new lang_string('exportsettings', 'grades')));
foreach (core_component::get_plugin_list('gradeexport') as $plugin => $plugindir) {
// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/settings.php')) {
$settings = new admin_settingpage('gradeexport'.$plugin, new lang_string('pluginname', 'gradeexport_'.$plugin), 'moodle/grade:manage');
include($plugindir.'/settings.php');
if ($settings) {
$ADMIN->add('gradeexports', $settings);
}
}
}
} // end of speedup
+58
View File
@@ -0,0 +1,58 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* H5P settings link.
*
* @package core_h5p
* @copyright 2019 Amaia Anabitarte <amaia@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
// H5P overview.
$ADMIN->add('h5p', new admin_externalpage('h5poverview', get_string('h5poverview', 'core_h5p'),
new moodle_url('/h5p/overview.php'), ['moodle/site:config']));
// Manage H5P libraries page.
$ADMIN->add('h5p', new admin_externalpage('h5pmanagelibraries', get_string('h5pmanage', 'core_h5p'),
new moodle_url('/h5p/libraries.php'), ['moodle/site:config', 'moodle/h5p:updatelibraries']));
// H5P settings.
$defaulth5plib = \core_h5p\local\library\autoloader::get_default_handler_library();
if (!empty($defaulth5plib)) {
// As for now this page only has this setting, it will be hidden if there isn't any H5P libraries handler defined.
$settings = new admin_settingpage('h5psettings', new lang_string('h5psettings', 'core_h5p'));
$ADMIN->add('h5p', $settings);
$settings->add(new admin_settings_h5plib_handler_select('h5plibraryhandler', new lang_string('h5plibraryhandler', 'core_h5p'),
new lang_string('h5plibraryhandler_help', 'core_h5p'), $defaulth5plib));
$setting = new admin_setting_configtextarea(
'core_h5p/h5pcustomcss',
new lang_string('h5pcustomcss', 'core_h5p'),
new lang_string('h5pcustomcss_help', 'core_h5p'),
'',
PARAM_NOTAGS
);
$setting->set_updatedcallback(function () {
// Enables use of file_storage constants.
\core_h5p\local\library\autoloader::register();
\core_h5p\file_storage::generate_custom_styles();
});
$settings->add($setting);
}
+27
View File
@@ -0,0 +1,27 @@
<?php
// This file defines settingpages and externalpages under the "appearance" category
use core_admin\local\settings\setting_scheduled_task_status;
if ($hassiteconfig) {
// "languageandlocation" settingpage
$temp = new admin_settingpage('langsettings', new lang_string('languagesettings', 'admin'));
$temp->add(new admin_setting_configcheckbox('autolang', new lang_string('autolang', 'admin'), new lang_string('configautolang', 'admin'), 1));
$temp->add(new admin_setting_configselect('lang', new lang_string('lang', 'admin'), new lang_string('configlang', 'admin'), current_language(), get_string_manager()->get_list_of_translations())); // $CFG->lang might be set in installer already, default en is in setup.php
$temp->add(new admin_setting_configcheckbox('autolangusercreation', new lang_string('autolangusercreation', 'admin'),
new lang_string('configautolangusercreation', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('langmenu', new lang_string('langmenu', 'admin'), new lang_string('configlangmenu', 'admin'), 1));
$temp->add(new admin_setting_langlist());
$temp->add(new admin_setting_configcheckbox('langcache', new lang_string('langcache', 'admin'), new lang_string('langcache_desc', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('langstringcache', new lang_string('langstringcache', 'admin'), new lang_string('configlangstringcache', 'admin'), 1));
$temp->add(new admin_setting_configtext('locale', new lang_string('localetext', 'admin'), new lang_string('configlocale', 'admin'), '', PARAM_FILE));
$temp->add(new admin_setting_configselect('latinexcelexport', new lang_string('latinexcelexport', 'admin'), new lang_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin')));
$temp->add(new admin_setting_configcheckbox('enablepdfexportfont', new lang_string('enablepdfexportfont', 'admin'),
new lang_string('enablepdfexportfont_desc', 'admin'), 0));
$temp->add(new setting_scheduled_task_status('langimporttaskstatus', '\tool_langimport\task\update_langpacks_task'));
$ADMIN->add('language', $temp);
} // end of speedup
+45
View File
@@ -0,0 +1,45 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file defines the settings pages for licenses.
*
* @package core
* @copyright 2020 Tom Dickman <tomdickman@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/licenselib.php');
if ($hassiteconfig) {
$temp = new admin_settingpage('licensesettings', new lang_string('licensesettings', 'admin'));
$licenses = license_manager::get_active_licenses_as_array();
$temp->add(new admin_setting_configselect('sitedefaultlicense',
new lang_string('configsitedefaultlicense', 'admin'),
new lang_string('configsitedefaultlicensehelp', 'admin'),
'unknown',
$licenses));
$temp->add(new admin_setting_configcheckbox('rememberuserlicensepref',
new lang_string('rememberuserlicensepref', 'admin'),
new lang_string('rememberuserlicensepref_help', 'admin'),
1));
$ADMIN->add('license', $temp);
}
+57
View File
@@ -0,0 +1,57 @@
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Define administration settings on the Location settings page.
*
* @package core
* @category admin
* @copyright 2006 Martin Dougiamas <martin@moodle.com>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
$temp = new admin_settingpage('locationsettings', new lang_string('locationsettings', 'core_admin'));
if ($ADMIN->fulltree) {
$temp->add(new admin_setting_servertimezone());
$temp->add(new admin_setting_forcetimezone());
$temp->add(new admin_settings_country_select('country', new lang_string('country', 'core_admin'),
new lang_string('configcountry', 'core_admin'), 0));
$temp->add(new admin_setting_configtext('defaultcity', new lang_string('defaultcity', 'core_admin'),
new lang_string('defaultcity_help', 'core_admin'), ''));
$temp->add(new admin_setting_heading('iplookup', new lang_string('iplookup', 'core_admin'),
new lang_string('iplookupinfo', 'core_admin')));
$temp->add(new admin_setting_configfile('geoip2file', new lang_string('geoipfile', 'core_admin'),
new lang_string('configgeoipfile', 'core_admin', $CFG->dataroot . '/geoip/'),
$CFG->dataroot . '/geoip/GeoLite2-City.mmdb'));
$temp->add(new admin_setting_configtext('googlemapkey3', new lang_string('googlemapkey3', 'core_admin'),
new lang_string('googlemapkey3_help', 'core_admin'), '', PARAM_RAW, 60));
$temp->add(new admin_setting_countrycodes('allcountrycodes', new lang_string('allcountrycodes', 'core_admin'),
new lang_string('configallcountrycodes', 'core_admin')));
}
$ADMIN->add('location', $temp);
}
+79
View File
@@ -0,0 +1,79 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Adds messaging related settings links for Messaging category to admin tree.
*
* @copyright 2019 Amaia Anabitarte <amaia@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
$temp = new admin_settingpage('messages',
new lang_string('messagingssettings', 'admin'),
'moodle/site:config',
empty($CFG->messaging)
);
$temp->add(new admin_setting_configcheckbox('messagingallusers',
new lang_string('messagingallusers', 'admin'),
new lang_string('configmessagingallusers', 'admin'),
0)
);
$temp->add(new admin_setting_configcheckbox('messagingdefaultpressenter',
new lang_string('messagingdefaultpressenter', 'admin'),
new lang_string('configmessagingdefaultpressenter', 'admin'),
1)
);
$options = array(
DAYSECS => new lang_string('secondstotime86400'),
WEEKSECS => new lang_string('secondstotime604800'),
2620800 => new lang_string('nummonths', 'moodle', 1),
7862400 => new lang_string('nummonths', 'moodle', 3),
15724800 => new lang_string('nummonths', 'moodle', 6),
0 => new lang_string('never')
);
$temp->add(new admin_setting_configselect(
'messagingdeletereadnotificationsdelay',
new lang_string('messagingdeletereadnotificationsdelay', 'admin'),
new lang_string('configmessagingdeletereadnotificationsdelay', 'admin'),
604800,
$options)
);
$temp->add(new admin_setting_configselect(
'messagingdeleteallnotificationsdelay',
new lang_string('messagingdeleteallnotificationsdelay', 'admin'),
new lang_string('configmessagingdeleteallnotificationsdelay', 'admin'),
2620800,
$options)
);
$temp->add(new admin_setting_configcheckbox('messagingallowemailoverride',
new lang_string('messagingallowemailoverride', 'admin'),
new lang_string('configmessagingallowemailoverride', 'admin'),
0));
$ADMIN->add('messaging', $temp);
$ADMIN->add('messaging', new admin_page_managemessageoutputs());
// Notification outputs plugins.
$plugins = core_plugin_manager::instance()->get_plugins_of_type('message');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\message $plugin */
$plugin->load_settings($ADMIN, 'messaging', $hassiteconfig);
}
}
+62
View File
@@ -0,0 +1,62 @@
<?php
// This file defines settingpages and externalpages under the "mnet" category
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$ADMIN->add('mnet', new admin_externalpage('net', new lang_string('settings', 'mnet'),
"$CFG->wwwroot/$CFG->admin/mnet/index.php",
'moodle/site:config'));
$ADMIN->add('mnet', new admin_externalpage('mnetpeers', new lang_string('managemnetpeers', 'mnet'),
"$CFG->wwwroot/$CFG->admin/mnet/peers.php",
'moodle/site:config'));
$ADMIN->add('mnet', new admin_category('mnetpeercat', new lang_string('mnetpeers', 'mnet')));
if (isset($CFG->mnet_dispatcher_mode) and $CFG->mnet_dispatcher_mode !== 'off') {
require_once($CFG->dirroot.'/mnet/lib.php');
$hosts = mnet_get_hosts();
foreach ($hosts as $host) {
if ($host->id == $CFG->mnet_all_hosts_id) {
$host->name = new lang_string('allhosts', 'core_mnet');
}
$ADMIN->add('mnetpeercat',
new admin_externalpage(
'mnetpeer' . $host->id,
$host->name,
$CFG->wwwroot . '/'.$CFG->admin.'/mnet/peers.php?step=update&hostid=' . $host->id,
'moodle/site:config'
)
);
}
}
$ADMIN->add('mnet', new admin_externalpage('ssoaccesscontrol', new lang_string('ssoaccesscontrol', 'mnet'),
"$CFG->wwwroot/$CFG->admin/mnet/access_control.php",
'moodle/site:config'));
$ADMIN->add('mnet', new admin_externalpage('mnetenrol', new lang_string('clientname', 'mnetservice_enrol'),
"$CFG->wwwroot/mnet/service/enrol/index.php",
'moodle/site:config'));
$ADMIN->add('mnet', new admin_externalpage('trustedhosts', new lang_string('trustedhosts', 'mnet'),
"$CFG->wwwroot/$CFG->admin/mnet/trustedhosts.php",
'moodle/site:config'));
if (isset($CFG->mnet_dispatcher_mode) and $CFG->mnet_dispatcher_mode !== 'off') {
$profilefields = new admin_settingpage('mnetprofilefields', new lang_string('profilefields', 'mnet'),
'moodle/site:config');
$ADMIN->add('mnet', $profilefields);
$fields = mnet_profile_field_options();
$forced = implode(', ', $fields['forced']);
$profilefields->add(new admin_setting_configmultiselect('mnetprofileexportfields', new lang_string('profileexportfields', 'mnet'), new lang_string('profilefielddesc', 'mnet', $forced), $fields['legacy'], $fields['optional']));
$profilefields->add(new admin_setting_configmultiselect('mnetprofileimportfields', new lang_string('profileimportfields', 'mnet'), new lang_string('profilefielddesc', 'mnet', $forced), $fields['legacy'], $fields['optional']));
}
} // end of speedup
+55
View File
@@ -0,0 +1,55 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file gives information about MoodleNet.
*
* @package core
* @copyright 2023 Huong Nguyen <huongnv13@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {
if (!empty($CFG->enablesharingtomoodlenet)) {
if (!$ADMIN->locate('moodlenet')) {
$ADMIN->add('root', new admin_category('moodlenet', get_string('pluginname', 'tool_moodlenet')));
}
// Outbound settings page.
$settings = new admin_settingpage('moodlenetoutbound', new lang_string('moodlenet:outboundsettings', 'moodle'));
$ADMIN->add('moodlenet', $settings);
// Get all the issuers.
$issuers = \core\oauth2\api::get_all_issuers();
$oauth2services = [
'' => new lang_string('none', 'admin'),
];
foreach ($issuers as $issuer) {
// Get the enabled issuer with the service type is MoodleNet only.
if ($issuer->get('servicetype') == 'moodlenet' && $issuer->get('enabled')) {
$oauth2services[$issuer->get('id')] = s($issuer->get('name'));
}
}
$url = new \moodle_url('/admin/tool/oauth2/issuers.php');
$settings->add(new admin_setting_configselect('moodlenet/oauthservice', new lang_string('issuer', 'auth_oauth2'),
new lang_string('moodlenet:configoauthservice', 'moodle', $url->out()), '', $oauth2services));
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Adds payments links to the admin tree
*
* @package core
* @copyright 2020 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$ADMIN->add('payment', new admin_externalpage(
'paymentaccounts',
new lang_string('paymentaccounts', 'payment'),
new moodle_url("/payment/accounts.php"),
['moodle/payment:manageaccounts', 'moodle/payment:viewpayments']));
+852
View File
@@ -0,0 +1,852 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Load all plugins into the admin tree.
*
* Please note that is file is always loaded last - it means that you can inject entries into other categories too.
*
* @package core
* @copyright 2007 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if ($hassiteconfig) {
/* @var admin_root $ADMIN */
$ADMIN->locate('modules')->set_sorting(true);
$ADMIN->add('modules', new admin_page_pluginsoverview());
// activity modules
$ADMIN->add('modules', new admin_category('modsettings', new lang_string('activitymodules')));
$ADMIN->add('modsettings', new admin_page_managemods());
$temp = new admin_settingpage('managemodulescommon', new lang_string('commonactivitysettings', 'admin'));
$temp->add(new admin_setting_configcheckbox('requiremodintro',
get_string('requiremodintro', 'admin'), get_string('requiremodintro_desc', 'admin'), 0));
$ADMIN->add('modsettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('mod');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\mod $plugin */
$plugin->load_settings($ADMIN, 'modsettings', $hassiteconfig);
}
// course formats
$ADMIN->add('modules', new admin_category('formatsettings', new lang_string('courseformats')));
$temp = new admin_settingpage('manageformats', new lang_string('manageformats', 'core_admin'));
$temp->add(new admin_setting_manageformats());
$ADMIN->add('formatsettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('format');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\format $plugin */
$plugin->load_settings($ADMIN, 'formatsettings', $hassiteconfig);
}
// Custom fields.
$ADMIN->add('modules', new admin_category('customfieldsettings', new lang_string('customfields', 'core_customfield')));
$temp = new admin_settingpage('managecustomfields', new lang_string('managecustomfields', 'core_admin'));
$temp->add(new admin_setting_managecustomfields());
$ADMIN->add('customfieldsettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('customfield');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\customfield $plugin */
$plugin->load_settings($ADMIN, 'customfieldsettings', $hassiteconfig);
}
// blocks
$ADMIN->add('modules', new admin_category('blocksettings', new lang_string('blocks')));
$ADMIN->add('blocksettings', new admin_page_manageblocks());
$plugins = core_plugin_manager::instance()->get_plugins_of_type('block');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\block $plugin */
$plugin->load_settings($ADMIN, 'blocksettings', $hassiteconfig);
}
// authentication plugins
$ADMIN->add('modules', new admin_category('authsettings', new lang_string('authentication', 'admin')));
$temp = new admin_settingpage('manageauths', new lang_string('authsettings', 'admin'));
$temp->add(new admin_setting_manageauths());
$temp->add(new admin_setting_heading('manageauthscommonheading', new lang_string('commonsettings', 'admin'), ''));
$temp->add(new admin_setting_special_registerauth());
$temp->add(new admin_setting_configcheckbox('authloginviaemail', new lang_string('authloginviaemail', 'core_auth'), new lang_string('authloginviaemail_desc', 'core_auth'), 0));
$temp->add(new admin_setting_configcheckbox('allowaccountssameemail',
new lang_string('allowaccountssameemail', 'core_auth'),
new lang_string('allowaccountssameemail_desc', 'core_auth'), 0));
$temp->add(new admin_setting_configcheckbox('authpreventaccountcreation', new lang_string('authpreventaccountcreation', 'admin'), new lang_string('authpreventaccountcreation_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('loginpageautofocus', new lang_string('loginpageautofocus', 'admin'), new lang_string('loginpageautofocus_help', 'admin'), 0));
$temp->add(new admin_setting_configselect('guestloginbutton', new lang_string('guestloginbutton', 'auth'),
new lang_string('showguestlogin', 'auth'), '1', array('0'=>new lang_string('hide'), '1'=>new lang_string('show'))));
$options = array(0 => get_string('no'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 10 => 10, 20 => 20, 50 => 50);
$temp->add(new admin_setting_configselect('limitconcurrentlogins',
new lang_string('limitconcurrentlogins', 'core_auth'),
new lang_string('limitconcurrentlogins_desc', 'core_auth'), 0, $options));
$temp->add(new admin_setting_configtext('alternateloginurl', new lang_string('alternateloginurl', 'auth'),
new lang_string('alternatelogin', 'auth', htmlspecialchars(get_login_url(), ENT_COMPAT)), ''));
$temp->add(new admin_setting_configtext('forgottenpasswordurl', new lang_string('forgottenpasswordurl', 'auth'),
new lang_string('forgottenpassword', 'auth'), '', PARAM_URL));
$temp->add(new admin_setting_confightmleditor('auth_instructions', new lang_string('instructions', 'auth'),
new lang_string('authinstructions', 'auth'), ''));
$setting = new admin_setting_configtext('allowemailaddresses', new lang_string('allowemailaddresses', 'admin'),
new lang_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$setting = new admin_setting_configtext('denyemailaddresses', new lang_string('denyemailaddresses', 'admin'),
new lang_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$temp->add(new admin_setting_configcheckbox('verifychangedemail', new lang_string('verifychangedemail', 'admin'), new lang_string('configverifychangedemail', 'admin'), 1));
// ReCaptcha.
$temp->add(new admin_setting_configselect('enableloginrecaptcha',
new lang_string('auth_loginrecaptcha', 'auth'),
new lang_string('auth_loginrecaptcha_desc', 'auth'),
0,
[
new lang_string('no'),
new lang_string('yes'),
],
));
$setting = new admin_setting_configtext('recaptchapublickey', new lang_string('recaptchapublickey', 'admin'), new lang_string('configrecaptchapublickey', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$setting = new admin_setting_configtext('recaptchaprivatekey', new lang_string('recaptchaprivatekey', 'admin'), new lang_string('configrecaptchaprivatekey', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$ADMIN->add('authsettings', $temp);
// Toggle password visiblity icon.
$temp->add(new admin_setting_configselect('loginpasswordtoggle',
new lang_string('auth_loginpasswordtoggle', 'auth'),
new lang_string('auth_loginpasswordtoggle_desc', 'auth'),
TOGGLE_SENSITIVE_SMALL_SCREENS_ONLY,
[
TOGGLE_SENSITIVE_DISABLED => get_string('disabled', 'admin'),
TOGGLE_SENSITIVE_ENABLED => get_string('enabled', 'admin'),
TOGGLE_SENSITIVE_SMALL_SCREENS_ONLY => get_string('smallscreensonly', 'admin'),
],
));
$temp = new admin_externalpage('authtestsettings', get_string('testsettings', 'core_auth'), new moodle_url("/auth/test_settings.php"), 'moodle/site:config', true);
$ADMIN->add('authsettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('auth');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\auth $plugin */
$plugin->load_settings($ADMIN, 'authsettings', $hassiteconfig);
}
// Enrolment plugins
$ADMIN->add('modules', new admin_category('enrolments', new lang_string('enrolments', 'enrol')));
$temp = new admin_settingpage('manageenrols', new lang_string('manageenrols', 'enrol'));
$temp->add(new admin_setting_manageenrols());
$ADMIN->add('enrolments', $temp);
$temp = new admin_externalpage('enroltestsettings', get_string('testsettings', 'core_enrol'), new moodle_url("/enrol/test_settings.php"), 'moodle/site:config', true);
$ADMIN->add('enrolments', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('enrol');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\enrol $plugin */
$plugin->load_settings($ADMIN, 'enrolments', $hassiteconfig);
}
/// Editor plugins
$ADMIN->add('modules', new admin_category('editorsettings', new lang_string('editors', 'editor')));
$temp = new admin_settingpage('manageeditors', new lang_string('editorsettings', 'editor'));
$temp->add(new \core_admin\admin\admin_setting_plugin_manager(
'editor',
\core_admin\table\editor_management_table::class,
'editorsui',
get_string('editorsettings', 'editor'),
));
$ADMIN->add('editorsettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('editor');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\editor $plugin */
$plugin->load_settings($ADMIN, 'editorsettings', $hassiteconfig);
}
// Antivirus plugins.
$ADMIN->add('modules', new admin_category('antivirussettings', new lang_string('antiviruses', 'antivirus')));
$temp = new admin_settingpage('manageantiviruses', new lang_string('antivirussettings', 'antivirus'));
$temp->add(new admin_setting_manageantiviruses());
// Status check.
$temp->add(new admin_setting_heading('antivirus/statuschecks', new lang_string('statuschecks'), ''));
$temp->add(new admin_setting_check('antivirus/checkantivirus', new \core\check\environment\antivirus()));
// Common settings.
$temp->add(new admin_setting_heading('antiviruscommonsettings', new lang_string('antiviruscommonsettings', 'antivirus'), ''));
// Alert email.
$temp->add(
new admin_setting_configtext(
'antivirus/notifyemail',
new lang_string('notifyemail', 'antivirus'),
new lang_string('notifyemail_help', 'antivirus'),
'',
PARAM_EMAIL
)
);
// Notify level.
$temp->add(new admin_setting_configselect('antivirus/notifylevel',
get_string('notifylevel', 'antivirus'), '', core\antivirus\scanner::SCAN_RESULT_ERROR, [
core\antivirus\scanner::SCAN_RESULT_ERROR => get_string('notifylevelerror', 'antivirus'),
core\antivirus\scanner::SCAN_RESULT_FOUND => get_string('notifylevelfound', 'antivirus')
]),
);
// Threshold for check displayed on the /report/status/index.php page.
$url = new moodle_url('/report/status/index.php');
$link = html_writer::link($url, get_string('pluginname', 'report_status'));
$temp->add(
new admin_setting_configduration(
'antivirus/threshold',
new lang_string('threshold', 'antivirus'),
get_string('threshold_desc', 'antivirus', $link),
20 * MINSECS
)
);
// Enable quarantine.
$temp->add(
new admin_setting_configcheckbox(
'antivirus/enablequarantine',
new lang_string('enablequarantine', 'antivirus'),
new lang_string('enablequarantine_help', 'antivirus',
\core\antivirus\quarantine::DEFAULT_QUARANTINE_FOLDER),
0
)
);
// Quarantine time.
$temp->add(
new admin_setting_configduration(
'antivirus/quarantinetime',
new lang_string('quarantinetime', 'antivirus'),
new lang_string('quarantinetime_desc', 'antivirus'),
\core\antivirus\quarantine::DEFAULT_QUARANTINE_TIME
)
);
$ADMIN->add('antivirussettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('antivirus');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/* @var \core\plugininfo\antivirus $plugin */
$plugin->load_settings($ADMIN, 'antivirussettings', $hassiteconfig);
}
// Machine learning backend plugins.
$ADMIN->add('modules', new admin_category('mlbackendsettings', new lang_string('mlbackendsettings', 'admin')));
$plugins = core_plugin_manager::instance()->get_plugins_of_type('mlbackend');
foreach ($plugins as $plugin) {
$plugin->load_settings($ADMIN, 'mlbackendsettings', $hassiteconfig);
}
/// Filter plugins
$ADMIN->add('modules', new admin_category('filtersettings', new lang_string('managefilters')));
$ADMIN->add('filtersettings', new admin_page_managefilters());
// "filtersettings" settingpage
$temp = new admin_settingpage('commonfiltersettings', new lang_string('commonfiltersettings', 'admin'));
if ($ADMIN->fulltree) {
$items = array();
$items[] = new admin_setting_configselect('filteruploadedfiles', new lang_string('filteruploadedfiles', 'admin'), new lang_string('configfilteruploadedfiles', 'admin'), 0,
array('0' => new lang_string('none'), '1' => new lang_string('allfiles'), '2' => new lang_string('htmlfilesonly')));
$items[] = new admin_setting_configcheckbox('filtermatchoneperpage', new lang_string('filtermatchoneperpage', 'admin'), new lang_string('configfiltermatchoneperpage', 'admin'), 0);
$items[] = new admin_setting_configcheckbox('filtermatchonepertext', new lang_string('filtermatchonepertext', 'admin'), new lang_string('configfiltermatchonepertext', 'admin'), 0);
$items[] = new admin_setting_configcheckbox('filternavigationwithsystemcontext',
new lang_string('filternavigationwithsystemcontext', 'admin'),
new lang_string('configfilternavigationwithsystemcontext', 'admin'), 0);
foreach ($items as $item) {
$item->set_updatedcallback('reset_text_filters_cache');
$temp->add($item);
}
}
$ADMIN->add('filtersettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('filter');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\filter $plugin */
$plugin->load_settings($ADMIN, 'filtersettings', $hassiteconfig);
}
// Media players.
$ADMIN->add('modules', new admin_category('mediaplayers', new lang_string('type_media_plural', 'plugin')));
$temp = new admin_settingpage('managemediaplayers', new lang_string('managemediaplayers', 'media'));
$temp->add(new admin_setting_heading('mediaformats', get_string('mediaformats', 'core_media'),
format_text(get_string('mediaformats_desc', 'core_media'), FORMAT_MARKDOWN)));
$temp->add(new \core_admin\admin\admin_setting_plugin_manager(
'media',
\core_admin\table\media_management_table::class,
'managemediaplayers',
new lang_string('managemediaplayers', 'core_media'),
));
$temp->add(new admin_setting_heading('managemediaplayerscommonheading', new lang_string('commonsettings', 'admin'), ''));
$temp->add(new admin_setting_configtext('media_default_width',
new lang_string('defaultwidth', 'core_media'), new lang_string('defaultwidthdesc', 'core_media'),
640, PARAM_INT, 10));
$temp->add(new admin_setting_configtext('media_default_height',
new lang_string('defaultheight', 'core_media'), new lang_string('defaultheightdesc', 'core_media'),
360, PARAM_INT, 10));
$ADMIN->add('mediaplayers', $temp);
// Convert plugins.
$ADMIN->add('modules', new admin_category('fileconverterplugins', new lang_string('type_fileconverter_plural', 'plugin')));
$temp = new admin_settingpage('managefileconverterplugins', new lang_string('type_fileconvertermanage', 'plugin'));
$temp->add(new admin_setting_manage_fileconverter_plugins());
$ADMIN->add('fileconverterplugins', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('fileconverter');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\media $plugin */
$plugin->load_settings($ADMIN, 'fileconverterplugins', $hassiteconfig);
}
$plugins = core_plugin_manager::instance()->get_plugins_of_type('media');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\media $plugin */
$plugin->load_settings($ADMIN, 'mediaplayers', $hassiteconfig);
}
// Payment gateway plugins.
$ADMIN->add('modules', new admin_category('paymentgateways', new lang_string('type_paygw_plural', 'plugin')));
$temp = new admin_settingpage('managepaymentgateways', new lang_string('type_paygwmanage', 'plugin'));
$temp->add(new \core_admin\local\settings\manage_payment_gateway_plugins());
$temp->add(new admin_setting_description(
'managepaymentgatewayspostfix',
'',
new lang_string('gotopaymentaccounts', 'payment',
html_writer::link(new moodle_url('/payment/accounts.php'), get_string('paymentaccounts', 'payment')))
));
$ADMIN->add('paymentgateways', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('paygw');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\paygw $plugin */
$plugin->load_settings($ADMIN, 'paymentgateways', $hassiteconfig);
}
// Data format settings.
$ADMIN->add('modules', new admin_category('dataformatsettings', new lang_string('dataformats')));
$temp = new admin_settingpage('managedataformats', new lang_string('managedataformats'));
$temp->add(new admin_setting_managedataformats());
$ADMIN->add('dataformatsettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('dataformat');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\dataformat $plugin */
$plugin->load_settings($ADMIN, 'dataformatsettings', $hassiteconfig);
}
//== Portfolio settings ==
require_once($CFG->libdir. '/portfoliolib.php');
$catname = new lang_string('portfolios', 'portfolio');
$manage = new lang_string('manageportfolios', 'portfolio');
$url = "$CFG->wwwroot/$CFG->admin/portfolio.php";
$ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios)));
// Add manage page (with table)
$temp = new admin_page_manageportfolios();
$ADMIN->add('portfoliosettings', $temp);
// Add common settings page
$temp = new admin_settingpage('manageportfolioscommon', new lang_string('commonportfoliosettings', 'portfolio'));
$temp->add(new admin_setting_heading('manageportfolioscommon', '', new lang_string('commonsettingsdesc', 'portfolio')));
$fileinfo = portfolio_filesize_info(); // make sure this is defined in one place since its used inside portfolio too to detect insane settings
$fileoptions = $fileinfo['options'];
$temp->add(new admin_setting_configselect(
'portfolio_moderate_filesize_threshold',
new lang_string('moderatefilesizethreshold', 'portfolio'),
new lang_string('moderatefilesizethresholddesc', 'portfolio'),
$fileinfo['moderate'], $fileoptions));
$temp->add(new admin_setting_configselect(
'portfolio_high_filesize_threshold',
new lang_string('highfilesizethreshold', 'portfolio'),
new lang_string('highfilesizethresholddesc', 'portfolio'),
$fileinfo['high'], $fileoptions));
$temp->add(new admin_setting_configtext(
'portfolio_moderate_db_threshold',
new lang_string('moderatedbsizethreshold', 'portfolio'),
new lang_string('moderatedbsizethresholddesc', 'portfolio'),
20, PARAM_INT, 3));
$temp->add(new admin_setting_configtext(
'portfolio_high_db_threshold',
new lang_string('highdbsizethreshold', 'portfolio'),
new lang_string('highdbsizethresholddesc', 'portfolio'),
50, PARAM_INT, 3));
$ADMIN->add('portfoliosettings', $temp);
$ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', new lang_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true));
$ADMIN->add('portfoliosettings', new admin_externalpage('portfoliodelete', new lang_string('deleteportfolio', 'portfolio'), $url, 'moodle/site:config', true));
$ADMIN->add('portfoliosettings', new admin_externalpage('portfoliocontroller', new lang_string('manageportfolios', 'portfolio'), $url, 'moodle/site:config', true));
foreach (portfolio_instances(false, false) as $portfolio) {
require_once($CFG->dirroot . '/portfolio/' . $portfolio->get('plugin') . '/lib.php');
$classname = 'portfolio_plugin_' . $portfolio->get('plugin');
$ADMIN->add(
'portfoliosettings',
new admin_externalpage(
'portfoliosettings' . $portfolio->get('id'),
$portfolio->get('name'),
$url . '?action=edit&pf=' . $portfolio->get('id'),
'moodle/site:config'
)
);
}
// repository setting
require_once("$CFG->dirroot/repository/lib.php");
$catname =new lang_string('repositories', 'repository');
$managerepo = new lang_string('manage', 'repository');
$url = $CFG->wwwroot.'/'.$CFG->admin.'/repository.php';
$ADMIN->add('modules', new admin_category('repositorysettings', $catname));
// Add main page (with table)
$temp = new admin_page_managerepositories();
$ADMIN->add('repositorysettings', $temp);
// Add common settings page
$temp = new admin_settingpage('managerepositoriescommon', new lang_string('commonrepositorysettings', 'repository'));
$temp->add(new admin_setting_configtext('repositorycacheexpire', new lang_string('cacheexpire', 'repository'), new lang_string('configcacheexpire', 'repository'), 120, PARAM_INT));
$temp->add(new admin_setting_configtext('repositorygetfiletimeout', new lang_string('getfiletimeout', 'repository'), new lang_string('configgetfiletimeout', 'repository'), 30, PARAM_INT));
$temp->add(new admin_setting_configtext('repositorysyncfiletimeout', new lang_string('syncfiletimeout', 'repository'), new lang_string('configsyncfiletimeout', 'repository'), 1, PARAM_INT));
$temp->add(new admin_setting_configtext('repositorysyncimagetimeout', new lang_string('syncimagetimeout', 'repository'), new lang_string('configsyncimagetimeout', 'repository'), 3, PARAM_INT));
$temp->add(new admin_setting_configcheckbox('repositoryallowexternallinks', new lang_string('allowexternallinks', 'repository'), new lang_string('configallowexternallinks', 'repository'), 1));
$temp->add(new admin_setting_configcheckbox('legacyfilesinnewcourses', new lang_string('legacyfilesinnewcourses', 'admin'), new lang_string('legacyfilesinnewcourses_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('legacyfilesaddallowed', new lang_string('legacyfilesaddallowed', 'admin'), new lang_string('legacyfilesaddallowed_help', 'admin'), 1));
$ADMIN->add('repositorysettings', $temp);
$ADMIN->add('repositorysettings', new admin_externalpage('repositorynew',
new lang_string('addplugin', 'repository'), $url, 'moodle/site:config', true));
$ADMIN->add('repositorysettings', new admin_externalpage('repositorydelete',
new lang_string('deleterepository', 'repository'), $url, 'moodle/site:config', true));
$ADMIN->add('repositorysettings', new admin_externalpage('repositorycontroller',
new lang_string('manage', 'repository'), $url, 'moodle/site:config', true));
$ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstancenew',
new lang_string('createrepository', 'repository'), $url, 'moodle/site:config', true));
$ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit',
new lang_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true));
$plugins = core_plugin_manager::instance()->get_plugins_of_type('repository');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\repository $plugin */
$plugin->load_settings($ADMIN, 'repositorysettings', $hassiteconfig);
}
}
// Question bank settings.
if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) {
$ADMIN->add('modules', new admin_category('qbanksettings',
new lang_string('type_qbank_plural', 'plugin')));
$temp = new admin_settingpage('manageqbanks', new lang_string('manageqbanks', 'admin'));
$temp->add(new \core_question\admin\manage_qbank_plugins_page());
$ADMIN->add('qbanksettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('qbank');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\qbank $plugin */
$plugin->load_settings($ADMIN, 'qbanksettings', $hassiteconfig);
}
}
// Question type settings
if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) {
// Question behaviour settings.
$ADMIN->add('modules', new admin_category('qbehavioursettings', new lang_string('questionbehaviours', 'admin')));
$ADMIN->add('qbehavioursettings', new admin_page_manageqbehaviours());
// Question type settings.
$ADMIN->add('modules', new admin_category('qtypesettings', new lang_string('questiontypes', 'admin')));
$ADMIN->add('qtypesettings', new admin_page_manageqtypes());
// Question preview defaults.
$settings = new admin_settingpage('qdefaultsetting',
get_string('questionpreviewdefaults', 'question'),
'moodle/question:config');
$ADMIN->add('qtypesettings', $settings);
$settings->add(new admin_setting_heading('qdefaultsetting_preview_options',
'', get_string('questionpreviewdefaults_desc', 'question')));
// These keys are question_display_options::HIDDEN and VISIBLE.
$hiddenofvisible = array(
0 => get_string('notshown', 'question'),
1 => get_string('shown', 'question'),
);
$settings->add(new admin_setting_question_behaviour('question_preview/behaviour',
get_string('howquestionsbehave', 'question'), '',
'deferredfeedback'));
$settings->add(new admin_setting_configselect('question_preview/correctness',
get_string('whethercorrect', 'question'), '', 1, $hiddenofvisible));
// These keys are question_display_options::HIDDEN, MARK_ONLY and MARK_AND_MAX.
$marksoptions = array(
0 => get_string('notshown', 'question'),
1 => get_string('showmaxmarkonly', 'question'),
2 => get_string('showmarkandmax', 'question'),
);
$settings->add(new admin_setting_configselect('question_preview/marks',
get_string('marks', 'question'), '', 2, $marksoptions));
$settings->add(new admin_setting_configselect('question_preview/markdp',
get_string('decimalplacesingrades', 'question'), '', 2, array(0, 1, 2, 3, 4, 5, 6, 7)));
$settings->add(new admin_setting_configselect('question_preview/feedback',
get_string('specificfeedback', 'question'), '', 1, $hiddenofvisible));
$settings->add(new admin_setting_configselect('question_preview/generalfeedback',
get_string('generalfeedback', 'question'), '', 1, $hiddenofvisible));
$settings->add(new admin_setting_configselect('question_preview/rightanswer',
get_string('rightanswer', 'question'), '', 1, $hiddenofvisible));
$settings->add(new admin_setting_configselect('question_preview/history',
get_string('responsehistory', 'question'), '', 0, $hiddenofvisible));
// Settings for particular question types.
$plugins = core_plugin_manager::instance()->get_plugins_of_type('qtype');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\qtype $plugin */
$plugin->load_settings($ADMIN, 'qtypesettings', $hassiteconfig);
}
}
// Plagiarism plugin settings
if ($hassiteconfig && !empty($CFG->enableplagiarism)) {
$ADMIN->add('modules', new admin_category('plagiarism', new lang_string('plagiarism', 'plagiarism')));
$ADMIN->add('plagiarism', new admin_externalpage('manageplagiarismplugins', new lang_string('manageplagiarism', 'plagiarism'),
$CFG->wwwroot . '/' . $CFG->admin . '/plagiarism.php'));
$plugins = core_plugin_manager::instance()->get_plugins_of_type('plagiarism');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\plagiarism $plugin */
$plugin->load_settings($ADMIN, 'plagiarism', $hassiteconfig);
}
}
// Comments report, note this page is really just a means to delete comments so check that.
$ADMIN->add('reports', new admin_externalpage('comments', new lang_string('comments'), $CFG->wwwroot . '/comment/index.php',
'moodle/comment:delete'));
// Course reports settings
if ($hassiteconfig) {
$pages = array();
foreach (core_component::get_plugin_list('coursereport') as $report => $path) {
$file = $CFG->dirroot . '/course/report/' . $report . '/settings.php';
if (file_exists($file)) {
$settings = new admin_settingpage('coursereport' . $report,
new lang_string('pluginname', 'coursereport_' . $report), 'moodle/site:config');
// settings.php may create a subcategory or unset the settings completely
include($file);
if ($settings) {
$pages[] = $settings;
}
}
}
if (!empty($pages)) {
$ADMIN->add('modules', new admin_category('coursereports', new lang_string('coursereports')));
core_collator::asort_objects_by_property($pages, 'visiblename');
foreach ($pages as $page) {
$ADMIN->add('coursereports', $page);
}
}
unset($pages);
}
// Now add reports
$pages = array();
foreach (core_component::get_plugin_list('report') as $report => $plugindir) {
$settings_path = "$plugindir/settings.php";
if (file_exists($settings_path)) {
$settings = new admin_settingpage('report' . $report,
new lang_string('pluginname', 'report_' . $report), 'moodle/site:config');
include($settings_path);
if ($settings) {
$pages[] = $settings;
}
}
}
$ADMIN->add('modules', new admin_category('reportplugins', new lang_string('reports')));
$ADMIN->add('reportplugins', new admin_externalpage('managereports', new lang_string('reportsmanage', 'admin'),
$CFG->wwwroot . '/' . $CFG->admin . '/reports.php'));
core_collator::asort_objects_by_property($pages, 'visiblename');
foreach ($pages as $page) {
$ADMIN->add('reportplugins', $page);
}
if ($hassiteconfig) {
// Global Search engine plugins.
$ADMIN->add('modules', new admin_category('searchplugins', new lang_string('search', 'admin')));
$temp = new admin_settingpage('manageglobalsearch', new lang_string('globalsearchmanage', 'admin'));
$pages = array();
$engines = array();
foreach (core_component::get_plugin_list('search') as $engine => $plugindir) {
$engines[$engine] = new lang_string('pluginname', 'search_' . $engine);
$settingspath = "$plugindir/settings.php";
if (file_exists($settingspath)) {
$settings = new admin_settingpage('search' . $engine,
new lang_string('pluginname', 'search_' . $engine), 'moodle/site:config');
include($settingspath);
if ($settings) {
$pages[] = $settings;
}
}
}
// Setup status.
$temp->add(new admin_setting_searchsetupinfo());
// Search engine selection.
$temp->add(new admin_setting_heading('searchengineheading', new lang_string('searchengine', 'admin'), ''));
$searchengineselect = new admin_setting_configselect('searchengine',
new lang_string('selectsearchengine', 'admin'), '', 'simpledb', $engines);
$searchengineselect->set_validate_function(function(string $value): string {
global $CFG;
// Check nobody's setting the indexing and query-only server to the same one.
if (isset($CFG->searchenginequeryonly) && $CFG->searchenginequeryonly === $value) {
return get_string('searchenginequeryonlysame', 'admin');
} else {
return '';
}
});
$temp->add($searchengineselect);
$temp->add(new admin_setting_heading('searchoptionsheading', new lang_string('searchoptions', 'admin'), ''));
$temp->add(new admin_setting_configcheckbox('searchindexwhendisabled',
new lang_string('searchindexwhendisabled', 'admin'), new lang_string('searchindexwhendisabled_desc', 'admin'),
0));
$temp->add(new admin_setting_configduration('searchindextime',
new lang_string('searchindextime', 'admin'), new lang_string('searchindextime_desc', 'admin'),
600));
$temp->add(new admin_setting_heading('searchcoursesheading', new lang_string('searchablecourses', 'admin'), ''));
$options = [
0 => new lang_string('searchallavailablecourses_off', 'admin'),
1 => new lang_string('searchallavailablecourses_on', 'admin')
];
$temp->add(new admin_setting_configselect('searchallavailablecourses',
new lang_string('searchallavailablecourses', 'admin'),
new lang_string('searchallavailablecoursesdesc', 'admin'),
0, $options));
$temp->add(new admin_setting_configcheckbox('searchincludeallcourses',
new lang_string('searchincludeallcourses', 'admin'), new lang_string('searchincludeallcourses_desc', 'admin'),
0));
// Search display options.
$temp->add(new admin_setting_heading('searchdisplay', new lang_string('searchdisplay', 'admin'), ''));
$temp->add(new admin_setting_configcheckbox('searchenablecategories',
new lang_string('searchenablecategories', 'admin'),
new lang_string('searchenablecategories_desc', 'admin'),
0));
$options = [];
foreach (\core_search\manager::get_search_area_categories() as $category) {
$options[$category->get_name()] = $category->get_visiblename();
}
$temp->add(new admin_setting_configselect('searchdefaultcategory',
new lang_string('searchdefaultcategory', 'admin'),
new lang_string('searchdefaultcategory_desc', 'admin'),
\core_search\manager::SEARCH_AREA_CATEGORY_ALL, $options));
$temp->add(new admin_setting_configcheckbox('searchhideallcategory',
new lang_string('searchhideallcategory', 'admin'),
new lang_string('searchhideallcategory_desc', 'admin'),
0));
// Top result options.
$temp->add(new admin_setting_heading('searchtopresults', new lang_string('searchtopresults', 'admin'), ''));
// Max Top results.
$options = range(0, 10);
$temp->add(new admin_setting_configselect('searchmaxtopresults',
new lang_string('searchmaxtopresults', 'admin'),
new lang_string('searchmaxtopresults_desc', 'admin'),
3, $options));
// Teacher roles.
$options = [];
foreach (role_get_names() as $role) {
$options[$role->id] = $role->localname;
}
$temp->add(new admin_setting_configmultiselect('searchteacherroles',
new lang_string('searchteacherroles', 'admin'),
new lang_string('searchteacherroles_desc', 'admin'),
[], $options));
$temp->add(new admin_setting_heading('searchmanagement', new lang_string('searchmanagement', 'admin'),
new lang_string('searchmanagement_desc', 'admin')));
// Get list of search engines including those with alternate settings.
$searchenginequeryonlyselect = new admin_setting_configselect('searchenginequeryonly',
new lang_string('searchenginequeryonly', 'admin'),
new lang_string('searchenginequeryonly_desc', 'admin'), '', function() use($engines) {
$options = ['' => new lang_string('searchenginequeryonly_none', 'admin')];
foreach ($engines as $name => $display) {
$options[$name] = $display;
$classname = '\search_' . $name . '\engine';
$engine = new $classname;
if ($engine->has_alternate_configuration()) {
$options[$name . '-alternate'] =
new lang_string('searchenginealternatesettings', 'admin', $display);
}
}
return $options;
});
$searchenginequeryonlyselect->set_validate_function(function(string $value): string {
global $CFG;
// Check nobody's setting the indexing and query-only server to the same one.
if (isset($CFG->searchengine) && $CFG->searchengine === $value) {
return get_string('searchenginequeryonlysame', 'admin');
} else {
return '';
}
});
$temp->add($searchenginequeryonlyselect);
$temp->add(new admin_setting_configcheckbox('searchbannerenable',
new lang_string('searchbannerenable', 'admin'), new lang_string('searchbannerenable_desc', 'admin'),
0));
$temp->add(new admin_setting_confightmleditor('searchbanner',
new lang_string('searchbanner', 'admin'), '', ''));
$ADMIN->add('searchplugins', $temp);
$ADMIN->add('searchplugins', new admin_externalpage('searchareas', new lang_string('searchareas', 'admin'),
new moodle_url('/admin/searchareas.php')));
core_collator::asort_objects_by_property($pages, 'visiblename');
foreach ($pages as $page) {
$ADMIN->add('searchplugins', $page);
}
}
/// Add all admin tools
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
$settingspage = new admin_settingpage('toolsmanagement', new lang_string('toolsmanage', 'admin'));
$ADMIN->add('tools', $settingspage);
$settingspage->add(new \core_admin\admin\admin_setting_plugin_manager(
'tool',
\core_admin\table\tool_plugin_management_table::class,
'managetools',
new lang_string('toolsmanage', 'admin')
));
}
// Now add various admin tools.
$plugins = core_plugin_manager::instance()->get_plugins_of_type('tool');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\tool $plugin */
$plugin->load_settings($ADMIN, null, $hassiteconfig);
}
// Now add the Cache plugins
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('cache', new lang_string('caching', 'cache')));
$ADMIN->add('cache', new admin_externalpage('cacheconfig', new lang_string('cacheconfig', 'cache'), $CFG->wwwroot .'/cache/admin.php'));
$ADMIN->add('cache', new admin_externalpage('cachetestperformance', new lang_string('testperformance', 'cache'), $CFG->wwwroot . '/cache/testperformance.php'));
$ADMIN->add('cache', new admin_externalpage('cacheusage',
new lang_string('cacheusage', 'cache'), $CFG->wwwroot . '/cache/usage.php'));
$ADMIN->add('cache', new admin_category('cachestores', new lang_string('cachestores', 'cache')));
$ADMIN->locate('cachestores')->set_sorting(true);
foreach (core_component::get_plugin_list('cachestore') as $plugin => $path) {
$settingspath = $path.'/settings.php';
if (file_exists($settingspath)) {
$settings = new admin_settingpage('cachestore_'.$plugin.'_settings', new lang_string('pluginname', 'cachestore_'.$plugin), 'moodle/site:config');
include($settingspath);
$ADMIN->add('cachestores', $settings);
}
}
}
// Add Calendar type settings.
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('calendartype', new lang_string('calendartypes', 'calendar')));
$plugins = core_plugin_manager::instance()->get_plugins_of_type('calendartype');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\calendartype $plugin */
$plugin->load_settings($ADMIN, 'calendartype', $hassiteconfig);
}
}
// Communication plugins.
if ($hassiteconfig && core_communication\api::is_available()) {
$ADMIN->add('modules', new admin_category('communicationsettings', new lang_string('communication', 'core_communication')));
$temp = new admin_settingpage('managecommunicationproviders',
new lang_string('managecommunicationproviders', 'core_communication'));
$temp->add(new \core_communication\admin\manage_communication_providers_page());
$ADMIN->add('communicationsettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('communication');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\communication $plugin */
$plugin->load_settings($ADMIN, 'communicationsettings', $hassiteconfig);
}
}
// Content bank content types.
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('contentbanksettings', new lang_string('contentbank')));
$temp = new admin_settingpage('managecontentbanktypes', new lang_string('managecontentbanktypes'));
$temp->add(new admin_setting_managecontentbankcontenttypes());
$ADMIN->add('contentbanksettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('contenttype');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\contentbank $plugin */
$plugin->load_settings($ADMIN, 'contentbanksettings', $hassiteconfig);
}
}
/// Add all local plugins - must be always last!
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins')));
$ADMIN->add('localplugins', new admin_externalpage('managelocalplugins', new lang_string('localpluginsmanage'),
$CFG->wwwroot . '/' . $CFG->admin . '/localplugins.php'));
}
// Extend settings for each local plugin. Note that their settings may be in any part of the
// settings tree and may be visible not only for administrators.
$plugins = core_plugin_manager::instance()->get_plugins_of_type('local');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\local $plugin */
$plugin->load_settings($ADMIN, null, $hassiteconfig);
}
+66
View File
@@ -0,0 +1,66 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Report builder related settings.
*
* @package core_reportbuilder
* @copyright 2021 David Matamoros <davidmc@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
declare(strict_types=1);
use core_admin\local\externalpage\accesscallback;
use core_reportbuilder\permission;
defined('MOODLE_INTERNAL') || die;
/** @var admin_root $ADMIN */
$ADMIN->add(
'reports', new admin_category(
'reportbuilder',
new lang_string('reportbuilder', 'core_reportbuilder'),
empty($CFG->enablecustomreports)
)
);
$ADMIN->add(
'reportbuilder', new accesscallback(
'customreports',
get_string('customreports', 'core_reportbuilder'),
(new moodle_url('/reportbuilder/index.php'))->out(),
static function(accesscallback $accesscallback): bool {
return permission::can_view_reports_list();
},
empty($CFG->enablecustomreports)
)
);
$settings = new admin_settingpage('reportbuildersettings', get_string('customreportssettings', 'core_reportbuilder'),
'moodle/site:config', empty($CFG->enablecustomreports));
$settings->add(new admin_setting_configtext(
'customreportslimit',
new lang_string('customreportslimit', 'core_reportbuilder'),
new lang_string('customreportslimit_desc', 'core_reportbuilder'), 0, PARAM_INT));
$settings->add(new admin_setting_configcheckbox(
'customreportsliveediting',
new lang_string('customreportsliveediting', 'core_reportbuilder'),
new lang_string('customreportsliveediting_desc', 'core_reportbuilder'), 1));
$ADMIN->add('reportbuilder', $settings);
+223
View File
@@ -0,0 +1,223 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Adds security related settings links for security category to admin tree.
*
* @copyright 1999 Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
use core_admin\local\settings\filesize;
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
// "ip blocker" settingpage
$temp = new admin_settingpage('ipblocker', new lang_string('ipblocker', 'admin'));
$temp->add(new admin_setting_configcheckbox('allowbeforeblock', new lang_string('allowbeforeblock', 'admin'), new lang_string('allowbeforeblockdesc', 'admin'), 0));
$temp->add(new admin_setting_configiplist('allowedip', new lang_string('allowediplist', 'admin'),
new lang_string('ipblockersyntax', 'admin'), ''));
$temp->add(new admin_setting_configiplist('blockedip', new lang_string('blockediplist', 'admin'),
new lang_string('ipblockersyntax', 'admin'), ''));
$ADMIN->add('security', $temp);
// "sitepolicies" settingpage
$temp = new admin_settingpage('sitepolicies', new lang_string('sitepolicies', 'admin'));
$temp->add(new admin_setting_configcheckbox('protectusernames', new lang_string('protectusernames', 'admin'), new lang_string('configprotectusernames', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('forcelogin', new lang_string('forcelogin', 'admin'), new lang_string('configforcelogin', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', new lang_string('forceloginforprofiles', 'admin'), new lang_string('configforceloginforprofiles', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', new lang_string('forceloginforprofileimage', 'admin'), new lang_string('forceloginforprofileimage_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('opentowebcrawlers', new lang_string('opentowebcrawlers', 'admin'), new lang_string('configopentowebcrawlers', 'admin'), 0));
$temp->add(new admin_setting_configselect('allowindexing', new lang_string('allowindexing', 'admin'), new lang_string('allowindexing_desc', 'admin'),
0,
array(0 => new lang_string('allowindexingexceptlogin', 'admin'),
1 => new lang_string('allowindexingeverywhere', 'admin'),
2 => new lang_string('allowindexingnowhere', 'admin'))));
$temp->add(new admin_setting_pickroles('profileroles',
new lang_string('profileroles','admin'),
new lang_string('configprofileroles', 'admin'),
array('student', 'teacher', 'editingteacher')));
$maxbytes = 0;
if (!empty($CFG->maxbytes)) {
$maxbytes = $CFG->maxbytes;
}
$max_upload_choices = get_max_upload_sizes(0, 0, 0, $maxbytes);
// maxbytes set to 0 will allow the maximum server limit for uploads
$temp->add(new admin_setting_configselect('maxbytes', new lang_string('maxbytes', 'admin'), new lang_string('configmaxbytes', 'admin'), 0, $max_upload_choices));
// 100MB
$defaultuserquota = 100 * filesize::UNIT_MB;
$temp->add(new filesize('userquota', new lang_string('userquota', 'admin'),
new lang_string('userquota_desc', 'admin'), $defaultuserquota));
$temp->add(new admin_setting_configcheckbox('allowobjectembed', new lang_string('allowobjectembed', 'admin'), new lang_string('configallowobjectembed', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('enabletrusttext', new lang_string('enabletrusttext', 'admin'), new lang_string('configenabletrusttext', 'admin'), 0));
$temp->add(new admin_setting_configselect('maxeditingtime', new lang_string('maxeditingtime','admin'), new lang_string('configmaxeditingtime','admin'), 1800,
array(60 => new lang_string('numminutes', '', 1),
300 => new lang_string('numminutes', '', 5),
900 => new lang_string('numminutes', '', 15),
1800 => new lang_string('numminutes', '', 30),
2700 => new lang_string('numminutes', '', 45),
3600 => new lang_string('numminutes', '', 60))));
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', new lang_string('extendedusernamechars', 'admin'), new lang_string('configextendedusernamechars', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', new lang_string('extendedusernamechars', 'admin'), new lang_string('configextendedusernamechars', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('keeptagnamecase', new lang_string('keeptagnamecase','admin'),new lang_string('configkeeptagnamecase', 'admin'),'1'));
$temp->add(new admin_setting_configcheckbox('profilesforenrolledusersonly', new lang_string('profilesforenrolledusersonly','admin'),new lang_string('configprofilesforenrolledusersonly', 'admin'),'1'));
$temp->add(new admin_setting_configcheckbox('cronclionly', new lang_string('cronclionly', 'admin'), new lang_string
('configcronclionly', 'admin'), 1));
$temp->add(new admin_setting_configpasswordunmask('cronremotepassword', new lang_string('cronremotepassword', 'admin'), new lang_string('configcronremotepassword', 'admin'), ''));
$temp->add(new admin_setting_configcheckbox('tool_task/enablerunnow', new lang_string('enablerunnow', 'tool_task'),
new lang_string('enablerunnow_desc', 'tool_task'), 1));
$options = array(0=>get_string('no'), 3=>3, 5=>5, 7=>7, 10=>10, 20=>20, 30=>30, 50=>50, 100=>100);
$temp->add(new admin_setting_configselect('lockoutthreshold', new lang_string('lockoutthreshold', 'admin'), new lang_string('lockoutthreshold_desc', 'admin'), 0, $options));
$temp->add(new admin_setting_configduration('lockoutwindow', new lang_string('lockoutwindow', 'admin'), new lang_string('lockoutwindow_desc', 'admin'), 60*30));
$temp->add(new admin_setting_configduration('lockoutduration', new lang_string('lockoutduration', 'admin'), new lang_string('lockoutduration_desc', 'admin'), 60*30));
$temp->add(new admin_setting_configcheckbox('passwordpolicy', new lang_string('passwordpolicy', 'admin'), new lang_string('configpasswordpolicy', 'admin'), 1));
$temp->add(new admin_setting_configtext('minpasswordlength', new lang_string('minpasswordlength', 'admin'), new lang_string('configminpasswordlength', 'admin'), 8, PARAM_INT));
$temp->add(new admin_setting_configtext('minpassworddigits', new lang_string('minpassworddigits', 'admin'), new lang_string('configminpassworddigits', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_configtext('minpasswordlower', new lang_string('minpasswordlower', 'admin'), new lang_string('configminpasswordlower', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_configtext('minpasswordupper', new lang_string('minpasswordupper', 'admin'), new lang_string('configminpasswordupper', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_configtext('minpasswordnonalphanum', new lang_string('minpasswordnonalphanum', 'admin'), new lang_string('configminpasswordnonalphanum', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_configtext('maxconsecutiveidentchars', new lang_string('maxconsecutiveidentchars', 'admin'), new lang_string('configmaxconsecutiveidentchars', 'admin'), 0, PARAM_INT));
$temp->add(new admin_setting_configcheckbox('passwordpolicycheckonlogin',
new lang_string('passwordpolicycheckonlogin', 'admin'),
new lang_string('configpasswordpolicycheckonlogin', 'admin'), 0));
$temp->add(new admin_setting_configtext('passwordreuselimit',
new lang_string('passwordreuselimit', 'admin'),
new lang_string('passwordreuselimit_desc', 'admin'), 0, PARAM_INT));
$pwresetoptions = array(
300 => new lang_string('numminutes', '', 5),
900 => new lang_string('numminutes', '', 15),
1800 => new lang_string('numminutes', '', 30),
2700 => new lang_string('numminutes', '', 45),
3600 => new lang_string('numminutes', '', 60),
7200 => new lang_string('numminutes', '', 120),
14400 => new lang_string('numminutes', '', 240)
);
$adminsetting = new admin_setting_configselect(
'pwresettime',
new lang_string('passwordresettime','admin'),
new lang_string('configpasswordresettime','admin'),
1800,
$pwresetoptions);
$temp->add($adminsetting);
$temp->add(new admin_setting_configcheckbox('passwordchangelogout',
new lang_string('passwordchangelogout', 'admin'),
new lang_string('passwordchangelogout_desc', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('passwordchangetokendeletion',
new lang_string('passwordchangetokendeletion', 'admin'),
new lang_string('passwordchangetokendeletion_desc', 'admin'), 0));
$temp->add(new admin_setting_configduration('tokenduration',
new lang_string('tokenduration', 'admin'),
new lang_string('tokenduration_desc', 'admin'), 12 * WEEKSECS, WEEKSECS));
$temp->add(new admin_setting_configcheckbox('groupenrolmentkeypolicy', new lang_string('groupenrolmentkeypolicy', 'admin'), new lang_string('groupenrolmentkeypolicy_desc', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('disableuserimages', new lang_string('disableuserimages', 'admin'), new lang_string('configdisableuserimages', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', new lang_string('emailchangeconfirmation', 'admin'), new lang_string('configemailchangeconfirmation', 'admin'), 1));
$temp->add(new admin_setting_configselect('rememberusername', new lang_string('rememberusername','admin'), new lang_string('rememberusername_desc','admin'), 2, array(1=>new lang_string('yes'), 0=>new lang_string('no'), 2=>new lang_string('optional'))));
$temp->add(new admin_setting_configcheckbox('strictformsrequired', new lang_string('strictformsrequired', 'admin'), new lang_string('configstrictformsrequired', 'admin'), 0));
$temp->add(new admin_setting_heading('adminpresets', new lang_string('siteadminpresetspluginname', 'core_adminpresets'), ''));
$sensiblesettingsdefault = 'recaptchapublickey@@none, recaptchaprivatekey@@none, googlemapkey3@@none, ';
$sensiblesettingsdefault .= 'secretphrase@@url, cronremotepassword@@none, smtpuser@@none, ';
$sensiblesettingsdefault .= 'smtppass@@none, proxypassword@@none, quizpassword@@quiz, allowedip@@none, blockedip@@none, ';
$sensiblesettingsdefault .= 'dbpass@@logstore_database, messageinbound_hostpass@@none, ';
$sensiblesettingsdefault .= 'bind_pw@@auth_cas, pass@@auth_db, bind_pw@@auth_ldap, ';
$sensiblesettingsdefault .= 'dbpass@@enrol_database, bind_pw@@enrol_ldap, ';
$sensiblesettingsdefault .= 'server_password@@search_solr, ssl_keypassword@@search_solr, ';
$sensiblesettingsdefault .= 'alternateserver_password@@search_solr, alternatessl_keypassword@@search_solr, ';
$sensiblesettingsdefault .= 'test_password@@cachestore_redis, password@@mlbackend_python, ';
$sensiblesettingsdefault .= 'badges_badgesalt@@none, calendar_exportsalt@@none, ';
$sensiblesettingsdefault .= 'bigbluebuttonbn_shared_secret@@none, apikey@@tiny_premium, ';
$sensiblesettingsdefault .= 'matrixaccesstoken@@communication_matrix, api_secret@@factor_sms';
$temp->add(new admin_setting_configtextarea('adminpresets/sensiblesettings',
get_string('sensiblesettings', 'core_adminpresets'),
get_string('sensiblesettingstext', 'core_adminpresets'),
$sensiblesettingsdefault, PARAM_TEXT));
$ADMIN->add('security', $temp);
// "httpsecurity" settingpage
$temp = new admin_settingpage('httpsecurity', new lang_string('httpsecurity', 'admin'));
$temp->add(new admin_setting_configcheckbox('cookiesecure', new lang_string('cookiesecure', 'admin'), new lang_string('configcookiesecure', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('allowframembedding', new lang_string('allowframembedding', 'admin'), new lang_string('allowframembedding_help', 'admin'), 0));
// Settings elements used by the \core\files\curl_security_helper class.
$blockedhostsdefault = [
'127.0.0.0/8',
'192.168.0.0/16',
'10.0.0.0/8',
'172.16.0.0/12',
'0.0.0.0',
'localhost',
'169.254.169.254',
'0000::1',
];
$allowedportsdefault = ['443', '80'];
// By default, block various common internal network or cloud provider hosts.
$temp->add(new admin_setting_configmixedhostiplist('curlsecurityblockedhosts',
new lang_string('curlsecurityblockedhosts', 'admin'),
new lang_string('curlsecurityblockedhostssyntax', 'admin'), implode(PHP_EOL, $blockedhostsdefault)));
// By default, only allow web ports.
$temp->add(new admin_setting_configportlist('curlsecurityallowedport',
new lang_string('curlsecurityallowedport', 'admin'),
new lang_string('curlsecurityallowedportsyntax', 'admin'), implode(PHP_EOL, $allowedportsdefault)));
// HTTP Header referrer policy settings.
$referreroptions = [
'default' => get_string('referrernone', 'admin'),
'no-referrer' => 'no-referrer',
'no-referrer-when-downgrade' => 'no-referrer-when-downgrade',
'origin' => 'origin',
'origin-when-cross-origin' => 'origin-when-cross-origin',
'same-origin' => 'same-origin',
'strict-origin' => 'strict-origin',
'strict-origin-when-cross-origin' => 'strict-origin-when-cross-origin',
'unsafe-url' => 'unsafe-url',
];
$temp->add(new admin_setting_configselect('referrerpolicy',
new lang_string('referrerpolicy', 'admin'),
new lang_string('referrerpolicydesc', 'admin'), 'default', $referreroptions));
$ADMIN->add('security', $temp);
// "notifications" settingpage
$temp = new admin_settingpage('notifications', new lang_string('notifications', 'admin'));
$temp->add(new admin_setting_configcheckbox('displayloginfailures', new lang_string('displayloginfailures', 'admin'),
new lang_string('configdisplayloginfailures', 'admin'), 0));
$temp->add(new admin_setting_users_with_capability('notifyloginfailures', new lang_string('notifyloginfailures', 'admin'), new lang_string('confignotifyloginfailures', 'admin'), array(), 'moodle/site:config'));
$options = array();
for ($i = 1; $i <= 100; $i++) {
$options[$i] = $i;
}
$temp->add(new admin_setting_configselect('notifyloginthreshold', new lang_string('notifyloginthreshold', 'admin'), new lang_string('confignotifyloginthreshold', 'admin'), '10', $options));
$ADMIN->add('security', $temp);
} // end of speedup
+695
View File
@@ -0,0 +1,695 @@
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Defines settingpages and externalpages under the "server" category.
*
* @package core
* @category admin
* @copyright 2006 Martin Dougiamas
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
// System paths.
$temp = new admin_settingpage('systempaths', new lang_string('systempaths', 'admin'));
$temp->add(new admin_setting_configexecutable('pathtophp', new lang_string('pathtophp', 'admin'),
new lang_string('configpathtophp', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('pathtodu', new lang_string('pathtodu', 'admin'),
new lang_string('configpathtodu', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('aspellpath', new lang_string('aspellpath', 'admin'),
new lang_string('edhelpaspellpath'), ''));
$temp->add(new admin_setting_configexecutable('pathtodot', new lang_string('pathtodot', 'admin'),
new lang_string('pathtodot_help', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('pathtogs', new lang_string('pathtogs', 'admin'),
new lang_string('pathtogs_help', 'admin'), '/usr/bin/gs'));
$temp->add(new admin_setting_configexecutable('pathtopdftoppm', new lang_string('pathtopdftoppm', 'admin'),
new lang_string('pathtopdftoppm_help', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('pathtopython', new lang_string('pathtopython', 'admin'),
new lang_string('pathtopythondesc', 'admin'), ''));
$ADMIN->add('server', $temp);
// Support contact.
$temp = new admin_settingpage('supportcontact', new lang_string('supportcontact', 'admin'));
$primaryadmin = get_admin();
if ($primaryadmin) {
$primaryadminname = fullname($primaryadmin, true);
} else {
// No defaults during installation - admin user must be created first.
$primaryadminname = null;
}
$temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'),
new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
$setting = new admin_setting_requiredtext('supportemail', new lang_string('supportemail', 'admin'),
new lang_string('configsupportemail', 'admin'), null, PARAM_EMAIL);
$setting->set_force_ltr(true);
$temp->add($setting);
$temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'),
new lang_string('configsupportpage', 'admin'), '', PARAM_URL));
$temp->add(new admin_setting_configselect('supportavailability', new lang_string('supportavailability', 'admin'),
new lang_string('configsupportavailability', 'admin'), CONTACT_SUPPORT_AUTHENTICATED,
[
CONTACT_SUPPORT_ANYONE => new lang_string('availabletoanyone', 'admin'),
CONTACT_SUPPORT_AUTHENTICATED => new lang_string('availabletoauthenticated', 'admin'),
CONTACT_SUPPORT_DISABLED => new lang_string('disabled', 'admin'),
]
));
$temp->add(new admin_setting_configtext('servicespage', new lang_string('servicespage', 'admin'),
new lang_string('configservicespage', 'admin'), '', PARAM_URL));
$ADMIN->add('server', $temp);
// Session handling.
$temp = new admin_settingpage('sessionhandling', new lang_string('sessionhandling', 'admin'));
if (empty($CFG->session_handler_class) and $DB->session_lock_supported()) {
$temp->add(new admin_setting_configcheckbox('dbsessions', new lang_string('dbsessions', 'admin'),
new lang_string('configdbsessions', 'admin'), 0));
}
$temp->add(new admin_setting_configduration('sessiontimeout', new lang_string('sessiontimeout', 'admin'),
new lang_string('configsessiontimeout', 'admin'), 8 * 60 * 60));
$sessiontimeoutwarning = new admin_setting_configduration('sessiontimeoutwarning',
new lang_string('sessiontimeoutwarning', 'admin'),
new lang_string('configsessiontimeoutwarning', 'admin'), 20 * 60);
$sessiontimeoutwarning->set_validate_function(function(int $value): string {
global $CFG;
// Check sessiontimeoutwarning is less than sessiontimeout.
if ($CFG->sessiontimeout <= $value) {
return get_string('configsessiontimeoutwarningcheck', 'admin');
} else {
return '';
}
});
$temp->add($sessiontimeoutwarning);
$temp->add(new admin_setting_configtext('sessioncookie', new lang_string('sessioncookie', 'admin'),
new lang_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM));
$temp->add(new admin_setting_configtext('sessioncookiepath', new lang_string('sessioncookiepath', 'admin'),
new lang_string('configsessioncookiepath', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtext('sessioncookiedomain', new lang_string('sessioncookiedomain', 'admin'),
new lang_string('configsessioncookiedomain', 'admin'), '', PARAM_RAW, 50));
$ADMIN->add('server', $temp);
// Statistics.
$temp = new admin_settingpage('stats', new lang_string('stats'), 'moodle/site:config', empty($CFG->enablestats));
$temp->add(new admin_setting_configselect('statsfirstrun', new lang_string('statsfirstrun', 'admin'),
new lang_string('configstatsfirstrun', 'admin'), 'none',
[
'none' => new lang_string('none'),
60 * 60 * 24 * 7 => new lang_string('numweeks', 'moodle', 1),
60 * 60 * 24 * 14 => new lang_string('numweeks', 'moodle', 2),
60 * 60 * 24 * 21 => new lang_string('numweeks', 'moodle', 3),
60 * 60 * 24 * 28 => new lang_string('nummonths', 'moodle', 1),
60 * 60 * 24 * 56 => new lang_string('nummonths', 'moodle', 2),
60 * 60 * 24 * 84 => new lang_string('nummonths', 'moodle', 3),
60 * 60 * 24 * 112 => new lang_string('nummonths', 'moodle', 4),
60 * 60 * 24 * 140 => new lang_string('nummonths', 'moodle', 5),
60 * 60 * 24 * 168 => new lang_string('nummonths', 'moodle', 6),
'all' => new lang_string('all')
]
));
$temp->add(new admin_setting_configselect('statsmaxruntime', new lang_string('statsmaxruntime', 'admin'),
new lang_string('configstatsmaxruntime3', 'admin'), 0,
[
0 => new lang_string('untilcomplete'),
60 * 30 => '10 ' . new lang_string('minutes'),
60 * 30 => '30 ' . new lang_string('minutes'),
60 * 60 => '1 ' . new lang_string('hour'),
60 * 60 * 2 => '2 ' . new lang_string('hours'),
60 * 60 * 3 => '3 ' . new lang_string('hours'),
60 * 60 * 4 => '4 ' . new lang_string('hours'),
60 * 60 * 5 => '5 ' . new lang_string('hours'),
60 * 60 * 6 => '6 ' . new lang_string('hours'),
60 * 60 * 7 => '7 ' . new lang_string('hours'),
60 * 60 * 8 => '8 ' . new lang_string('hours'),
]
));
$temp->add(new admin_setting_configtext('statsruntimedays', new lang_string('statsruntimedays', 'admin'),
new lang_string('configstatsruntimedays', 'admin'), 31, PARAM_INT));
$temp->add(new admin_setting_configtext('statsuserthreshold', new lang_string('statsuserthreshold', 'admin'),
new lang_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
$ADMIN->add('server', $temp);
// HTTP.
$temp = new admin_settingpage('http', new lang_string('http', 'admin'));
$temp->add(new admin_setting_configcheckbox('slasharguments', new lang_string('slasharguments', 'admin'),
new lang_string('configslasharguments', 'admin'), 1));
$temp->add(new admin_setting_heading('reverseproxy', new lang_string('reverseproxy', 'admin'), '', ''));
$options = [
0 => 'HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR | GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR'
];
$temp->add(new admin_setting_configselect('getremoteaddrconf', new lang_string('getremoteaddrconf', 'admin'),
new lang_string('configgetremoteaddrconf', 'admin'),
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR | GETREMOTEADDR_SKIP_HTTP_CLIENT_IP, $options));
$temp->add(new admin_setting_configtext('reverseproxyignore', new lang_string('reverseproxyignore', 'admin'),
new lang_string('configreverseproxyignore', 'admin'), ''));
$temp->add(new admin_setting_heading('webproxy', new lang_string('webproxy', 'admin'),
new lang_string('webproxyinfo', 'admin')));
$temp->add(new admin_setting_configtext('proxyhost', new lang_string('proxyhost', 'admin'),
new lang_string('configproxyhost', 'admin'), '', PARAM_HOST));
$temp->add(new admin_setting_configtext('proxyport', new lang_string('proxyport', 'admin'),
new lang_string('configproxyport', 'admin'), 0, PARAM_INT));
$options = ['HTTP' => 'HTTP'];
if (defined('CURLPROXY_SOCKS5')) {
$options['SOCKS5'] = 'SOCKS5';
}
$temp->add(new admin_setting_configselect('proxytype', new lang_string('proxytype', 'admin'),
new lang_string('configproxytype', 'admin'), 'HTTP', $options));
$temp->add(new admin_setting_configtext('proxyuser', new lang_string('proxyuser', 'admin'),
new lang_string('configproxyuser', 'admin'), ''));
$temp->add(new admin_setting_configpasswordunmask('proxypassword', new lang_string('proxypassword', 'admin'),
new lang_string('configproxypassword', 'admin'), ''));
$temp->add(new admin_setting_configtext('proxybypass', new lang_string('proxybypass', 'admin'),
new lang_string('configproxybypass', 'admin'), 'localhost, 127.0.0.1'));
$temp->add(new admin_setting_configcheckbox('proxylogunsafe', new lang_string('proxylogunsafe', 'admin'),
new lang_string('configproxylogunsafe_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('proxyfixunsafe', new lang_string('proxyfixunsafe', 'admin'),
new lang_string('configproxyfixunsafe_help', 'admin'), 0));
$ADMIN->add('server', $temp);
$temp = new admin_settingpage('maintenancemode', new lang_string('sitemaintenancemode', 'admin'));
$options = [0 => new lang_string('disable'), 1 => new lang_string('enable')];
$temp->add(new admin_setting_configselect('maintenance_enabled', new lang_string('sitemaintenancemode', 'admin'),
new lang_string('helpsitemaintenance', 'admin'), 0, $options));
$temp->add(new admin_setting_confightmleditor('maintenance_message', new lang_string('optionalmaintenancemessage', 'admin'),
'', ''));
$ADMIN->add('server', $temp);
// Cleanup.
$temp = new admin_settingpage('cleanup', new lang_string('cleanup', 'admin'));
$temp->add(new admin_setting_configselect('deleteunconfirmed', new lang_string('deleteunconfirmed', 'admin'),
new lang_string('configdeleteunconfirmed', 'admin'), 168,
[
0 => new lang_string('never'),
168 => new lang_string('numdays', '', 7),
144 => new lang_string('numdays', '', 6),
120 => new lang_string('numdays', '', 5),
96 => new lang_string('numdays', '', 4),
72 => new lang_string('numdays', '', 3),
48 => new lang_string('numdays', '', 2),
24 => new lang_string('numdays', '', 1),
12 => new lang_string('numhours', '', 12),
6 => new lang_string('numhours', '', 6),
1 => new lang_string('numhours', '', 1),
]
));
$temp->add(new admin_setting_configselect('deleteincompleteusers', new lang_string('deleteincompleteusers', 'admin'),
new lang_string('configdeleteincompleteusers', 'admin'), 0,
[
0 => new lang_string('never'),
168 => new lang_string('numdays', '', 7),
144 => new lang_string('numdays', '', 6),
120 => new lang_string('numdays', '', 5),
96 => new lang_string('numdays', '', 4),
72 => new lang_string('numdays', '', 3),
48 => new lang_string('numdays', '', 2),
24 => new lang_string('numdays', '', 1),
]
));
$temp->add(new admin_setting_configcheckbox('disablegradehistory', new lang_string('disablegradehistory', 'grades'),
new lang_string('disablegradehistory_help', 'grades'), 0));
$temp->add(new admin_setting_configselect('gradehistorylifetime', new lang_string('gradehistorylifetime', 'grades'),
new lang_string('gradehistorylifetime_help', 'grades'), 0,
[
0 => new lang_string('neverdeletehistory', 'grades'),
1000 => new lang_string('numdays', '', 1000),
365 => new lang_string('numdays', '', 365),
180 => new lang_string('numdays', '', 180),
150 => new lang_string('numdays', '', 150),
120 => new lang_string('numdays', '', 120),
90 => new lang_string('numdays', '', 90),
60 => new lang_string('numdays', '', 60),
30 => new lang_string('numdays', '', 30),
]
));
$temp->add(new admin_setting_configselect('tempdatafoldercleanup', new lang_string('tempdatafoldercleanup', 'admin'),
new lang_string('configtempdatafoldercleanup', 'admin'), 168,
[
1 => new lang_string('numhours', '', 1),
3 => new lang_string('numhours', '', 3),
6 => new lang_string('numhours', '', 6),
9 => new lang_string('numhours', '', 9),
12 => new lang_string('numhours', '', 12),
18 => new lang_string('numhours', '', 18),
24 => new lang_string('numhours', '', 24),
48 => new lang_string('numdays', '', 2),
168 => new lang_string('numdays', '', 7),
]
));
$temp->add(new admin_setting_configduration(
'xapicleanupperiod',
new lang_string('xapicleanupperiod', 'xapi'),
new lang_string('xapicleanupperiod_help', 'xapi'),
WEEKSECS * 8,
WEEKSECS
));
$ADMIN->add('server', $temp);
$temp->add(new admin_setting_configduration('filescleanupperiod',
new lang_string('filescleanupperiod', 'admin'),
new lang_string('filescleanupperiod_help', 'admin'),
86400));
// Environment.
$ADMIN->add('server', new admin_externalpage('environment', new lang_string('environment', 'admin'),
"{$CFG->wwwroot}/{$CFG->admin}/environment.php"));
// PHP info.
$ADMIN->add('server', new admin_externalpage('phpinfo', new lang_string('phpinfo'),
"{$CFG->wwwroot}/{$CFG->admin}/phpinfo.php"));
// Test outgoing mail configuration (hidden, accessed via direct link from the settings page).
$ADMIN->add('server', new admin_externalpage('testoutgoingmailconf', new lang_string('testoutgoingmailconf', 'admin'),
new moodle_url('/admin/testoutgoingmailconf.php'), 'moodle/site:config', true));
// Performance.
$temp = new admin_settingpage('performance', new lang_string('performance', 'admin'));
// Memory limit options for large administration tasks.
$memoryoptions = [
'64M' => '64M',
'128M' => '128M',
'256M' => '256M',
'512M' => '512M',
'1024M' => '1024M',
'2048M' => '2048M',
];
// Allow larger memory usage for 64-bit sites only.
if (PHP_INT_SIZE === 8) {
$memoryoptions['3072M'] = '3072M';
$memoryoptions['4096M'] = '4096M';
}
$temp->add(new admin_setting_configselect('extramemorylimit', new lang_string('extramemorylimit', 'admin'),
new lang_string('configextramemorylimit', 'admin'), '512M', $memoryoptions));
$temp->add(new admin_setting_configtext('maxtimelimit', new lang_string('maxtimelimit', 'admin'),
new lang_string('maxtimelimit_desc', 'admin'), 0, PARAM_INT));
$temp->add(new admin_setting_configtext('curlcache', new lang_string('curlcache', 'admin'),
new lang_string('configcurlcache', 'admin'), 120, PARAM_INT));
$temp->add(new admin_setting_configtext('curltimeoutkbitrate', new lang_string('curltimeoutkbitrate', 'admin'),
new lang_string('curltimeoutkbitrate_help', 'admin'), 56, PARAM_INT));
$ADMIN->add('server', $temp);
// Tasks.
$ADMIN->add('server', new admin_category('taskconfig', new lang_string('taskadmintitle', 'admin')));
// Task processing.
$temp = new admin_settingpage('taskprocessing', new lang_string('taskprocessing', 'admin'));
$setting = new admin_setting_configcheckbox(
'cron_enabled',
new lang_string('cron_enabled', 'admin'),
new lang_string('cron_enabled_desc', 'admin'),
1
);
$setting->set_updatedcallback('theme_reset_static_caches');
$temp->add($setting);
$setting = new admin_setting_configduration(
'cron_keepalive',
new lang_string('cron_keepalive', 'admin'),
new lang_string('cron_keepalive_desc', 'admin'),
\core\cron::DEFAULT_MAIN_PROCESS_KEEPALIVE,
// The default unit is minutes.
MINSECS,
);
// Set an upper limit.
$setting->set_max_duration(\core\cron::MAX_MAIN_PROCESS_KEEPALIVE);
$temp->add($setting);
$temp->add(
new admin_setting_configtext(
'task_scheduled_concurrency_limit',
new lang_string('task_scheduled_concurrency_limit', 'admin'),
new lang_string('task_scheduled_concurrency_limit_desc', 'admin'),
3,
PARAM_INT
)
);
$temp->add(
new admin_setting_configduration(
'task_scheduled_max_runtime',
new lang_string('task_scheduled_max_runtime', 'admin'),
new lang_string('task_scheduled_max_runtime_desc', 'admin'),
30 * MINSECS
)
);
$temp->add(
new admin_setting_configtext(
'task_adhoc_concurrency_limit',
new lang_string('task_adhoc_concurrency_limit', 'admin'),
new lang_string('task_adhoc_concurrency_limit_desc', 'admin'),
3,
PARAM_INT
)
);
$temp->add(
new admin_setting_configduration(
'task_adhoc_max_runtime',
new lang_string('task_adhoc_max_runtime', 'admin'),
new lang_string('task_adhoc_max_runtime_desc', 'admin'),
30 * MINSECS
)
);
$temp->add(
new admin_setting_configduration(
'task_adhoc_failed_retention',
new lang_string('task_adhoc_failed_retention', 'admin'),
new lang_string('task_adhoc_failed_retention_desc', 'admin'),
\core\task\manager::ADHOC_TASK_FAILED_RETENTION,
WEEKSECS
)
);
$ADMIN->add('taskconfig', $temp);
// Task log configuration.
$temp = new admin_settingpage('tasklogging', new lang_string('tasklogging', 'admin'));
$temp->add(
new admin_setting_configselect(
'task_logmode',
new lang_string('task_logmode', 'admin'),
new lang_string('task_logmode_desc', 'admin'),
\core\task\logmanager::MODE_ALL,
[
\core\task\logmanager::MODE_ALL => new lang_string('task_logmode_all', 'admin'),
\core\task\logmanager::MODE_FAILONLY => new lang_string('task_logmode_failonly', 'admin'),
\core\task\logmanager::MODE_NONE => new lang_string('task_logmode_none', 'admin'),
]
)
);
$temp->add(
new admin_setting_configcheckbox(
'task_logtostdout',
new lang_string('task_logtostdout', 'admin'),
new lang_string('task_logtostdout_desc', 'admin'),
1
)
);
if (\core\task\logmanager::uses_standard_settings()) {
$temp->add(
new admin_setting_configduration(
'task_logretention',
new \lang_string('task_logretention', 'admin'),
new \lang_string('task_logretention_desc', 'admin'),
28 * DAYSECS
)
);
$temp->add(
new admin_setting_configtext(
'task_logretainruns',
new \lang_string('task_logretainruns', 'admin'),
new \lang_string('task_logretainruns_desc', 'admin'),
20,
PARAM_INT
)
);
}
$ADMIN->add('taskconfig', $temp);
// Task logs.
if (\core\task\logmanager::uses_standard_settings()) {
$ADMIN->add('taskconfig', new admin_externalpage(
'tasklogs',
new lang_string('tasklogs', 'admin'),
"{$CFG->wwwroot}/{$CFG->admin}/tasklogs.php"
));
}
// Email.
$ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
// Outgoing mail configuration.
$temp = new admin_settingpage('outgoingmailconfig', new lang_string('outgoingmailconfig', 'admin'));
if (!empty($CFG->noemailever)) {
$noemaileverwarning = new \core\output\notification(get_string('noemaileverwarning', 'admin'),
\core\output\notification::NOTIFY_ERROR);
$temp->add(new admin_setting_heading('outgoingmaildisabled', '', $OUTPUT->render($noemaileverwarning)));
}
$temp->add(new admin_setting_heading('smtpheading', new lang_string('smtp', 'admin'),
new lang_string('smtpdetail', 'admin')));
$temp->add(new admin_setting_configtext('smtphosts', new lang_string('smtphosts', 'admin'),
new lang_string('configsmtphosts', 'admin'), '', PARAM_RAW));
$options = [
'' => new lang_string('none', 'admin'),
'ssl' => 'SSL',
'tls' => 'TLS',
];
$temp->add(new admin_setting_configselect('smtpsecure', new lang_string('smtpsecure', 'admin'),
new lang_string('configsmtpsecure', 'admin'), '', $options));
$authtypeoptions = [
'LOGIN' => 'LOGIN',
'PLAIN' => 'PLAIN',
'NTLM' => 'NTLM',
'CRAM-MD5' => 'CRAM-MD5',
];
// Get all the issuers.
$issuers = \core\oauth2\api::get_all_issuers();
$enabledissuers = [];
foreach ($issuers as $issuer) {
// Get the enabled issuer only.
if ($issuer->get('enabled')) {
$enabledissuers[] = $issuer;
}
}
if (count($enabledissuers) > 0) {
$authtypeoptions['XOAUTH2'] = 'XOAUTH2';
}
$temp->add(new admin_setting_configselect('smtpauthtype', new lang_string('smtpauthtype', 'admin'),
new lang_string('configsmtpauthtype', 'admin'), 'LOGIN', $authtypeoptions));
if (count($enabledissuers) > 0) {
$oauth2services = [
'' => new lang_string('none', 'admin'),
];
foreach ($enabledissuers as $issuer) {
$oauth2services[$issuer->get('id')] = s($issuer->get('name'));
}
$temp->add(new admin_setting_configselect('smtpoauthservice', new lang_string('issuer', 'auth_oauth2'),
new lang_string('configsmtpoauthservice', 'admin'), '', $oauth2services));
}
$temp->add(new admin_setting_configtext('smtpuser', new lang_string('smtpuser', 'admin'),
new lang_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_configpasswordunmask('smtppass', new lang_string('smtppass', 'admin'),
new lang_string('configsmtpuser', 'admin'), ''));
$temp->add(new admin_setting_configtext('smtpmaxbulk', new lang_string('smtpmaxbulk', 'admin'),
new lang_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_heading('noreplydomainheading', new lang_string('noreplydomain', 'admin'),
new lang_string('noreplydomaindetail', 'admin')));
$default = clean_param('noreply@' . get_host_from_url($CFG->wwwroot), PARAM_EMAIL);
if (!$default) {
$default = null;
}
$temp->add(new admin_setting_configtext('noreplyaddress', new lang_string('noreplyaddress', 'admin'),
new lang_string('confignoreplyaddress', 'admin'), $default, PARAM_EMAIL));
$temp->add(new admin_setting_configtextarea('allowedemaildomains',
new lang_string('allowedemaildomains', 'admin'),
new lang_string('configallowedemaildomains', 'admin'),
''));
$temp->add(new admin_setting_heading('divertallemailsheading', new lang_string('divertallemails', 'admin'),
new lang_string('divertallemailsdetail', 'admin')));
$temp->add(new admin_setting_configtext('divertallemailsto',
new lang_string('divertallemailsto', 'admin'),
new lang_string('divertallemailsto_desc', 'admin'),
''));
$temp->add(new admin_setting_configtextarea('divertallemailsexcept',
new lang_string('divertallemailsexcept', 'admin'),
new lang_string('divertallemailsexcept_desc', 'admin'),
'', PARAM_RAW, '50', '4'));
$noreplyaddress = isset($CFG->noreplyaddress) ? $CFG->noreplyaddress : 'noreply@example.com';
$dkimdomain = substr(strrchr($noreplyaddress, "@"), 1);
$dkimselector = empty($CFG->emaildkimselector) ? '[selector]' : $CFG->emaildkimselector;
$pempath = "\$CFG->dataroot/dkim/{$dkimdomain}/{$dkimselector}.private";
$temp->add(new admin_setting_heading('emaildkim', new lang_string('emaildkim', 'admin'),
new lang_string('emaildkiminfo', 'admin', ['path' => $pempath, 'docs' => \get_docs_url('Mail_configuration#DKIM')])));
$temp->add(new admin_setting_configtext('emaildkimselector', new lang_string('emaildkimselector', 'admin'),
new lang_string('configemaildkimselector', 'admin'), '', PARAM_FILE));
$url = new moodle_url('/admin/testoutgoingmailconf.php');
$link = html_writer::link($url, get_string('testoutgoingmailconf', 'admin'));
$temp->add(new admin_setting_heading('testoutgoinmailc', new lang_string('testoutgoingmailconf', 'admin'),
new lang_string('testoutgoingmaildetail', 'admin', $link)));
$temp->add(new admin_setting_heading('emaildoesnotfit', new lang_string('doesnotfit', 'admin'),
new lang_string('doesnotfitdetail', 'admin')));
$charsets = get_list_of_charsets();
unset($charsets['UTF-8']);
$options = [
'0' => 'UTF-8',
];
$options = array_merge($options, $charsets);
$temp->add(new admin_setting_configselect('sitemailcharset', new lang_string('sitemailcharset', 'admin'),
new lang_string('configsitemailcharset', 'admin'), '0', $options));
$temp->add(new admin_setting_configcheckbox('allowusermailcharset', new lang_string('allowusermailcharset', 'admin'),
new lang_string('configallowusermailcharset', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowattachments', new lang_string('allowattachments', 'admin'),
new lang_string('configallowattachments', 'admin'), 1));
$options = [
'LF' => 'LF',
'CRLF' => 'CRLF',
];
$temp->add(new admin_setting_configselect('mailnewline', new lang_string('mailnewline', 'admin'),
new lang_string('configmailnewline', 'admin'), 'LF', $options));
$choices = [
new lang_string('never', 'admin'),
new lang_string('always', 'admin'),
new lang_string('onlynoreply', 'admin'),
];
$temp->add(new admin_setting_configselect('emailfromvia', new lang_string('emailfromvia', 'admin'),
new lang_string('configemailfromvia', 'admin'), 1, $choices));
$temp->add(new admin_setting_configtext('emailsubjectprefix', new lang_string('emailsubjectprefix', 'admin'),
new lang_string('configemailsubjectprefix', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtextarea('emailheaders', new lang_string('emailheaders', 'admin'),
new lang_string('configemailheaders', 'admin'), '', PARAM_RAW, '50', '3'));
$ADMIN->add('email', $temp);
// Update notifications.
if (empty($CFG->disableupdatenotifications)) {
$temp = new admin_settingpage('updatenotifications', new lang_string('updatenotifications', 'core_admin'));
$temp->add(new admin_setting_configcheckbox('updateautocheck', new lang_string('updateautocheck', 'core_admin'),
new lang_string('updateautocheck_desc', 'core_admin'), 1));
$temp->add(new admin_setting_configselect('updateminmaturity', new lang_string('updateminmaturity', 'core_admin'),
new lang_string('updateminmaturity_desc', 'core_admin'), MATURITY_STABLE,
[
MATURITY_ALPHA => new lang_string('maturity'.MATURITY_ALPHA, 'core_admin'),
MATURITY_BETA => new lang_string('maturity'.MATURITY_BETA, 'core_admin'),
MATURITY_RC => new lang_string('maturity'.MATURITY_RC, 'core_admin'),
MATURITY_STABLE => new lang_string('maturity'.MATURITY_STABLE, 'core_admin'),
]
));
$temp->add(new admin_setting_configcheckbox('updatenotifybuilds', new lang_string('updatenotifybuilds', 'core_admin'),
new lang_string('updatenotifybuilds_desc', 'core_admin'), 0));
$ADMIN->add('server', $temp);
}
// Web services.
$ADMIN->add('server', new admin_category('webservicesettings', new lang_string('webservices', 'webservice')));
// Web services > Overview.
$temp = new admin_settingpage('webservicesoverview', new lang_string('webservicesoverview', 'webservice'));
$temp->add(new admin_setting_webservicesoverview());
$ADMIN->add('webservicesettings', $temp);
// Web services > API documentation.
$ADMIN->add('webservicesettings', new admin_externalpage('webservicedocumentation', new lang_string('wsdocapi', 'webservice'),
"{$CFG->wwwroot}/{$CFG->admin}/webservice/documentation.php", 'moodle/site:config', false));
// Web services > External services.
$temp = new admin_settingpage('externalservices', new lang_string('externalservices', 'webservice'));
$temp->add(new admin_setting_heading('manageserviceshelpexplaination', new lang_string('information', 'webservice'),
new lang_string('servicehelpexplanation', 'webservice')));
$temp->add(new admin_setting_manageexternalservices());
$ADMIN->add('webservicesettings', $temp);
$ADMIN->add('webservicesettings', new admin_externalpage('externalservice', new lang_string('editaservice', 'webservice'),
"{$CFG->wwwroot}/{$CFG->admin}/webservice/service.php", 'moodle/site:config', true));
$ADMIN->add('webservicesettings', new admin_externalpage('externalservicefunctions',
new lang_string('externalservicefunctions', 'webservice'), "{$CFG->wwwroot}/{$CFG->admin}/webservice/service_functions.php",
'moodle/site:config', true));
$ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusers',
new lang_string('externalserviceusers', 'webservice'), "{$CFG->wwwroot}/{$CFG->admin}/webservice/service_users.php",
'moodle/site:config', true));
$ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusersettings',
new lang_string('serviceusersettings', 'webservice'), "{$CFG->wwwroot}/{$CFG->admin}/webservice/service_user_settings.php",
'moodle/site:config', true));
// Web services > Manage protocols.
$temp = new admin_settingpage('webserviceprotocols', new lang_string('manageprotocols', 'webservice'));
$temp->add(new admin_setting_managewebserviceprotocols());
if (empty($CFG->enablewebservices)) {
$temp->add(new admin_setting_heading('webservicesaredisabled', '', new lang_string('disabledwarning', 'webservice')));
}
// We cannot use $OUTPUT->doc_link() this early, we would lose the ability to set the page layout on all admin pages.
$url = new moodle_url(get_docs_url('How_to_get_a_security_key'));
$wsdoclink = html_writer::link($url, new lang_string('supplyinfo', 'webservice'), ['target' => '_blank']);
$temp->add(new admin_setting_configcheckbox('enablewsdocumentation', new lang_string('enablewsdocumentation', 'admin'),
new lang_string('configenablewsdocumentation', 'admin', $wsdoclink), false));
$ADMIN->add('webservicesettings', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('webservice');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\webservice $plugin */
$plugin->load_settings($ADMIN, 'webservicesettings', $hassiteconfig);
}
// Web services > Manage tokens.
$ADMIN->add('webservicesettings', new admin_externalpage('webservicetokens', new lang_string('managetokens', 'webservice'),
new moodle_url('/admin/webservice/tokens.php')));
}
+93
View File
@@ -0,0 +1,93 @@
<?php
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$optionalsubsystems->add(new admin_setting_configcheckbox('enableoutcomes', new lang_string('enableoutcomes', 'grades'), new lang_string('enableoutcomes_help', 'grades'), 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('usecomments', new lang_string('enablecomments', 'admin'), new lang_string('configenablecomments', 'admin'), 1));
$optionalsubsystems->add(new admin_setting_configcheckbox('usetags', new lang_string('usetags','admin'),new lang_string('configusetags', 'admin'), '1'));
$optionalsubsystems->add(new admin_setting_configcheckbox('enablenotes', new lang_string('enablenotes', 'notes'), new lang_string('configenablenotes', 'notes'), 1));
$optionalsubsystems->add(new admin_setting_configcheckbox('enableportfolios', new lang_string('enabled', 'portfolio'), new lang_string('enableddesc', 'portfolio'), 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('enablewebservices', new lang_string('enablewebservices', 'admin'), new lang_string('configenablewebservices', 'admin'), 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('enablestats', new lang_string('enablestats', 'admin'), new lang_string('configenablestats', 'admin'), 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('enablerssfeeds', new lang_string('enablerssfeeds', 'admin'), new lang_string('configenablerssfeeds', 'admin'), 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('enableblogs', new lang_string('enableblogs', 'admin'), new lang_string('configenableblogs', 'admin'), 1));
$options = array('off'=>new lang_string('off', 'mnet'), 'strict'=>new lang_string('on', 'mnet'));
$optionalsubsystems->add(new admin_setting_configselect('mnet_dispatcher_mode', new lang_string('net', 'mnet'), new lang_string('configmnet', 'mnet'), 'off', $options));
// Conditional activities: completion and availability
$optionalsubsystems->add(new admin_setting_configcheckbox('enablecompletion',
new lang_string('enablecompletion','completion'),
new lang_string('configenablecompletion', 'completion'), 1));
$options = array(
1 => get_string('completionactivitydefault', 'completion'),
0 => get_string('completion_none', 'completion')
);
$optionalsubsystems->add($checkbox = new admin_setting_configcheckbox('enableavailability',
new lang_string('enableavailability', 'availability'),
new lang_string('enableavailability_desc', 'availability'), 1));
$checkbox->set_affects_modinfo(true);
$optionalsubsystems->add(new admin_setting_configcheckbox('enableplagiarism', new lang_string('enableplagiarism','plagiarism'), new lang_string('configenableplagiarism','plagiarism'), 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('enablebadges', new lang_string('enablebadges', 'badges'), new lang_string('configenablebadges', 'badges'), 1));
$optionalsubsystems->add(new admin_setting_configcheckbox('enableglobalsearch', new lang_string('enableglobalsearch', 'admin'),
new lang_string('enableglobalsearch_desc', 'admin'), 0, 1, 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('allowstealth', new lang_string('allowstealthmodules'),
new lang_string('allowstealthmodules_help'), 0, 1, 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('enableanalytics', new lang_string('enableanalytics', 'admin'),
new lang_string('configenableanalytics', 'admin'), 1, 1, 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('core_competency/enabled',
new lang_string('enablecompetencies', 'core_competency'),
new lang_string('enablecompetencies_desc', 'core_competency'),
1)
);
$optionalsubsystems->add(new admin_setting_configcheckbox('messaging',
new lang_string('messaging', 'admin'),
new lang_string('configmessaging', 'admin'),
1)
);
$optionalsubsystems->add(new admin_setting_configcheckbox('enablecustomreports',
new lang_string('enablecustomreports', 'core_reportbuilder'),
new lang_string('enablecustomreports_desc', 'core_reportbuilder'),
1
));
$fullunicodesupport = true;
if ($DB->get_dbfamily() == 'mysql') {
$collation = $DB->get_dbcollation();
$collationinfo = explode('_', $collation);
$charset = reset($collationinfo);
$fullunicodesupport = $charset === 'utf8mb4';
}
if ($fullunicodesupport) {
$optionalsubsystems->add(new admin_setting_configcheckbox(
'allowemojipicker',
new lang_string('allowemojipicker', 'admin'),
new lang_string('configallowemojipicker', 'admin'),
1
));
} else {
$optionalsubsystems->add(new admin_setting_description(
'allowemojipicker',
new lang_string('allowemojipicker', 'admin'),
new lang_string('configallowemojipickerincompatible', 'admin')
));
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
// This is the first file read by the lib/adminlib.php script
// We use it to create the categories in correct order,
// since they need to exist *before* settingpages and externalpages
// are added to them.
$systemcontext = context_system::instance();
$hassiteconfig = has_capability('moodle/site:config', $systemcontext);
$ADMIN->add('root', new admin_externalpage('adminnotifications', new lang_string('notifications'), "$CFG->wwwroot/$CFG->admin/index.php"));
$ADMIN->add('root', new admin_externalpage('registrationmoodleorg', new lang_string('registration', 'admin'),
new moodle_url("/admin/registration/index.php")));
// hidden upgrade script
$ADMIN->add('root', new admin_externalpage('upgradesettings', new lang_string('upgradesettings', 'admin'), "$CFG->wwwroot/$CFG->admin/upgradesettings.php", 'moodle/site:config', true));
$userfeedback = new admin_settingpage('userfeedback', new lang_string('feedbacksettings', 'admin'));
$ADMIN->add('root', $userfeedback);
if ($hassiteconfig) {
$optionalsubsystems = new admin_settingpage('optionalsubsystems', new lang_string('advancedfeatures', 'admin'));
$ADMIN->add('root', $optionalsubsystems);
}
$ADMIN->add('root', new admin_category('users', new lang_string('users','admin')));
$ADMIN->add('root', new admin_category('courses', new lang_string('courses','admin')));
$ADMIN->add('root', new admin_category('grades', new lang_string('grades')));
$ADMIN->add('root', new admin_category('analytics', new lang_string('analytics', 'analytics')));
$ADMIN->add('root', new admin_category('competencies', new lang_string('competencies', 'core_competency')));
$ADMIN->add('root', new admin_category('badges', new lang_string('badges'), empty($CFG->enablebadges)));
$ADMIN->add('root', new admin_category('h5p', new lang_string('h5p', 'core_h5p')));
$ADMIN->add('root', new admin_category('license', new lang_string('license')));
$ADMIN->add('root', new admin_category('location', new lang_string('location','admin')));
$ADMIN->add('root', new admin_category('language', new lang_string('language')));
$ADMIN->add('root', new admin_category('messaging', new lang_string('messagingcategory', 'admin')));
$ADMIN->add('root', new admin_category('payment', new lang_string('payments', 'payment')));
$ADMIN->add('root', new admin_category('modules', new lang_string('plugins', 'admin')));
$ADMIN->add('root', new admin_category('security', new lang_string('security','admin')));
$ADMIN->add('root', new admin_category('appearance', new lang_string('appearance','admin')));
$ADMIN->add('root', new admin_category('frontpage', new lang_string('frontpage','admin')));
$ADMIN->add('root', new admin_category('server', new lang_string('server','admin')));
$ADMIN->add('root', new admin_category('mnet', new lang_string('net','mnet'), (isset($CFG->mnet_dispatcher_mode) and $CFG->mnet_dispatcher_mode === 'off')));
$ADMIN->add('root', new admin_category('reports', new lang_string('reports')));
$ADMIN->add('root', new admin_category('development', new lang_string('development', 'admin')));
// hidden unsupported category
$ADMIN->add('root', new admin_category('unsupported', new lang_string('unsupported', 'admin'), true));
// hidden search script
$ADMIN->add('root', new admin_externalpage('search', new lang_string('search', 'admin'), "$CFG->wwwroot/$CFG->admin/search.php", 'moodle/site:configview', true));
+49
View File
@@ -0,0 +1,49 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains call to feedback settings
*
* @package core
* @copyright 2020 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
$userfeedback->add(new admin_setting_configcheckbox('enableuserfeedback',
new lang_string('enableuserfeedback', 'admin'),
new lang_string('enableuserfeedback_desc', 'admin'), 0, 1, 0));
$options = [
core_userfeedback::REMIND_AFTER_UPGRADE => new lang_string('userfeedbackafterupgrade', 'admin'),
core_userfeedback::REMIND_PERIODICALLY => new lang_string('userfeedbackperiodically', 'admin'),
core_userfeedback::REMIND_NEVER => new lang_string('never'),
];
$userfeedback->add(new admin_setting_configselect('userfeedback_nextreminder',
new lang_string('userfeedbacknextreminder', 'admin'),
new lang_string('userfeedbacknextreminder_desc', 'admin'), 1, $options));
$userfeedback->hide_if('userfeedback_nextreminder', 'enableuserfeedback');
$userfeedback->add(new admin_setting_configtext('userfeedback_remindafter',
new lang_string('userfeedbackremindafter', 'admin'),
new lang_string('userfeedbackremindafter_desc', 'admin'), 90, PARAM_INT));
$userfeedback->hide_if('userfeedback_remindafter', 'enableuserfeedback');
$userfeedback->hide_if('userfeedback_remindafter', 'userfeedback_nextreminder', 'eq', 3);
}
+341
View File
@@ -0,0 +1,341 @@
<?php
// This file defines settingpages and externalpages under the "users" category.
$ADMIN->add('users', new admin_category('accounts', new lang_string('accounts', 'admin')));
$ADMIN->add('users', new admin_category('roles', new lang_string('permissions', 'role')));
$ADMIN->add('users', new admin_category('privacy', new lang_string('privacyandpolicies', 'admin')));
if ($hassiteconfig
or has_capability('moodle/user:create', $systemcontext)
or has_capability('moodle/user:update', $systemcontext)
or has_capability('moodle/user:delete', $systemcontext)
or has_capability('moodle/role:manage', $systemcontext)
or has_capability('moodle/role:assign', $systemcontext)
or has_capability('moodle/cohort:manage', $systemcontext)
or has_capability('moodle/cohort:view', $systemcontext)) { // Speedup for non-admins, add all caps used on this page.
// Stuff under the "accounts" subcategory.
$ADMIN->add('accounts', new admin_externalpage('editusers', new lang_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('userbulk', new lang_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('addnewuser', new lang_string('addnewuser'), "$CFG->wwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
// User management settingpage.
$temp = new admin_settingpage('usermanagement', new lang_string('usermanagement', 'admin'));
if ($ADMIN->fulltree) {
$choices = array();
$choices['realname'] = new lang_string('fullnameuser');
$choices['lastname'] = new lang_string('lastname');
$choices['firstname'] = new lang_string('firstname');
$choices['username'] = new lang_string('username');
$choices['email'] = new lang_string('email');
$choices['city'] = new lang_string('city');
$choices['country'] = new lang_string('country');
$choices['confirmed'] = new lang_string('confirmed', 'admin');
$choices['suspended'] = new lang_string('suspended', 'auth');
$choices['profile'] = new lang_string('profilefields', 'admin');
$choices['courserole'] = new lang_string('courserole', 'filters');
$choices['anycourses'] = new lang_string('anycourses', 'filters');
$choices['systemrole'] = new lang_string('globalrole', 'role');
$choices['cohort'] = new lang_string('idnumber', 'core_cohort');
$choices['firstaccess'] = new lang_string('firstaccess', 'filters');
$choices['lastaccess'] = new lang_string('lastaccess');
$choices['neveraccessed'] = new lang_string('neveraccessed', 'filters');
$choices['timecreated'] = new lang_string('timecreated');
$choices['timemodified'] = new lang_string('lastmodified');
$choices['nevermodified'] = new lang_string('nevermodified', 'filters');
$choices['auth'] = new lang_string('authentication');
$choices['idnumber'] = new lang_string('idnumber');
$choices['lastip'] = new lang_string('lastip');
$choices['mnethostid'] = new lang_string('mnetidprovider', 'mnet');
$temp->add(new admin_setting_configmultiselect('userfiltersdefault', new lang_string('userfiltersdefault', 'admin'),
new lang_string('userfiltersdefault_desc', 'admin'), array('realname'), $choices));
}
$ADMIN->add('accounts', $temp);
// User default preferences settingpage.
$temp = new admin_settingpage('userdefaultpreferences', new lang_string('userdefaultpreferences', 'admin'));
if ($ADMIN->fulltree) {
$choices = array();
$choices['0'] = new lang_string('emaildisplayno');
$choices['1'] = new lang_string('emaildisplayyes');
$choices['2'] = new lang_string('emaildisplaycourse');
$temp->add(new admin_setting_configselect('defaultpreference_maildisplay', new lang_string('emaildisplay'),
new lang_string('emaildisplay_help'), 2, $choices));
$choices = array();
$choices['0'] = new lang_string('textformat');
$choices['1'] = new lang_string('htmlformat');
$temp->add(new admin_setting_configselect('defaultpreference_mailformat', new lang_string('emailformat'), '', 1, $choices));
$choices = array();
$choices['0'] = new lang_string('emaildigestoff');
$choices['1'] = new lang_string('emaildigestcomplete');
$choices['2'] = new lang_string('emaildigestsubjects');
$temp->add(new admin_setting_configselect('defaultpreference_maildigest', new lang_string('emaildigest'),
new lang_string('emaildigest_help'), 0, $choices));
$choices = array();
$choices['1'] = new lang_string('autosubscribeyes');
$choices['0'] = new lang_string('autosubscribeno');
$temp->add(new admin_setting_configselect('defaultpreference_autosubscribe', new lang_string('autosubscribe'),
'', 1, $choices));
$choices = array();
$choices['0'] = new lang_string('trackforumsno');
$choices['1'] = new lang_string('trackforumsyes');
$temp->add(new admin_setting_configselect('defaultpreference_trackforums', new lang_string('trackforums'),
'', 0, $choices));
$choices = [];
$choices[\core_contentbank\content::VISIBILITY_PUBLIC] = new lang_string('visibilitychoicepublic', 'core_contentbank');
$choices[\core_contentbank\content::VISIBILITY_UNLISTED] = new lang_string('visibilitychoiceunlisted', 'core_contentbank');
$temp->add(new admin_setting_configselect('defaultpreference_core_contentbank_visibility',
new lang_string('visibilitypref', 'core_contentbank'),
new lang_string('visibilitypref_help', 'core_contentbank'),
\core_contentbank\content::VISIBILITY_PUBLIC, $choices));
}
$ADMIN->add('accounts', $temp);
$ADMIN->add('accounts', new admin_externalpage('profilefields', new lang_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
$ADMIN->add('accounts', new admin_externalpage('cohorts', new lang_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
$ADMIN->add(
'accounts',
new admin_externalpage(
'cohort_customfield',
new lang_string('cohort_customfield', 'admin'),
$CFG->wwwroot . '/cohort/customfield.php',
['moodle/cohort:configurecustomfields']
)
);
// Stuff under the "roles" subcategory.
// User policies settingpage.
$temp = new admin_settingpage('userpolicies', new lang_string('userpolicies', 'admin'));
if ($ADMIN->fulltree) {
if (!during_initial_install()) {
$context = context_system::instance();
$otherroles = array();
$guestroles = array();
$userroles = array();
$creatornewroles = array();
$defaultteacherid = null;
$defaultuserid = null;
$defaultguestid = null;
$roles = role_fix_names(get_all_roles(), null, ROLENAME_ORIGINALANDSHORT);
foreach ($roles as $role) {
$rolename = $role->localname;
switch ($role->archetype) {
case 'manager':
$creatornewroles[$role->id] = $rolename;
break;
case 'coursecreator':
break;
case 'editingteacher':
$defaultteacherid = isset($defaultteacherid) ? $defaultteacherid : $role->id;
$creatornewroles[$role->id] = $rolename;
break;
case 'teacher':
$creatornewroles[$role->id] = $rolename;
break;
case 'student':
break;
case 'guest':
$defaultguestid = isset($defaultguestid) ? $defaultguestid : $role->id;
$guestroles[$role->id] = $rolename;
break;
case 'user':
$defaultuserid = isset($defaultuserid) ? $defaultuserid : $role->id;
$userroles[$role->id] = $rolename;
break;
case 'frontpage':
break;
default:
$creatornewroles[$role->id] = $rolename;
$otherroles[$role->id] = $rolename;
break;
}
}
if (empty($guestroles)) {
$guestroles[0] = new lang_string('none');
$defaultguestid = 0;
}
if (empty($userroles)) {
$userroles[0] = new lang_string('none');
$defaultuserid = 0;
}
$restorersnewrole = $creatornewroles;
$restorersnewrole[0] = new lang_string('none');
$temp->add(new admin_setting_configselect('notloggedinroleid', new lang_string('notloggedinroleid', 'admin'),
new lang_string('confignotloggedinroleid', 'admin'), $defaultguestid, ($guestroles + $otherroles)));
$temp->add(new admin_setting_configselect('guestroleid', new lang_string('guestroleid', 'admin'),
new lang_string('guestroleid_help', 'admin'), $defaultguestid, ($guestroles + $otherroles)));
$temp->add(new admin_setting_configselect('defaultuserroleid', new lang_string('defaultuserroleid', 'admin'),
new lang_string('configdefaultuserroleid', 'admin'), $defaultuserid, ($userroles + $otherroles)));
$temp->add(new admin_setting_configselect('creatornewroleid', new lang_string('creatornewroleid', 'admin'),
new lang_string('creatornewroleid_help', 'admin'), $defaultteacherid, $creatornewroles));
$temp->add(new admin_setting_configselect('restorernewroleid', new lang_string('restorernewroleid', 'admin'),
new lang_string('restorernewroleid_help', 'admin'), $defaultteacherid, $restorersnewrole));
// Release memory.
unset($otherroles);
unset($guestroles);
unset($userroles);
unset($creatornewroles);
unset($restorersnewrole);
}
$temp->add(new admin_setting_configcheckbox('enroladminnewcourse', new lang_string('enroladminnewcourse', 'admin'),
new lang_string('enroladminnewcourse_help', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('autologinguests', new lang_string('autologinguests', 'admin'), new lang_string('configautologinguests', 'admin'), 0));
$temp->add(new admin_setting_configmultiselect('hiddenuserfields', new lang_string('hiddenuserfields', 'admin'),
new lang_string('confighiddenuserfields', 'admin'), array(),
array('description' => new lang_string('description'),
'email' => new lang_string('email'),
'city' => new lang_string('city'),
'country' => new lang_string('country'),
'moodlenetprofile' => new lang_string('moodlenetprofile', 'user'),
'timezone' => new lang_string('timezone'),
'firstaccess' => new lang_string('firstaccess'),
'lastaccess' => new lang_string('lastaccess'),
'lastip' => new lang_string('lastip'),
'mycourses' => new lang_string('mycourses'),
'groups' => new lang_string('groups'),
'suspended' => new lang_string('suspended', 'auth'),
)));
// Select fields to display as part of user identity (only to those
// with moodle/site:viewuseridentity).
// Options include fields from the user table that might be helpful to
// distinguish when adding or listing users ('I want to add the John
// Smith from Science faculty') and any custom profile fields.
$temp->add(new admin_setting_configmulticheckbox('showuseridentity',
new lang_string('showuseridentity', 'admin'),
new lang_string('showuseridentity_desc', 'admin'), ['email' => 1],
function() {
global $CFG;
require_once($CFG->dirroot.'/user/profile/lib.php');
// Basic fields available in user table.
$fields = [
'username' => new lang_string('username'),
'idnumber' => new lang_string('idnumber'),
'email' => new lang_string('email'),
'phone1' => new lang_string('phone1'),
'phone2' => new lang_string('phone2'),
'department' => new lang_string('department'),
'institution' => new lang_string('institution'),
'city' => new lang_string('city'),
'country' => new lang_string('country'),
];
// Custom profile fields.
$profilefields = profile_get_custom_fields();
foreach ($profilefields as $field) {
// Only reasonable-length text fields can be used as identity fields.
if ($field->param2 > 255 || $field->datatype != 'text') {
continue;
}
$fields['profile_field_' . $field->shortname] = format_string($field->name, true,
['context' => context_system::instance()]) . ' *';
}
return $fields;
}));
$setting = new admin_setting_configtext('fullnamedisplay', new lang_string('fullnamedisplay', 'admin'),
new lang_string('configfullnamedisplay', 'admin'), 'language', PARAM_TEXT, 50);
$setting->set_force_ltr(true);
$temp->add($setting);
$temp->add(new admin_setting_configtext('alternativefullnameformat', new lang_string('alternativefullnameformat', 'admin'),
new lang_string('alternativefullnameformat_desc', 'admin'),
'language', PARAM_RAW, 50));
$temp->add(new admin_setting_configtext('maxusersperpage', new lang_string('maxusersperpage','admin'), new lang_string('configmaxusersperpage','admin'), 100, PARAM_INT));
$temp->add(new admin_setting_configcheckbox('enablegravatar', new lang_string('enablegravatar', 'admin'), new lang_string('enablegravatar_help', 'admin'), 0));
$temp->add(new admin_setting_configtext('gravatardefaulturl', new lang_string('gravatardefaulturl', 'admin'), new lang_string('gravatardefaulturl_help', 'admin'), 'mm'));
}
$ADMIN->add('roles', $temp);
if (is_siteadmin()) {
$ADMIN->add('roles', new admin_externalpage('admins', new lang_string('siteadministrators', 'role'), "$CFG->wwwroot/$CFG->admin/roles/admins.php"));
}
$ADMIN->add('roles', new admin_externalpage('defineroles', new lang_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php", 'moodle/role:manage'));
$ADMIN->add('roles', new admin_externalpage('assignroles', new lang_string('assignglobalroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=".$systemcontext->id, 'moodle/role:assign'));
$ADMIN->add('roles', new admin_externalpage('checkpermissions', new lang_string('checkglobalpermissions', 'role'), "$CFG->wwwroot/$CFG->admin/roles/check.php?contextid=".$systemcontext->id, array('moodle/role:assign', 'moodle/role:safeoverride', 'moodle/role:override', 'moodle/role:manage')));
} // End of speedup.
// Privacy settings.
if ($hassiteconfig) {
$temp = new admin_settingpage('privacysettings', new lang_string('privacysettings', 'admin'));
$options = array(
0 => get_string('no'),
1 => get_string('yes')
);
$url = new moodle_url('/admin/settings.php?section=supportcontact');
$url = $url->out();
$setting = new admin_setting_configselect('agedigitalconsentverification',
new lang_string('agedigitalconsentverification', 'admin'),
new lang_string('agedigitalconsentverification_desc', 'admin', $url), 0, $options);
$setting->set_force_ltr(true);
$temp->add($setting);
// See {@link https://gdpr-info.eu/art-8-gdpr/}.
// See {@link https://www.betterinternetforkids.eu/web/portal/practice/awareness/detail?articleId=3017751}.
$ageofdigitalconsentmap = implode(PHP_EOL, [
'*, 16',
'AT, 14',
'BE, 13',
'BG, 14',
'CY, 14',
'CZ, 15',
'DK, 13',
'EE, 13',
'ES, 14',
'FI, 13',
'FR, 15',
'GB, 13',
'GR, 15',
'IT, 14',
'LT, 14',
'LV, 13',
'MT, 13',
'NO, 13',
'PT, 13',
'SE, 13',
'US, 13'
]);
$setting = new admin_setting_agedigitalconsentmap('agedigitalconsentmap',
new lang_string('ageofdigitalconsentmap', 'admin'),
new lang_string('ageofdigitalconsentmap_desc', 'admin'),
$ageofdigitalconsentmap,
PARAM_RAW
);
$temp->add($setting);
$ADMIN->add('privacy', $temp);
// Policy settings.
$temp = new admin_settingpage('policysettings', new lang_string('policysettings', 'admin'));
$temp->add(new admin_settings_sitepolicy_handler_select('sitepolicyhandler', new lang_string('sitepolicyhandler', 'core_admin'),
new lang_string('sitepolicyhandler_desc', 'core_admin')));
$temp->add(new admin_setting_configtext('sitepolicy', new lang_string('sitepolicy', 'core_admin'),
new lang_string('sitepolicy_help', 'core_admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtext('sitepolicyguest', new lang_string('sitepolicyguest', 'core_admin'),
new lang_string('sitepolicyguest_help', 'core_admin'), (isset($CFG->sitepolicy) ? $CFG->sitepolicy : ''), PARAM_RAW));
$ADMIN->add('privacy', $temp);
}