-
Notifications
You must be signed in to change notification settings - Fork 1
/
recruit.php
103 lines (87 loc) · 2.9 KB
/
recruit.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<html>
<head></head>
<body>
<?php include_once($_SERVER['DOCUMENT_ROOT'] . "/topmenu.php");
function displayMyRecruit($user) {
?>
<!-- Show pending agency invitations-->
Pending agency invitations: <br>
<?php
$pendingAgencyInviteUsers = $user->getPendingAgencyInviteUsers();
foreach($pendingAgencyInviteUsers as $pendingUser) {
$inviterID = $pendingUser->getID();
$inviterName = $pendingUser->getName();
?>
<?php echo $inviterName;?>
<form action='<?php $_SERVER['DOCUMENT_ROOT'] ?>/backend/respondtoinvitation.php' method='POST'>
<input type='hidden' name='accepted' value='true'/>
<input type='hidden' name='inviterID' value='<?php echo $inviterID;?>'/>
<input type='submit' value='Accept'/>
</form>
<form action='<?php $_SERVER['DOCUMENT_ROOT'] ?>/backend/respondtoinvitation.php' method='POST'>
<input type='hidden' name='accepted' value='false'/>
<input type='hidden' name='inviterID' value='<?php echo $inviterID;?>'/>
<input type='submit' value='Decline'/>
</form>
<?php
}
// Show agency code
print "Your agency code: <br>";
print $user->getAgencyCode();
print "<br>";
?>
Invite using agency code: <br>
<form action="<?php $_SERVER['DOCUMENT_ROOT'] ?>/backend/inviteplayer.php" method="GET">
<input type="text" name="agencyCode"/>
<input type="submit" value="Recruit!"/>
</form>
<?php
}
if (isset($_SESSION['noUserWithAgencyCode']) && $_SESSION['noUserWithAgencyCode']) {
echo "no invite sent because no user with that agency code exists";
print "<br><br>";
unset($_SESSION['noUserWithAgencyCode']);
}
if (isset($_SESSION['successInvite']) && $_SESSION['successInvite']) {
echo "invite successfully sent";
print "<br><br>";
unset($_SESSION['successInvite']);
}
if (isset($_POST['recruitTab'])) {
$_SESSION['recruitTab'] = $_POST['recruitTab'];
} else {
$_SESSION['recruitTab'] = 'recruit';
}
?>
<!-- Create link to agency list page -->
<form action='<?php $_SERVER['DOCUMENT_ROOT'] ?>/recruit.php' method='POST'>
<input type='hidden' name='recruitTab' value='recruit'/>
<input type='submit' value='Recruit'/>
</form>
<form action='<?php $_SERVER['DOCUMENT_ROOT'] ?>/recruit.php' method='POST'>
<input type='hidden' name='recruitTab' value='myagency'/>
<input type='submit' value='My Agency'/>
</form>
<form action='<?php $_SERVER['DOCUMENT_ROOT'] ?>/recruit.php' method='POST'>
<input type='hidden' name='recruitTab' value='leaderboard'/>
<input type='submit' value='Leaderboard'/>
</form>
<?php
if (isset($_SESSION['recruitTab'])) {
print "----------------------------------------------------<br>";
if ($_SESSION['recruitTab'] == 'recruit') {
displayMyRecruit($user);
}
if ($_SESSION['recruitTab'] == 'myagency') {
$recruitUser = $user;
include_once($_SERVER['DOCUMENT_ROOT'] . "/agencylist.php");
}
if ($_SESSION['recruitTab'] == 'leaderboard') {
echo "not sure if we're going to implement this";
}
unset($_SESSION['recruitTab']);
}
?>
</body>
</html>
</html>