コード例 #1
0
    $a->role = $assignableroles[$roleid];
    $a->context = $contextname;
    $title = get_string('assignrolenameincontext', 'role', $a);
} else {
    if ($isfrontpage) {
        $title = get_string('frontpageroles', 'admin');
    } else {
        $title = get_string('assignrolesin', 'role', $contextname);
    }
}
// Process any incoming role assignments before printing the header.
if ($roleid) {
    // Create the user selector objects.
    $options = array('context' => $context, 'roleid' => $roleid);
    $potentialuserselector = roles_get_potential_user_selector($context, 'addselect', $options);
    $currentuserselector = new existing_role_holders('removeselect', $options);
    // Process incoming role assignments
    $errors = array();
    if (optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) {
        $userstoassign = $potentialuserselector->get_selected_users();
        if (!empty($userstoassign)) {
            foreach ($userstoassign as $adduser) {
                $allow = true;
                if ($allow) {
                    role_assign($roleid, $adduser->id, $context->id);
                }
            }
            $potentialuserselector->invalidate_selected_users();
            $currentuserselector->invalidate_selected_users();
            $rolename = $assignableroles[$roleid];
            add_to_log($course->id, 'role', 'assign', 'mod/adobeconnect/participant.php?contextid=' . $context->id . '&roleid=' . $roleid, $rolename, '', $USER->id);
コード例 #2
0
ファイル: lib.php プロジェクト: nicolasconnault/moodle2.0
 public function find_users($search)
 {
     global $USER;
     $groupedusers = parent::find_users($search);
     foreach ($groupedusers as $group) {
         foreach ($group as &$user) {
             if ($user->id == $USER->id) {
                 $user->disabled = true;
             }
         }
     }
     return $groupedusers;
 }