Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/admin/settings/users.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file defines settingpages and externalpages under the "users" category
00004 
00005 $ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
00006 $ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
00007 
00008 if ($hassiteconfig
00009  or has_capability('moodle/user:create', $systemcontext)
00010  or has_capability('moodle/user:update', $systemcontext)
00011  or has_capability('moodle/user:delete', $systemcontext)
00012  or has_capability('moodle/role:manage', $systemcontext)
00013  or has_capability('moodle/role:assign', $systemcontext)
00014  or has_capability('moodle/cohort:manage', $systemcontext)
00015  or has_capability('moodle/cohort:view', $systemcontext)) { // speedup for non-admins, add all caps used on this page
00016 
00017 
00018     if (empty($CFG->loginhttps)) {
00019         $securewwwroot = $CFG->wwwroot;
00020     } else {
00021         $securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
00022     }
00023     // stuff under the "accounts" subcategory
00024     $ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
00025     $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')));
00026     $ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
00027     $ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
00028     $ADMIN->add('accounts', new admin_externalpage('cohorts', get_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
00029 
00030 
00031     // stuff under the "roles" subcategory
00032 
00033     // "userpolicies" settingpage
00034     $temp = new admin_settingpage('userpolicies', get_string('userpolicies', 'admin'));
00035     if ($ADMIN->fulltree) {
00036         if (!during_initial_install()) {
00037             $context = get_context_instance(CONTEXT_SYSTEM);
00038 
00039             $otherroles      = array();
00040             $guestroles      = array();
00041             $userroles       = array();
00042             $creatornewroles = array();
00043 
00044             $defaultteacherid = null;
00045             $defaultuserid    = null;
00046             $defaultguestid   = null;
00047 
00048             foreach (get_all_roles() as $role) {
00049                 $rolename = strip_tags(format_string($role->name)) . ' ('. $role->shortname . ')';
00050                 switch ($role->archetype) {
00051                     case 'manager':
00052                         $creatornewroles[$role->id] = $rolename;
00053                         break;
00054                     case 'coursecreator':
00055                         break;
00056                     case 'editingteacher':
00057                         $defaultteacherid = isset($defaultteacherid) ? $defaultteacherid : $role->id;
00058                         $creatornewroles[$role->id] = $rolename;
00059                         break;
00060                     case 'teacher':
00061                         $creatornewroles[$role->id] = $rolename;
00062                         break;
00063                     case 'student':
00064                         break;
00065                     case 'guest':
00066                         $defaultguestid = isset($defaultguestid) ? $defaultguestid : $role->id;
00067                         $guestroles[$role->id] = $rolename;
00068                         break;
00069                     case 'user':
00070                         $defaultuserid = isset($defaultuserid) ? $defaultuserid : $role->id;
00071                         $userroles[$role->id] = $rolename;
00072                         break;
00073                     case 'frontpage':
00074                         break;
00075                     default:
00076                         $creatornewroles[$role->id] = $rolename;
00077                         $otherroles[$role->id] = $rolename;
00078                         break;
00079                 }
00080             }
00081 
00082             if (empty($guestroles)) {
00083                 $guestroles[0] = get_string('none');
00084                 $defaultguestid = 0;
00085             }
00086 
00087             if (empty($userroles)) {
00088                 $userroles[0] = get_string('none');
00089                 $defaultuserid = 0;
00090             }
00091 
00092             $restorersnewrole = $creatornewroles;
00093             $restorersnewrole[0] = get_string('none');
00094 
00095             $temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'),
00096                           get_string('confignotloggedinroleid', 'admin'), $defaultguestid, ($guestroles + $otherroles)));
00097             $temp->add(new admin_setting_configselect('guestroleid', get_string('guestroleid', 'admin'),
00098                           get_string('guestroleid_help', 'admin'), $defaultguestid, ($guestroles + $otherroles)));
00099             $temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'),
00100                           get_string('configdefaultuserroleid', 'admin'), $defaultuserid, ($userroles + $otherroles)));
00101             $temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
00102                           get_string('creatornewroleid_help', 'admin'), $defaultteacherid, $creatornewroles));
00103             $temp->add(new admin_setting_configselect('restorernewroleid', get_string('restorernewroleid', 'admin'),
00104                           get_string('restorernewroleid_help', 'admin'), $defaultteacherid, $restorersnewrole));
00105 
00106             // release memory
00107             unset($otherroles);
00108             unset($guestroles);
00109             unset($userroles);
00110             unset($creatornewroles);
00111             unset($restorersnewrole);
00112         }
00113 
00114         $temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
00115 
00116         $temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
00117                    get_string('confighiddenuserfields', 'admin'), array(),
00118                        array('description' => get_string('description'),
00119                              'city' => get_string('city'),
00120                              'country' => get_string('country'),
00121                              'webpage' => get_string('webpage'),
00122                              'icqnumber' => get_string('icqnumber'),
00123                              'skypeid' => get_string('skypeid'),
00124                              'yahooid' => get_string('yahooid'),
00125                              'aimid' => get_string('aimid'),
00126                              'msnid' => get_string('msnid'),
00127                              'firstaccess' => get_string('firstaccess'),
00128                              'lastaccess' => get_string('lastaccess'),
00129                              'mycourses' => get_string('mycourses'),
00130                              'groups' => get_string('groups'),
00131                              'suspended' => get_string('suspended', 'auth'),
00132                        )));
00133 
00134         // Select fields to display as part of user identity (only to those
00135         // with moodle/site:viewuseridentity).
00136         // Options include fields from the user table that might be helpful to
00137         // distinguish when adding or listing users ('I want to add the John
00138         // Smith from Science faculty').
00139         // Username is not included as an option because in some sites, it might
00140         // be a security problem to reveal usernames even to trusted staff.
00141         // Custom user profile fields are not currently supported.
00142         $temp->add(new admin_setting_configmulticheckbox('showuseridentity',
00143                 get_string('showuseridentity', 'admin'),
00144                 get_string('showuseridentity_desc', 'admin'), array('email' => 1), array(
00145                     'idnumber'    => get_string('idnumber'),
00146                     'email'       => get_string('email'),
00147                     'phone1'      => get_string('phone'),
00148                     'phone2'      => get_string('phone2'),
00149                     'department'  => get_string('department'),
00150                     'institution' => get_string('institution'),
00151                 )));
00152         $temp->add(new admin_setting_configcheckbox('enablegravatar', get_string('enablegravatar', 'admin'), get_string('enablegravatar_help', 'admin'), 0));
00153     }
00154 
00155     $ADMIN->add('roles', $temp);
00156 
00157     if (is_siteadmin()) {
00158         $ADMIN->add('roles', new admin_externalpage('admins', get_string('siteadministrators', 'role'), "$CFG->wwwroot/$CFG->admin/roles/admins.php"));
00159     }
00160     $ADMIN->add('roles', new admin_externalpage('defineroles', get_string('defineroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/manage.php", 'moodle/role:manage'));
00161     $ADMIN->add('roles', new admin_externalpage('assignroles', get_string('assignglobalroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=".$systemcontext->id, 'moodle/role:assign'));
00162     $ADMIN->add('roles', new admin_externalpage('checkpermissions', get_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')));
00163 
00164 } // end of speedup
 All Data Structures Namespaces Files Functions Variables Enumerations