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
/
Copy pathtestsolving.php
123 lines (106 loc) · 3.94 KB
/
testsolving.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?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("testsolving", "Testsolving Overview");
if (isset($_SESSION['testError'])) {
echo '<div class="errormsg">' . $_SESSION['testError'] . '</div>';
unset($_SESSION['testError']);
}
if (isset($_SESSION['feedback'])) {
echo '<p><strong>' . $_SESSION['feedback'] . '</strong></p><br />';
unset($_SESSION['feedback']);
}
?>
<?php if (ALLOW_TESTSOLVE_PICK): ?>
<form action="form-submit.php" method="post">
<input type="hidden" name="uid" value="<?php echo $uid; ?>" />
Enter Puzzle ID to testsolve: <input type="text" name="pid" />
<input type="submit" name="getTestId" value="Go" />
</form>
<?php endif ?>
<br/><h3><a href="stats.php">Testsolver stats</a></h3>
<br />
<?php if (ALLOW_TESTSOLVE_PICK) { ?>
<h2>Available for you to test (In order of priority):</h2>
<strong class="impt">IMPORTANT:</strong> <b>Clicking a puzzle below will
mark you as a testsolver. Please click judiciously and file a testsolving report!</b>
<br>
<?php
$availPuzzles = getAvailablePuzzlesToTestForUser($uid);
if ($availPuzzles != NULL) {
// Sort descending, by MINUS priority, then reverse.
// Trust me on this.
//
// (We want to sort by priority descending, then by puzzle ID
// ascending. This is the easiest way to (sort of mostly)
// accomplish that. "Mostly" because PHP's asort is not
// stable, so this method of using a secondary sort key doesn't
// quite work.)
foreach ($availPuzzles as $pid) {
$sort[$pid] = -getPuzzleTestPriority($pid);
}
asort($sort);
$availPuzzles = array_keys($sort);
$availPuzzles = array_reverse($availPuzzles);
}
displayQueue($uid, $availPuzzles, "summary numtesters", TRUE);
?>
<br/>
<br/>
<hr/>
<br/>
<?php }
if (USING_TESTSOLVE_TEAMS == 'TRUE') {
$myteam = getUserTestTeamID($uid);
if ($myteam == NULL) {
echo "<h2>Puzzletron doesn't know your testsolve team at this time. Consult the testsolve team assignment spreadsheet manually for an ID to enter above. No puzzles listed.</h2>";
} else {
$myteamname = getTestTeamName($myteam);
echo "<h2>Listing available puzzles to testsolve for team $myteamname </h2>";
echo "<strong class=\"impt\">IMPORTANT:</strong> <b>Clicking a puzzle below will
mark you as a testsolver. Please click judiciously and file a testsolving report!</b>
<br>";
$teampuzzles = getTestTeamPuzzles($myteam);
if (!$teampuzzles) {
echo "This testsolving team has no puzzles assigned at this time.";
} else {
displayQueue($uid, $teampuzzles, "summary numtesters", TRUE);
}
}
} ?>
<br><h3>Currently Testing — (if you're done, please submit a report, even an empty one):</h3>
<?php
/* Commented out to disallow -- for now -- getting a random puzzle to test.
if (getPuzzleToTest($uid) == FALSE) {
echo '<strong>No Puzzles To Add</strong>';
} else {
?>
<form action="form-submit.php" method="post">
<input type="hidden" name="uid" value="<?php echo $uid; ?>" />
<input type="submit" name="getTest" value="Get Puzzle" />
</form>
<?php
}
*/
$testPuzzles = getActivePuzzlesInTestQueue($uid);
displayQueue($uid, $testPuzzles, "summary numtesters", TRUE);
echo '<br />';
echo '<br />';
echo '<h3>Finished Testing</h3>';
$donePuzzles = getActiveDoneTestingPuzzlesForUser($uid);
displayQueue($uid, $donePuzzles, "summary", TRUE);
echo '<br />';
echo '<br />';
echo '<h3>Puzzles Not Currently In Testing</h3>';
$inactivePuzzles = getInactiveTestPuzzlesForUser($uid);
displayQueue($uid, $inactivePuzzles, "", TRUE);
// End HTML
foot();
if (isset($_SESSION['testError'])) {
unset($_SESSION['testError']);
}