本文整理匯總了PHP中Institution::uninvite_users方法的典型用法代碼示例。如果您正苦於以下問題:PHP Institution::uninvite_users方法的具體用法?PHP Institution::uninvite_users怎麽用?PHP Institution::uninvite_users使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Institution
的用法示例。
在下文中一共展示了Institution::uninvite_users方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: institutionusers_submit
function institutionusers_submit(Pieform $form, $values)
{
global $SESSION, $USER;
$inst = $values['institution'];
$url = '/admin/users/institutionusers.php?usertype=' . $values['usertype'] . (isset($values['lastinstitution']) ? '&lastinstitution=' . $values['lastinstitution'] : '') . '&institution=' . $inst;
if (empty($inst) || !$USER->can_edit_institution($inst)) {
$SESSION->add_error_msg(get_string('notadminforinstitution', 'admin'));
redirect($url);
}
$dataerror = false;
if (!in_array($values['usertype'], array('requesters', 'members', 'lastinstitution', 'nonmembers', 'invited')) || !is_array($values['users'])) {
$dataerror = true;
} else {
foreach ($values['users'] as $id) {
if (!is_numeric($id)) {
$dataerror = true;
break;
}
}
}
if ($dataerror) {
$SESSION->add_error_msg(get_string('errorupdatinginstitutionusers', 'admin'));
redirect($url);
} else {
if (empty($values['users'])) {
$SESSION->add_ok_msg(get_string('nousersupdated', 'admin'));
redirect($url);
}
}
if ($values['usertype'] == 'members') {
$action = 'removeMembers';
} else {
if ($values['usertype'] == 'requesters') {
$action = !empty($values['reject']) ? 'declineRequestFromUser' : 'addUserAsMember';
} else {
if ($values['usertype'] == 'nonmembers') {
$action = !empty($values['add']) && $USER->get('admin') ? 'addUserAsMember' : 'inviteUser';
} else {
if ($values['usertype'] == 'lastinstitution') {
$action = !empty($values['add']) && $USER->get('admin') ? 'addUserAsMember' : 'inviteUser';
} else {
$action = 'uninvite_users';
}
}
}
}
$institution = new Institution($values['institution']);
$maxusers = $institution->maxuseraccounts;
if (!empty($maxusers)) {
$members = $institution->countMembers();
if ($action == 'addUserAsMember' && $members + count($values['users']) > $maxusers) {
$SESSION->add_error_msg(get_string('institutionuserserrortoomanyusers', 'admin'));
redirect($url);
}
if ($action == 'inviteUser' && $members + $institution->countInvites() + count($values['users']) > $maxusers) {
$SESSION->add_error_msg(get_string('institutionuserserrortoomanyinvites', 'admin'));
redirect($url);
}
}
if ($action == 'removeMembers') {
$institution->removeMembers($values['users']);
} else {
if ($action == 'addUserAsMember') {
$institution->add_members($values['users']);
} else {
if ($action == 'inviteUser') {
$institution->invite_users($values['users']);
} else {
if ($action == 'declineRequestFromUser') {
$institution->decline_requests($values['users']);
} else {
if ($action == 'uninvite_users') {
$institution->uninvite_users($values['users']);
}
}
}
}
}
$SESSION->add_ok_msg(get_string('institutionusersupdated_' . $action, 'admin'));
if (!$USER->get('admin') && !$USER->is_institutional_admin()) {
redirect(get_config('wwwroot'));
}
redirect($url);
}