-
Notifications
You must be signed in to change notification settings - Fork 2
/
new_member_vote_end_submit.php
79 lines (62 loc) · 2.12 KB
/
new_member_vote_end_submit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php require_once("app.php");
$auth = new Authenticator();
$auth->requireMemberOf('board');
// XXX validate pending_member
$pending_member = $_REQUEST['pending_member'];
// get list of possible responses
$responses = array();
foreach ($vote_options['proposal'] as $response) {
$responses[$response] = array();
}
// collate responses
foreach ($_REQUEST as $key => $value) {
if (!strcmp($key, "btn") || !strcmp($key, "pending_member")) {
continue; //Skip the dropdown for pending member. Every other dropdown will be a board member
}
array_push($responses[$value], $ldap->getUserFromUid($key)['cn'][0]);
}
// render responses
$tally = "";
foreach ($responses as $response => $response_list) {
if (count($response_list) > 0) {
$tally .= $response.": ".implode(", ", $response_list)."\n";
}
}
$vote_passed = MakerLogic::proposalVotePassed($responses);
$vote_passed_text = "failed";
if ($vote_passed) {
$vote_passed_text = "passed";
}
// XXX set signage properly
$signage = "BOARD1 and BOARD2 signed";
// XXX sent out vote end email
$email_title = "Vote End: Membership Application - ".$pending_member;
$email_body =
"Hello Makers,
The vote for ".$pending_member."'s membership has concluded and this proposal has ".$vote_passed_text.".
The board's votes are as follows:
".$tally."
"//.$signage." the application.
."
Your secretary,
Kinsey Moore";
mail($config["email_members"], $email_title, $email_body);
// determine pass/fail
if ($vote_passed) {
// XXX send out email to root with details
// XXX get info from spreadsheet
$admin_title = "Vote Ended for ".$pending_member;
//string[]headers = ["Index", "Date", "Name", "Number", "Emergency Number", "Emergency Name", "Nickname", "Donation", "Email", "Signatories"];
//auto info = map!"a[0]~\": \"~a[1]"(zip(headers, selected_member));
$info = "ALL THE MEMBER INFORMATION";
$admin_body =
"Hi Admins!
".$pending_member." needs an account and this person's information is as follows:
".$info."
Courtesy of your lazy secretary's automated assistant";
mail($config["email_admins"], $admin_title, $admin_body);
} else {
// XXX remove person from pending
}
die(header("Location: ./index.php"));
?>