Commit 158f9132 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Decline invitation button

parent 0df48774
......@@ -290,6 +290,11 @@ if (!empty($invited)) {
$institutions[$i]->displayname),
'value' => get_string('joininstitution')
);
$elements[] = array(
'type' => 'submit',
'name' => '_declineinvite_' . $i,
'value' => get_string('decline')
);
unset($institutions[$i]);
}
$invitedform = pieform(array(
......@@ -309,13 +314,19 @@ function confirminvite_submit(Pieform $form, $values) {
foreach ($values as $k => $v) {
if (preg_match('/^\_confirminvite\_([a-z0-9]+)$/', $k, $m)) {
$institution = $m[1];
if (count_records('usr_institution_request', 'usr', $USER->id,
'institution', $institution, 'confirmedinstitution', 1)) {
$USER->join_institution($institution);
break;
}
}
if (preg_match('/^\_declineinvite\_([a-z0-9]+)$/', $k, $m)) {
$institution = $m[1];
delete_records('usr_institution_request', 'usr', $USER->id,
'institution', $institution, 'confirmedinstitution', 1);
break;
}
}
if (!empty($institution) && count_records('usr_institution_request', 'usr', $USER->id,
'institution', $institution, 'confirmedinstitution', 1)) {
$USER->join_institution($institution);
}
redirect(get_config('wwwroot') . 'account/index.php');
}
......
......@@ -309,6 +309,7 @@ $string['cancelrequest'] = 'Cancel request';
$string['youhavebeeninvitedtojoin'] = 'You have been invited to join %s';
$string['confirminvitation'] = 'Confirm invitation';
$string['joininstitution'] = 'Join institution';
$string['decline'] = 'Decline';
$string['requestmembershipofaninstitution'] = 'Request membership of an institution';
$string['optionalinstitutionid'] = 'Institution ID (optional)';
$string['institutionmemberconfirmsubject'] = 'Institution membership confirmation';
......
......@@ -837,12 +837,12 @@ p {
.maincontent #leaveinstitution input.submit,
.maincontent #cancelrequest input.submit,
.maincontent #confirminvite input.submit,
.maincontent #requestmembership input.submit {
display: block !important;
}
.maincontent #requestmembership select {
.maincontent #confirminvite label {
display: block !important;
}
acronym {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment