当前位置: 首页>>代码示例>>PHP>>正文


PHP get_all_roles函数代码示例

本文整理汇总了PHP中get_all_roles函数的典型用法代码示例。如果您正苦于以下问题:PHP get_all_roles函数的具体用法?PHP get_all_roles怎么用?PHP get_all_roles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_all_roles函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor.
  * @throws Command_Exception.
  */
 public function __construct()
 {
     global $DB;
     // Getting command description.
     $cmd_name = vmoodle_get_string('cmdsynccapabilityname', 'vmoodleadminset_roles');
     $cmd_desc = vmoodle_get_string('cmdsynccapabilitydesc', 'vmoodleadminset_roles');
     // Creating platform parameter.
     $platform_param = new Command_Parameter('platform', 'enum', vmoodle_get_string('platformparamsyncdesc', 'vmoodleadminset_roles'), null, get_available_platforms());
     // Getting role parameter.
     $roles = role_fix_names(get_all_roles(), \context_system::instance(), ROLENAME_ORIGINAL);
     $rolemenu = array();
     foreach ($roles as $r) {
         $rolemenu[$r->shortname] = $r->name;
     }
     $role_param = new Command_Parameter('role', 'enum', vmoodle_get_string('roleparamsyncdesc', 'vmoodleadminset_roles'), null, $rolemenu);
     // Creating capability parameter.
     $records = $DB->get_records('capabilities', null, 'name', 'name');
     $capabilities = array();
     foreach ($records as $record) {
         $capabilities[$record->name] = get_capability_string($record->name);
     }
     asort($capabilities);
     $capability_param = new Command_Parameter('capability', 'enum', vmoodle_get_string('capabilityparamsyncdesc', 'vmoodleadminset_roles'), null, $capabilities);
     // Creating command.
     parent::__construct($cmd_name, $cmd_desc, array($platform_param, $role_param, $capability_param));
 }
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:30,代码来源:Command_Role_Capability_Sync.php

示例2: definition

    function definition() {
        $mform =& $this->_form;
        $contextid = $this->_customdata['contextid'];

        $export = $mform->addElement('hidden', 'export', ''); // Will be overwritten below

        $table = new html_table();
        /* Styling done using HTML table and CSS */
        $table->attributes['class'] = 'export_form_table';
        $table->align = array('left', 'left', 'left', 'center');
        $table->wrap = array('nowrap', '', 'nowrap', 'nowrap');
        $table->data = array();

        $table->head = array(get_string('name'),
                            get_string('description'),
                            get_string('shortname'),
                            get_string('export', 'report_rolesmigration'));

        $roles = get_all_roles();
        foreach ($roles as $role) {
            $row = array();
            $roleurl = new moodle_url('/admin/roles/define.php', array('roleid' => $role->id, 'action' => 'view'));
            $row[0] = '<a href="'.$roleurl.'">'.format_string($role->name).'</a>';
            $row[1] = format_text($role->description, FORMAT_HTML);
            $row[2] = ($role->shortname);
            /* Export values are added from role checkboxes */
            $row[3] = '<input type="checkbox" name="export[]" value="'.$role->shortname.'" />';

            $table->data[] = $row;
        }

        $mform->addElement('html', html_writer::table($table));
        $mform->addElement('hidden', 'contextid', $contextid);
        $this->add_action_buttons(false, get_string('submitexport', 'report_rolesmigration'));
    }
开发者ID:ncsu-delta,项目名称:moodle-report_rolesmigration,代码行数:35,代码来源:exportroles_form.php

示例3: definition

 function definition()
 {
     $mform =& $this->_form;
     $mform->addElement('header', 'general', get_string('message', 'message'));
     //$mform->addElement('htmleditor', 'messagebody', get_string('messagebody'), array('rows'=>15, 'cols'=>60));
     //$mform->addRule('messagebody', '', 'required', null, 'client');
     //$mform->setHelpButton('messagebody', array('writing', 'reading', 'questions', 'richtext'), false, 'editorhelpbutton');
     //$mform->addElement('format', 'format', get_string('format'));
     $courses = get_courses();
     foreach ($courses as $course) {
         //$mform->addElement('checkbox','courseid',get_string('course')." ".$course->shortname);
         $courselist[$course->id] = $course->shortname;
     }
     //$select = &$mform->addElement('select', 'colors', get_string('colors'), array('red', 'blue', 'green'), $attributes);
     //$select->setMultiple(true);
     $select =& $mform->addElement('select', 'courses', get_string('courses'), $courselist, 'size="15"');
     $select->setMultiple(true);
     //$mform->addElement('group', 'coursesgrp', get_string('courses'), $select , ' ', false);
     $allroles = array();
     if ($roles = get_all_roles()) {
         foreach ($roles as $role) {
             $rolename = strip_tags(format_string($role->name, true));
             $allroles[$role->id] = $rolename;
         }
     }
     $mform->addElement('select', 'role', get_string('roles'), $allroles);
     $mform->setDefault('role', 'Student');
     $this->add_action_buttons();
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:29,代码来源:user_courselist_form.php

示例4: get_moodle_roles

function get_moodle_roles()
{
    $moodle_roles = array();
    foreach (get_all_roles() as $role) {
        $moodle_roles[] = $role->shortname;
    }
    return $moodle_roles;
}
开发者ID:blionut,项目名称:elearning,代码行数:8,代码来源:roles.php

示例5: xmldb_enrol_flatfile_install

function xmldb_enrol_flatfile_install()
{
    global $CFG, $DB;
    // Flatfile role mappings are empty by default now.
    $roles = get_all_roles();
    foreach ($roles as $role) {
        set_config('map_' . $role->id, $role->shortname, 'enrol_flatfile');
    }
}
开发者ID:evltuma,项目名称:moodle,代码行数:9,代码来源:install.php

示例6: __construct

 /**
  * Constructor.
  * @param context $context the context this table relates to.
  * @param string $contextname $context->get_context_name() - to save recomputing.
  * @param array $allowoverrides
  * @param array $allowsafeoverrides
  * @param array $overridableroles
  */
 public function __construct($context, $contextname, $allowoverrides, $allowsafeoverrides, $overridableroles)
 {
     parent::__construct($context, 'permissions');
     $this->contextname = $contextname;
     $this->allowoverrides = $allowoverrides;
     $this->allowsafeoverrides = $allowsafeoverrides;
     $this->overridableroles = $overridableroles;
     $roles = get_all_roles($context);
     $this->roles = role_fix_names(array_reverse($roles, true), $context, ROLENAME_ALIAS, true);
 }
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:18,代码来源:permissions_table.php

示例7: __construct

 /**
  * Constructor.
  * @throws Command_Exception.
  */
 public function __construct()
 {
     global $DB;
     // Getting command description
     $cmd_name = vmoodle_get_string('cmdcomparename', 'vmoodleadminset_roles');
     $cmd_desc = vmoodle_get_string('cmdcomparedesc', 'vmoodleadminset_roles');
     // Getting role parameter
     $roles = role_fix_names(get_all_roles(), \context_system::instance(), ROLENAME_ORIGINAL);
     $rolemenu = array();
     foreach ($roles as $r) {
         $rolemenu[$r->shortname] = $r->localname;
     }
     $role_param = new Command_Parameter('role', 'enum', vmoodle_get_string('roleparamcomparedesc', 'vmoodleadminset_roles'), null, $rolemenu);
     // Creating command.
     parent::__construct($cmd_name, $cmd_desc, $role_param);
 }
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:20,代码来源:Command_Role_Compare.php

示例8: definition

 public function definition()
 {
     $mform =& $this->_form;
     $category = $this->_customdata['category'];
     $mform->addElement('header', 'rolerenaming', get_string('rolerenaming'));
     $mform->addHelpButton('rolerenaming', 'rolerenaming');
     if ($roles = get_all_roles()) {
         $roles = role_fix_names($roles, null, ROLENAME_ORIGINAL);
         $assignableroles = get_roles_for_contextlevels(CONTEXT_COURSECAT);
         foreach ($roles as $role) {
             $mform->addElement('text', 'role_' . $role->id, get_string('yourwordforx', '', $role->localname));
             $mform->setType('role_' . $role->id, PARAM_TEXT);
             if (!in_array($role->id, $assignableroles)) {
                 $mform->setAdvanced('role_' . $role->id);
             }
         }
     }
     $mform->addElement('hidden', 'id', $category->id);
     $mform->setType('id', PARAM_INT);
     $mform->addElement('html', get_string('roleedit_notice', 'local_contextadmin'));
     $this->add_action_buttons(true, get_string('savechanges'));
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:22,代码来源:categoryroles_form.php

示例9: set_parameters

 /**
  * Sets the parameters property of the extended class
  *
  * @param    USER  global object
  * @param    CFG   global object
  */
 function set_parameters()
 {
     global $USER, $CFG;
     $site = get_site();
     $littlecfg = new object();
     // to avoid some notices later
     $littlecfg->wwwroot = $CFG->wwwroot;
     $courseparameters = array('label3' => array('langstr' => get_string('course'), 'value' => 'optgroup'), 'courseid' => array('langstr' => 'id', 'value' => $this->course->id), 'coursefullname' => array('langstr' => get_string('fullnamecourse'), 'value' => $this->course->fullname), 'courseshortname' => array('langstr' => get_string('shortnamecourse'), 'value' => $this->course->shortname), 'courseidnumber' => array('langstr' => get_string('idnumbercourse'), 'value' => $this->course->idnumber), 'coursesummary' => array('langstr' => get_string('summary'), 'value' => $this->course->summary), 'courseformat' => array('langstr' => get_string('format'), 'value' => $this->course->format));
     $roles = get_all_roles();
     $coursecontext = get_context_instance(CONTEXT_COURSE, $this->course->id);
     $roles = role_fix_names($roles, $coursecontext, ROLENAME_ALIAS);
     foreach ($roles as $role) {
         $courseparameters['course' . $role->shortname] = array('langstr' => get_string('yourwordforx', '', $role->name), 'value' => $role->localname);
     }
     $courseparameters['label4'] = array('langstr' => '', 'value' => '/optgroup');
     $miscparameters = array('label5' => array('langstr' => get_string('miscellaneous'), 'value' => 'optgroup'), 'lang' => array('langstr' => get_string('preferredlanguage'), 'value' => current_language()), 'sitename' => array('langstr' => get_string('fullsitename'), 'value' => format_string($site->fullname)), 'serverurl' => array('langstr' => get_string('serverurl', 'resource', $littlecfg), 'value' => $littlecfg->wwwroot), 'currenttime' => array('langstr' => get_string('time'), 'value' => time()), 'encryptedcode' => array('langstr' => get_string('encryptedcode'), 'value' => $this->set_encrypted_parameter()), 'label6' => array('langstr' => "", 'value' => '/optgroup'));
     $userparameters = array();
     if (!empty($USER->id)) {
         $userparameters = array('label1' => array('langstr' => get_string('user'), 'value' => 'optgroup'), 'userid' => array('langstr' => 'id', 'value' => $USER->id), 'userusername' => array('langstr' => get_string('username'), 'value' => $USER->username), 'useridnumber' => array('langstr' => get_string('idnumber'), 'value' => $USER->idnumber), 'userfirstname' => array('langstr' => get_string('firstname'), 'value' => $USER->firstname), 'userlastname' => array('langstr' => get_string('lastname'), 'value' => $USER->lastname), 'userfullname' => array('langstr' => get_string('fullnameuser'), 'value' => fullname($USER)), 'useremail' => array('langstr' => get_string('email'), 'value' => $USER->email), 'usericq' => array('langstr' => get_string('icqnumber'), 'value' => $USER->icq), 'userphone1' => array('langstr' => get_string('phone') . ' 1', 'value' => $USER->phone1), 'userphone2' => array('langstr' => get_string('phone2') . ' 2', 'value' => $USER->phone2), 'userinstitution' => array('langstr' => get_string('institution'), 'value' => $USER->institution), 'userdepartment' => array('langstr' => get_string('department'), 'value' => $USER->department), 'useraddress' => array('langstr' => get_string('address'), 'value' => $USER->address), 'usercity' => array('langstr' => get_string('city'), 'value' => $USER->city), 'usertimezone' => array('langstr' => get_string('timezone'), 'value' => get_user_timezone_offset()), 'userurl' => array('langstr' => get_string('webpage'), 'value' => $USER->url), 'label2' => array('langstr' => "", 'value' => '/optgroup'));
     }
     $this->parameters = array_merge($userparameters, $courseparameters, $miscparameters);
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:28,代码来源:resource.class.php

示例10: __construct

 /**
  * Constructor.
  * @throws Command_Exception.
  */
 function __construct()
 {
     global $DB;
     // Getting command description.
     $cmd_name = vmoodle_get_string('cmdallowsyncname', 'vmoodleadminset_roles');
     $cmd_desc = vmoodle_get_string('cmdallowsyncdesc', 'vmoodleadminset_roles');
     // Creating platform parameter
     $platform_param = new Command_Parameter('platform', 'enum', vmoodle_get_string('platformparamsyncdesc', 'vmoodleadminset_roles'), null, get_available_platforms());
     // Creating table parameter
     $tables['assign'] = vmoodle_get_string('assigntable', 'vmoodleadminset_roles');
     $tables['override'] = vmoodle_get_string('overridetable', 'vmoodleadminset_roles');
     $tables['switch'] = vmoodle_get_string('switchtable', 'vmoodleadminset_roles');
     $table_param = new Command_Parameter('table', 'enum', vmoodle_get_string('tableparamdesc', 'vmoodleadminset_roles'), null, $tables);
     // Creating role parameter
     $roles = role_fix_names(get_all_roles(), \context_system::instance(), ROLENAME_ORIGINAL);
     $rolemenu = array();
     foreach ($roles as $r) {
         $rolemenu[$r->shortname] = $r->localname;
     }
     $role_param = new Command_Parameter('role', 'enum', vmoodle_get_string('roleparamsyncdesc', 'vmoodleadminset_roles'), null, $rolemenu);
     // Creating command
     parent::__construct($cmd_name, $cmd_desc, array($platform_param, $table_param, $role_param));
 }
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:27,代码来源:Command_Role_Allow_Sync.php

示例11: admin_externalpage

 $ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields', 'admin'), "{$CFG->wwwroot}/user/profile/index.php", 'moodle/site:config'));
 $ADMIN->add('accounts', new admin_externalpage('cohorts', get_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
 // stuff under the "roles" subcategory
 // "userpolicies" settingpage
 $temp = new admin_settingpage('userpolicies', get_string('userpolicies', 'admin'));
 if ($ADMIN->fulltree) {
     if (!during_initial_install()) {
         $context = get_context_instance(CONTEXT_SYSTEM);
         $otherroles = array();
         $guestroles = array();
         $userroles = array();
         $creatornewroles = array();
         $defaultteacherid = null;
         $defaultuserid = null;
         $defaultguestid = null;
         foreach (get_all_roles() as $role) {
             $rolename = strip_tags(format_string($role->name)) . ' (' . $role->shortname . ')';
             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':
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:31,代码来源:users.php

示例12: test_data_saved

 public function test_data_saved()
 {
     global $DB;
     $this->resetAfterTest(true);
     // Create.
     $mode = tool_uploadcourse_processor::MODE_CREATE_NEW;
     $updatemode = tool_uploadcourse_processor::UPDATE_NOTHING;
     $data = array('shortname' => 'c1', 'fullname' => 'Fullname', 'category' => '1', 'visible' => '0', 'startdate' => '8 June 1990', 'idnumber' => '123abc', 'summary' => 'Summary', 'format' => 'weeks', 'theme' => 'afterburner', 'lang' => 'en', 'newsitems' => '7', 'showgrades' => '0', 'showreports' => '1', 'legacyfiles' => '1', 'maxbytes' => '1234', 'groupmode' => '2', 'groupmodeforce' => '1', 'enablecompletion' => '1', 'tags' => 'Cat, Dog', 'role_teacher' => 'Knight', 'role_manager' => 'Jedi', 'enrolment_1' => 'guest', 'enrolment_2' => 'self', 'enrolment_2_roleid' => '1', 'enrolment_3' => 'manual', 'enrolment_3_disable' => '1');
     $this->assertFalse($DB->record_exists('course', array('shortname' => 'c1')));
     $co = new tool_uploadcourse_course($mode, $updatemode, $data);
     $this->assertTrue($co->prepare());
     $co->proceed();
     $this->assertTrue($DB->record_exists('course', array('shortname' => 'c1')));
     $course = $DB->get_record('course', array('shortname' => 'c1'));
     $ctx = context_course::instance($course->id);
     $this->assertEquals($data['fullname'], $course->fullname);
     $this->assertEquals($data['category'], $course->category);
     $this->assertEquals($data['visible'], $course->visible);
     $this->assertEquals(mktime(0, 0, 0, 6, 8, 1990), $course->startdate);
     $this->assertEquals($data['idnumber'], $course->idnumber);
     $this->assertEquals($data['summary'], $course->summary);
     $this->assertEquals($data['format'], $course->format);
     $this->assertEquals($data['theme'], $course->theme);
     $this->assertEquals($data['lang'], $course->lang);
     $this->assertEquals($data['newsitems'], $course->newsitems);
     $this->assertEquals($data['showgrades'], $course->showgrades);
     $this->assertEquals($data['showreports'], $course->showreports);
     $this->assertEquals($data['legacyfiles'], $course->legacyfiles);
     $this->assertEquals($data['maxbytes'], $course->maxbytes);
     $this->assertEquals($data['groupmode'], $course->groupmode);
     $this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
     $this->assertEquals($data['enablecompletion'], $course->enablecompletion);
     $this->assertEquals($data['tags'], join(', ', core_tag_tag::get_item_tags_array('core', 'course', $course->id)));
     // Roles.
     $roleids = array();
     $roles = get_all_roles();
     foreach ($roles as $role) {
         $roleids[$role->shortname] = $role->id;
     }
     $this->assertEquals('Knight', $DB->get_field_select('role_names', 'name', 'roleid = :roleid AND contextid = :ctxid', array('ctxid' => $ctx->id, 'roleid' => $roleids['teacher'])));
     $this->assertEquals('Jedi', $DB->get_field_select('role_names', 'name', 'roleid = :roleid AND contextid = :ctxid', array('ctxid' => $ctx->id, 'roleid' => $roleids['manager'])));
     // Enrolment methods.
     $enroldata = array();
     $instances = enrol_get_instances($course->id, false);
     $this->assertCount(3, $instances);
     foreach ($instances as $instance) {
         $enroldata[$instance->enrol] = $instance;
     }
     $this->assertNotEmpty($enroldata['guest']);
     $this->assertEquals(ENROL_INSTANCE_ENABLED, $enroldata['guest']->status);
     $this->assertNotEmpty($enroldata['self']);
     $this->assertEquals($data['enrolment_2_roleid'], $enroldata['self']->roleid);
     $this->assertEquals(ENROL_INSTANCE_ENABLED, $enroldata['self']->status);
     $this->assertNotEmpty($enroldata['manual']);
     $this->assertEquals(ENROL_INSTANCE_DISABLED, $enroldata['manual']->status);
     // Update existing course.
     $cat = $this->getDataGenerator()->create_category();
     $mode = tool_uploadcourse_processor::MODE_UPDATE_ONLY;
     $updatemode = tool_uploadcourse_processor::UPDATE_ALL_WITH_DATA_ONLY;
     $data = array('shortname' => 'c1', 'fullname' => 'Fullname 2', 'category' => $cat->id, 'visible' => '1', 'startdate' => '11 June 1984', 'idnumber' => 'changeidn', 'summary' => 'Summary 2', 'format' => 'topics', 'theme' => 'clean', 'lang' => '', 'newsitems' => '2', 'showgrades' => '1', 'showreports' => '0', 'legacyfiles' => '0', 'maxbytes' => '4321', 'groupmode' => '1', 'groupmodeforce' => '0', 'enablecompletion' => '0', 'role_teacher' => 'Teacher', 'role_manager' => 'Manager', 'enrolment_1' => 'guest', 'enrolment_1_disable' => '1', 'enrolment_2' => 'self', 'enrolment_2_roleid' => '2', 'enrolment_3' => 'manual', 'enrolment_3_delete' => '1');
     $this->assertTrue($DB->record_exists('course', array('shortname' => 'c1')));
     $co = new tool_uploadcourse_course($mode, $updatemode, $data);
     $this->assertTrue($co->prepare());
     $co->proceed();
     $course = $DB->get_record('course', array('shortname' => 'c1'));
     $ctx = context_course::instance($course->id);
     $this->assertEquals($data['fullname'], $course->fullname);
     $this->assertEquals($data['category'], $course->category);
     $this->assertEquals($data['visible'], $course->visible);
     $this->assertEquals(mktime(0, 0, 0, 6, 11, 1984), $course->startdate);
     $this->assertEquals($data['idnumber'], $course->idnumber);
     $this->assertEquals($data['summary'], $course->summary);
     $this->assertEquals($data['format'], $course->format);
     $this->assertEquals($data['theme'], $course->theme);
     $this->assertEquals($data['lang'], $course->lang);
     $this->assertEquals($data['newsitems'], $course->newsitems);
     $this->assertEquals($data['showgrades'], $course->showgrades);
     $this->assertEquals($data['showreports'], $course->showreports);
     $this->assertEquals($data['legacyfiles'], $course->legacyfiles);
     $this->assertEquals($data['maxbytes'], $course->maxbytes);
     $this->assertEquals($data['groupmode'], $course->groupmode);
     $this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
     $this->assertEquals($data['enablecompletion'], $course->enablecompletion);
     // Roles.
     $roleids = array();
     $roles = get_all_roles();
     foreach ($roles as $role) {
         $roleids[$role->shortname] = $role->id;
     }
     $this->assertEquals('Teacher', $DB->get_field_select('role_names', 'name', 'roleid = :roleid AND contextid = :ctxid', array('ctxid' => $ctx->id, 'roleid' => $roleids['teacher'])));
     $this->assertEquals('Manager', $DB->get_field_select('role_names', 'name', 'roleid = :roleid AND contextid = :ctxid', array('ctxid' => $ctx->id, 'roleid' => $roleids['manager'])));
     // Enrolment methods.
     $enroldata = array();
     $instances = enrol_get_instances($course->id, false);
     $this->assertCount(2, $instances);
     foreach ($instances as $instance) {
         $enroldata[$instance->enrol] = $instance;
     }
     $this->assertNotEmpty($enroldata['guest']);
     $this->assertEquals(ENROL_INSTANCE_DISABLED, $enroldata['guest']->status);
//.........这里部分代码省略.........
开发者ID:evltuma,项目名称:moodle,代码行数:101,代码来源:course_test.php

示例13: get_setting

 /**
  * Returns the current setting if it is set
  *
  * @return mixed null if null, else an array
  */
 public function get_setting()
 {
     $roles = role_fix_names(get_all_roles());
     $result = array();
     foreach ($roles as $role) {
         $contexts = $this->config_read('contexts_role' . $role->id);
         $memberattribute = $this->config_read('memberattribute_role' . $role->id);
         $result[] = array('id' => $role->id, 'name' => $role->localname, 'contexts' => $contexts, 'memberattribute' => $memberattribute);
     }
     return $result;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:settingslib.php

示例14: admin_externalpage

     $ADMIN->add('accounts', new admin_externalpage('cohorts', new lang_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
 }
 // stuff under the "roles" subcategory
 // "userpolicies" 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;
开发者ID:vinoth4891,项目名称:clinique,代码行数:31,代码来源:users.php

示例15: set_config

             set_config('creatornewroleid', 0);
         }
     }
     if (!($guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW))) {
         $guestroles = array();
         $defaultguestid = null;
     } else {
         $defaultguestid = reset($guestroles);
         $defaultguestid = $defaultguestid->id;
     }
     // we must not use assignable roles here:
     //   1/ unsetting roles as assignable for admin might bork the settings!
     //   2/ default user role should not be assignable anyway
     $allroles = array();
     $nonguestroles = array();
     if ($roles = get_all_roles()) {
         foreach ($roles as $role) {
             $rolename = strip_tags(format_string($role->name, true));
             $allroles[$role->id] = $rolename;
             if (!isset($guestroles[$role->id])) {
                 $nonguestroles[$role->id] = $rolename;
             }
         }
     }
     $temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'), get_string('confignotloggedinroleid', 'admin'), $defaultguestid, $allroles));
     $temp->add(new admin_setting_configselect('guestroleid', get_string('guestroleid', 'admin'), get_string('configguestroleid', 'admin'), $defaultguestid, $allroles));
     $temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'), get_string('configdefaultuserroleid', 'admin'), $userrole->id, $nonguestroles));
     // guest role here breaks a lot of stuff
 }
 // enable auto assign role LPC #2 in "Yesumy lemida" category #7 (nadavkav)
 $temp->add(new admin_setting_configcheckbox('autoassignlpctocategory', get_string('autoassignlpctocategory', 'admin'), get_string('configautoassignlpctocategory', 'admin'), 1));
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:31,代码来源:users.php


注:本文中的get_all_roles函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。