MDL-11515:
[moodle-linuxchix.git] / admin / settings / users.php
blob4d1802d9ef4ccaa0e275509d7ec3271c6f440cba
1 <?php // $Id$
3 // This file defines settingpages and externalpages under the "users" category
5 if (has_capability('moodle/site:config',$systemcontext)) { // speedup for non-admins
8 $ADMIN->add('users', new admin_externalpage('userauthentication', get_string('authentication','admin'), "$CFG->wwwroot/$CFG->admin/auth.php"));
11 if(empty($CFG->loginhttps)) {
12 $securewwwroot = $CFG->wwwroot;
13 } else {
14 $securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
16 // stuff under the "accounts" subcategory
17 $ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
18 $ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
19 $ADMIN->add('accounts', new admin_externalpage('userbulk', get_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
20 $ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
21 $ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
22 $ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
25 // stuff under the "roles" subcategory
26 $ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
27 $ADMIN->add('roles', new admin_externalpage('defineroles', get_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php"));
28 $sitecontext = get_context_instance(CONTEXT_SYSTEM);
29 $ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignglobalroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=" . $sitecontext->id));
32 // "userpolicies" settingpage
33 $temp = new admin_settingpage('userpolicies', get_string('userpolicies', 'admin'));
35 if (!empty($CFG->rolesactive)) {
36 $context = get_context_instance(CONTEXT_SYSTEM);
37 if (!$guestrole = get_guest_role()) {
38 $guestrole->id = 0;
40 if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
41 $studentrole = array_shift($studentroles); /// Take the first one
42 } else {
43 $studentrole->id = 0;
45 if ($userroles = get_roles_with_capability('moodle/legacy:user', CAP_ALLOW)) {
46 $userrole = array_shift($userroles); /// Take the first one
47 } else {
48 $userrole->id = 0;
50 if (empty($CFG->creatornewroleid)) {
51 if ($teacherroles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, $context)) {
52 $teachereditrole = array_shift($teacherroles);
53 set_config('creatornewroleid', $teachereditrole->id);
54 } else {
55 set_config('creatornewroleid', 0);
58 // we must not use assignable roles here:
59 // 1/ unsetting roles as assignable for admin might bork the settings!
60 // 2/ default user role should not be assignable anyway
61 $allroles = array();
62 if ($roles = get_all_roles()) {
63 foreach ($roles as $role) {
64 $allroles[$role->id] = strip_tags(format_string($role->name, true));
68 $temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
69 get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $allroles ));
70 $temp->add(new admin_setting_configselect('guestroleid', get_string('guestroleid', 'admin'),
71 get_string('configguestroleid', 'admin'), $guestrole->id, $allroles));
72 $temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
73 get_string('configdefaultuserroleid', 'admin'), $userrole->id, $allroles));
76 $temp->add(new admin_setting_configcheckbox('nodefaultuserrolelists', get_string('nodefaultuserrolelists', 'admin'), get_string('confignodefaultuserrolelists', 'admin'), 0));
78 if (!empty($CFG->rolesactive)) {
79 $temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'),
80 get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $allroles));
81 $temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
82 get_string('configcreatornewroleid', 'admin'), $CFG->creatornewroleid, $allroles));
85 $temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
87 if (!empty($CFG->rolesactive)) {
88 $temp->add(new admin_setting_configmultiselect('nonmetacoursesyncroleids', get_string('nonmetacoursesyncroleids', 'admin'),
89 get_string('confignonmetacoursesyncroleids', 'admin'), array(), $allroles));
92 //$temp->add(new admin_setting_configcheckbox('allusersaresitestudents', get_string('allusersaresitestudents', 'admin'), get_string('configallusersaresitestudents','admin'), 1));
93 $temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
94 get_string('confighiddenuserfields', 'admin'), array(),
95 array('none' => get_string('none'),
96 'description' => get_string('description'),
97 'city' => get_string('city'),
98 'country' => get_string('country'),
99 'webpage' => get_string('webpage'),
100 'icqnumber' => get_string('icqnumber'),
101 'skypeid' => get_string('skypeid'),
102 'yahooid' => get_string('yahooid'),
103 'aimid' => get_string('aimid'),
104 'msnid' => get_string('msnid'),
105 'lastaccess' => get_string('lastaccess'))));
106 //$temp->add(new admin_setting_special_adminseesall());
109 $ADMIN->add('roles', $temp);
111 } // end of admin tree capability if