Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
1 <?php 2 3 // This file defines settingpages and externalpages under the "users" category. 4 5 $ADMIN->add('users', new admin_category('accounts', new lang_string('accounts', 'admin'))); 6 $ADMIN->add('users', new admin_category('roles', new lang_string('permissions', 'role'))); 7 $ADMIN->add('users', new admin_category('privacy', new lang_string('privacyandpolicies', 'admin'))); 8 9 if ($hassiteconfig 10 or has_capability('moodle/user:create', $systemcontext) 11 or has_capability('moodle/user:update', $systemcontext) 12 or has_capability('moodle/user:delete', $systemcontext) 13 or has_capability('moodle/role:manage', $systemcontext) 14 or has_capability('moodle/role:assign', $systemcontext) 15 or has_capability('moodle/cohort:manage', $systemcontext) 16 or has_capability('moodle/cohort:view', $systemcontext)) { // Speedup for non-admins, add all caps used on this page. 17 18 19 // Stuff under the "accounts" subcategory. 20 $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'))); 21 $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'))); 22 $ADMIN->add('accounts', new admin_externalpage('addnewuser', new lang_string('addnewuser'), "$CFG->wwwroot/user/editadvanced.php?id=-1", 'moodle/user:create')); 23 24 // User management settingpage. 25 $temp = new admin_settingpage('usermanagement', new lang_string('usermanagement', 'admin')); 26 if ($ADMIN->fulltree) { 27 $choices = array(); 28 $choices['realname'] = new lang_string('fullnameuser'); 29 $choices['lastname'] = new lang_string('lastname'); 30 $choices['firstname'] = new lang_string('firstname'); 31 $choices['username'] = new lang_string('username'); 32 $choices['email'] = new lang_string('email'); 33 $choices['city'] = new lang_string('city'); 34 $choices['country'] = new lang_string('country'); 35 $choices['confirmed'] = new lang_string('confirmed', 'admin'); 36 $choices['suspended'] = new lang_string('suspended', 'auth'); 37 $choices['profile'] = new lang_string('profilefields', 'admin'); 38 $choices['courserole'] = new lang_string('courserole', 'filters'); 39 $choices['anycourses'] = new lang_string('anycourses', 'filters'); 40 $choices['systemrole'] = new lang_string('globalrole', 'role'); 41 $choices['cohort'] = new lang_string('idnumber', 'core_cohort'); 42 $choices['firstaccess'] = new lang_string('firstaccess', 'filters'); 43 $choices['lastaccess'] = new lang_string('lastaccess'); 44 $choices['neveraccessed'] = new lang_string('neveraccessed', 'filters'); 45 $choices['timemodified'] = new lang_string('lastmodified'); 46 $choices['nevermodified'] = new lang_string('nevermodified', 'filters'); 47 $choices['auth'] = new lang_string('authentication'); 48 $choices['idnumber'] = new lang_string('idnumber'); 49 $choices['lastip'] = new lang_string('lastip'); 50 $choices['mnethostid'] = new lang_string('mnetidprovider', 'mnet'); 51 $temp->add(new admin_setting_configmultiselect('userfiltersdefault', new lang_string('userfiltersdefault', 'admin'), 52 new lang_string('userfiltersdefault_desc', 'admin'), array('realname'), $choices)); 53 } 54 $ADMIN->add('accounts', $temp); 55 56 // User default preferences settingpage. 57 $temp = new admin_settingpage('userdefaultpreferences', new lang_string('userdefaultpreferences', 'admin')); 58 if ($ADMIN->fulltree) { 59 $choices = array(); 60 $choices['0'] = new lang_string('emaildisplayno'); 61 $choices['1'] = new lang_string('emaildisplayyes'); 62 $choices['2'] = new lang_string('emaildisplaycourse'); 63 $temp->add(new admin_setting_configselect('defaultpreference_maildisplay', new lang_string('emaildisplay'), 64 new lang_string('emaildisplay_help'), 2, $choices)); 65 66 $choices = array(); 67 $choices['0'] = new lang_string('textformat'); 68 $choices['1'] = new lang_string('htmlformat'); 69 $temp->add(new admin_setting_configselect('defaultpreference_mailformat', new lang_string('emailformat'), '', 1, $choices)); 70 71 $choices = array(); 72 $choices['0'] = new lang_string('emaildigestoff'); 73 $choices['1'] = new lang_string('emaildigestcomplete'); 74 $choices['2'] = new lang_string('emaildigestsubjects'); 75 $temp->add(new admin_setting_configselect('defaultpreference_maildigest', new lang_string('emaildigest'), 76 new lang_string('emaildigest_help'), 0, $choices)); 77 78 79 $choices = array(); 80 $choices['1'] = new lang_string('autosubscribeyes'); 81 $choices['0'] = new lang_string('autosubscribeno'); 82 $temp->add(new admin_setting_configselect('defaultpreference_autosubscribe', new lang_string('autosubscribe'), 83 '', 1, $choices)); 84 85 $choices = array(); 86 $choices['0'] = new lang_string('trackforumsno'); 87 $choices['1'] = new lang_string('trackforumsyes'); 88 $temp->add(new admin_setting_configselect('defaultpreference_trackforums', new lang_string('trackforums'), 89 '', 0, $choices)); 90 } 91 $ADMIN->add('accounts', $temp); 92 93 $ADMIN->add('accounts', new admin_externalpage('profilefields', new lang_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config')); 94 $ADMIN->add('accounts', new admin_externalpage('cohorts', new lang_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view'))); 95 96 97 // Stuff under the "roles" subcategory. 98 99 // User policies settingpage. 100 $temp = new admin_settingpage('userpolicies', new lang_string('userpolicies', 'admin')); 101 if ($ADMIN->fulltree) { 102 if (!during_initial_install()) { 103 $context = context_system::instance(); 104 105 $otherroles = array(); 106 $guestroles = array(); 107 $userroles = array(); 108 $creatornewroles = array(); 109 110 $defaultteacherid = null; 111 $defaultuserid = null; 112 $defaultguestid = null; 113 114 $roles = role_fix_names(get_all_roles(), null, ROLENAME_ORIGINALANDSHORT); 115 foreach ($roles as $role) { 116 $rolename = $role->localname; 117 switch ($role->archetype) { 118 case 'manager': 119 $creatornewroles[$role->id] = $rolename; 120 break; 121 case 'coursecreator': 122 break; 123 case 'editingteacher': 124 $defaultteacherid = isset($defaultteacherid) ? $defaultteacherid : $role->id; 125 $creatornewroles[$role->id] = $rolename; 126 break; 127 case 'teacher': 128 $creatornewroles[$role->id] = $rolename; 129 break; 130 case 'student': 131 break; 132 case 'guest': 133 $defaultguestid = isset($defaultguestid) ? $defaultguestid : $role->id; 134 $guestroles[$role->id] = $rolename; 135 break; 136 case 'user': 137 $defaultuserid = isset($defaultuserid) ? $defaultuserid : $role->id; 138 $userroles[$role->id] = $rolename; 139 break; 140 case 'frontpage': 141 break; 142 default: 143 $creatornewroles[$role->id] = $rolename; 144 $otherroles[$role->id] = $rolename; 145 break; 146 } 147 } 148 149 if (empty($guestroles)) { 150 $guestroles[0] = new lang_string('none'); 151 $defaultguestid = 0; 152 } 153 154 if (empty($userroles)) { 155 $userroles[0] = new lang_string('none'); 156 $defaultuserid = 0; 157 } 158 159 $restorersnewrole = $creatornewroles; 160 $restorersnewrole[0] = new lang_string('none'); 161 162 $temp->add(new admin_setting_configselect('notloggedinroleid', new lang_string('notloggedinroleid', 'admin'), 163 new lang_string('confignotloggedinroleid', 'admin'), $defaultguestid, ($guestroles + $otherroles))); 164 $temp->add(new admin_setting_configselect('guestroleid', new lang_string('guestroleid', 'admin'), 165 new lang_string('guestroleid_help', 'admin'), $defaultguestid, ($guestroles + $otherroles))); 166 $temp->add(new admin_setting_configselect('defaultuserroleid', new lang_string('defaultuserroleid', 'admin'), 167 new lang_string('configdefaultuserroleid', 'admin'), $defaultuserid, ($userroles + $otherroles))); 168 $temp->add(new admin_setting_configselect('creatornewroleid', new lang_string('creatornewroleid', 'admin'), 169 new lang_string('creatornewroleid_help', 'admin'), $defaultteacherid, $creatornewroles)); 170 $temp->add(new admin_setting_configselect('restorernewroleid', new lang_string('restorernewroleid', 'admin'), 171 new lang_string('restorernewroleid_help', 'admin'), $defaultteacherid, $restorersnewrole)); 172 173 // Release memory. 174 unset($otherroles); 175 unset($guestroles); 176 unset($userroles); 177 unset($creatornewroles); 178 unset($restorersnewrole); 179 } 180 181 $temp->add(new admin_setting_configcheckbox('autologinguests', new lang_string('autologinguests', 'admin'), new lang_string('configautologinguests', 'admin'), 0)); 182 183 $temp->add(new admin_setting_configmultiselect('hiddenuserfields', new lang_string('hiddenuserfields', 'admin'), 184 new lang_string('confighiddenuserfields', 'admin'), array(), 185 array('description' => new lang_string('description'), 186 'email' => new lang_string('email'), 187 'city' => new lang_string('city'), 188 'country' => new lang_string('country'), 189 'moodlenetprofile' => new lang_string('moodlenetprofile', 'user'), 190 'timezone' => new lang_string('timezone'), 191 'webpage' => new lang_string('webpage'), 192 'icqnumber' => new lang_string('icqnumber'), 193 'skypeid' => new lang_string('skypeid'), 194 'yahooid' => new lang_string('yahooid'), 195 'aimid' => new lang_string('aimid'), 196 'msnid' => new lang_string('msnid'), 197 'firstaccess' => new lang_string('firstaccess'), 198 'lastaccess' => new lang_string('lastaccess'), 199 'lastip' => new lang_string('lastip'), 200 'mycourses' => new lang_string('mycourses'), 201 'groups' => new lang_string('groups'), 202 'suspended' => new lang_string('suspended', 'auth'), 203 ))); 204 205 // Select fields to display as part of user identity (only to those 206 // with moodle/site:viewuseridentity). 207 // Options include fields from the user table that might be helpful to 208 // distinguish when adding or listing users ('I want to add the John 209 // Smith from Science faculty'). 210 // Custom user profile fields are not currently supported. 211 $temp->add(new admin_setting_configmulticheckbox('showuseridentity', 212 new lang_string('showuseridentity', 'admin'), 213 new lang_string('showuseridentity_desc', 'admin'), array('email' => 1), array( 214 'username' => new lang_string('username'), 215 'idnumber' => new lang_string('idnumber'), 216 'email' => new lang_string('email'), 217 'phone1' => new lang_string('phone1'), 218 'phone2' => new lang_string('phone2'), 219 'department' => new lang_string('department'), 220 'institution' => new lang_string('institution'), 221 'city' => new lang_string('city'), 222 'country' => new lang_string('country'), 223 ))); 224 $setting = new admin_setting_configtext('fullnamedisplay', new lang_string('fullnamedisplay', 'admin'), 225 new lang_string('configfullnamedisplay', 'admin'), 'language', PARAM_TEXT, 50); 226 $setting->set_force_ltr(true); 227 $temp->add($setting); 228 $temp->add(new admin_setting_configtext('alternativefullnameformat', new lang_string('alternativefullnameformat', 'admin'), 229 new lang_string('alternativefullnameformat_desc', 'admin'), 230 'language', PARAM_RAW, 50)); 231 $temp->add(new admin_setting_configtext('maxusersperpage', new lang_string('maxusersperpage','admin'), new lang_string('configmaxusersperpage','admin'), 100, PARAM_INT)); 232 $temp->add(new admin_setting_configcheckbox('enablegravatar', new lang_string('enablegravatar', 'admin'), new lang_string('enablegravatar_help', 'admin'), 0)); 233 $temp->add(new admin_setting_configtext('gravatardefaulturl', new lang_string('gravatardefaulturl', 'admin'), new lang_string('gravatardefaulturl_help', 'admin'), 'mm')); 234 } 235 236 $ADMIN->add('roles', $temp); 237 238 if (is_siteadmin()) { 239 $ADMIN->add('roles', new admin_externalpage('admins', new lang_string('siteadministrators', 'role'), "$CFG->wwwroot/$CFG->admin/roles/admins.php")); 240 } 241 $ADMIN->add('roles', new admin_externalpage('defineroles', new lang_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php", 'moodle/role:manage')); 242 $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')); 243 $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'))); 244 245 } // End of speedup. 246 247 // Privacy settings. 248 if ($hassiteconfig) { 249 $temp = new admin_settingpage('privacysettings', new lang_string('privacysettings', 'admin')); 250 251 $options = array( 252 0 => get_string('no'), 253 1 => get_string('yes') 254 ); 255 $url = new moodle_url('/admin/settings.php?section=supportcontact'); 256 $url = $url->out(); 257 $setting = new admin_setting_configselect('agedigitalconsentverification', 258 new lang_string('agedigitalconsentverification', 'admin'), 259 new lang_string('agedigitalconsentverification_desc', 'admin', $url), 0, $options); 260 $setting->set_force_ltr(true); 261 $temp->add($setting); 262 263 // See {@link https://gdpr-info.eu/art-8-gdpr/}. 264 // See {@link https://www.betterinternetforkids.eu/web/portal/practice/awareness/detail?articleId=3017751}. 265 $ageofdigitalconsentmap = implode(PHP_EOL, [ 266 '*, 16', 267 'AT, 14', 268 'BE, 13', 269 'BG, 14', 270 'CY, 14', 271 'CZ, 15', 272 'DK, 13', 273 'EE, 13', 274 'ES, 14', 275 'FI, 13', 276 'FR, 15', 277 'GB, 13', 278 'GR, 15', 279 'IT, 14', 280 'LT, 14', 281 'LV, 13', 282 'MT, 13', 283 'NO, 13', 284 'PT, 13', 285 'SE, 13', 286 'US, 13' 287 ]); 288 $setting = new admin_setting_agedigitalconsentmap('agedigitalconsentmap', 289 new lang_string('ageofdigitalconsentmap', 'admin'), 290 new lang_string('ageofdigitalconsentmap_desc', 'admin'), 291 $ageofdigitalconsentmap, 292 PARAM_RAW 293 ); 294 $temp->add($setting); 295 296 $ADMIN->add('privacy', $temp); 297 298 // Policy settings. 299 $temp = new admin_settingpage('policysettings', new lang_string('policysettings', 'admin')); 300 $temp->add(new admin_settings_sitepolicy_handler_select('sitepolicyhandler', new lang_string('sitepolicyhandler', 'core_admin'), 301 new lang_string('sitepolicyhandler_desc', 'core_admin'))); 302 $temp->add(new admin_setting_configtext('sitepolicy', new lang_string('sitepolicy', 'core_admin'), 303 new lang_string('sitepolicy_help', 'core_admin'), '', PARAM_RAW)); 304 $temp->add(new admin_setting_configtext('sitepolicyguest', new lang_string('sitepolicyguest', 'core_admin'), 305 new lang_string('sitepolicyguest_help', 'core_admin'), (isset($CFG->sitepolicy) ? $CFG->sitepolicy : ''), PARAM_RAW)); 306 307 $ADMIN->add('privacy', $temp); 308 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body