This repository has been archived by the owner on Feb 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
testsolveteams.php
101 lines (87 loc) · 2.73 KB
/
testsolveteams.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
<?php // vim:set ts=4 sw=4 sts=4 et:
require_once "config.php";
require_once "html.php";
require_once "db-func.php";
require_once "utils.php";
// Redirect to the login page, if not logged in
$uid = isLoggedIn();
// Start HTML
head("testsolveteams");
// Check for permissions
if (!hasTestAdminPermission($uid)) {
echo "<div class='errormsg'>Sorry, you're not a testing admin.</div>";
foot();
exit(1);
}
echo "<h2>Testsolve Team Puzzle Assignments</h2>";
echo "<table>";
echo "<tr><th>Puzzle ID</th><th>TestSolve Team</th></tr>\n";
$puzzles = getPuzzleTeamsList();
foreach ($puzzles as $pid => $testteam) {
echo "<tr><td>$pid</td>\n";
echo "<td><form method='post' action='form-submit.php'>\n";
echo "<input type='hidden' name='pid' value='$pid'>\n";
echo "<input type='hidden' name='notfrompuzzle' value='YES'>";
echo "<SELECT NAME='tid'>\n";
if ($testteam == NULL) {
echo "<option value=''>";
}
$testteams = getTestTeams();
foreach ($testteams as $t) {
$tid = $t['tid'];
$teamname = $t['name'];
echo "<option value='$tid' ";
if ($tid == $testteam) { echo "SELECTED "; }
echo ">$teamname\n";
}
echo "</select><input type='submit' value='set' name='setPuzzleTestTeam'></form></td><tr>\n";
}
echo "</table>";
echo "<h2>Testsolve Team People Assignments</h2>";
echo "<table>";
echo "<tr><th>Person</th><th>TestSolve Team</th></tr>\n";
$people = getPeopleTeamsList();
foreach ($people as $uid => $testteam) {
$name = getUserName($uid);
$teamid = getUserTestTeamID($uid);
echo "<tr><td>$name</td>\n";
echo "<td><form method='post' action='form-submit.php'>\n";
echo "<input type='hidden' name='uid' value='$uid'>\n";
echo "<SELECT NAME='tid'>\n";
if ($teamid == NULL) {
echo "<option value=''>";
}
$testteams = getTestTeams();
foreach ($testteams as $t) {
$tid = $t['tid'];
$teamname = $t['name'];
echo "<option value='$tid' ";
if ($tid == $teamid) {
echo "SELECTED ";
}
echo ">$teamname\n";
}
echo "</select><input type='submit' value='set' name='setUserTestTeam'></form></td><tr>\n";
}
echo "</table>";
foot();
function getPeopleTeamsList() {
$people = getPeople();
foreach ($people as $p) {
$uid = $p['uid'];
$testteam = getUserSolveTeam($uid);
$teamassignments["$uid"] = $testteam;
}
asort($teamassignments);
return($teamassignments);
}
function getPuzzleTeamsList() {
$puzzles = getPuzzlesInTesting();
foreach ($puzzles as $p) {
$pid = $p;
$testteam = getPuzzleTestTeam($pid);
$teamassignments["$pid"] = $testteam;
}
asort($teamassignments);
return($teamassignments);
}