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
/
html.php
604 lines (564 loc) · 24.7 KB
/
html.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
<?php // vim:set ts=4 sw=4 sts=4 et:
require_once "config.php";
require_once "utils.php";
function echoNav($isselected, $href, $linktext, $condition) {
if ($condition) {
$navclass = $isselected ? "selnav" : "nav";
echo "<li class='nav'><a class='$navclass' href='$href'>$linktext</a></li>\n";
}
}
function echoNav1($selnav, $name, $linktext, $condition) {
echoNav($selnav == $name, $name . ".php", $linktext, $condition);
}
function fullTitle() {
return 'MH' . HUNT_YEAR . ' puzzletron authoring server (' . (DEVMODE ? 'test/dev' : (PRACMODE ? 'practice' : 'actual mystery hunt-writing')) . ' instance)';
}
function head($selnav = "", $title = -1) {
if ($title == -1) {$title = fullTitle();}
$hunt = mktime(12, 00, 00, 1, HUNT_DOM, HUNT_YEAR);
$now = time();
$timediff = abs($hunt-$now);
$days = (int)($timediff/(60 * 60 * 24));
$hrs = (int)($timediff/(60 * 60))-(24*$days);
$mins = (int)($timediff/(60))-(24*60*$days)-(60*$hrs);
$cdmsg = "";
if ($now > $hunt) {
$cdmsg = "after hunt started!!!";
$cdclass = "cunum";
} else {
$cdmsg = "left until hunt.";
$cdclass = "cdnum";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="css/reset-min.css" />
<link rel="stylesheet" type="text/css" href="css/base-min.css" />
<link rel="stylesheet" type="text/css" href="css/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<?php if ($selnav == "people" || $selnav == "account") { ?> <link rel="stylesheet" type="text/css" href="css/profiles.css" /> <?php } ?>
<title><?php echo $title; ?></title>
<script type='text/javascript' src='jquery-1.4.2.js'></script>
<script type='text/javascript' src='jquery.tablesorter.min.js'></script>
<script type="text/javascript" src='js.js'></script>
</head>
<body>
<div id="container">
<div id="header">
<div id="top">
<div id="countdowndiv">
<span id="countdown">
<?php
if ($days !== 0) {
$daypl = $days === 1 ? "" : "s";
echo "<span class=\"$cdclass\">$days</span> day$daypl, ";
}
$hrpl = $hrs === 1 ? "" : "s";
echo "<span class=\"$cdclass\">$hrs</span> hour$hrpl and ";
$minpl = $mins === 1 ? "" : "s";
echo "<span class=\"$cdclass\">$mins</span> minute$minpl $cdmsg";
?>
</span>
</div>
<div id="titlediv">
<h1><?php echo fullTitle(); ?></h1>
</div>
<div id="logindiv">
<?php if (isset($_SESSION['uid'])) {
echo 'Logged in as <strong>' . getUserUsername($_SESSION['uid']) . '</strong>';
echo '<a href="account.php"' . ($selnav == "account" ? ' class="accsel"' : "") . '>Your Account</a>';
if (MAILING_LISTS) { echo '<a href="mailinglists.php"' . ($selnav == "mailinglists" ? ' class="accsel"' : "") . '>Mailing Lists</a>'; }
if (!TRUST_REMOTE_USER) { echo '<a href="logout.php">Logout</a>'; }
} else { ?>
<span class="notloggedin">Not logged in</span> <a href="login.php">Login</a>
<?php } ?>
</div>
</div>
<div id="navbar">
<ul class="nav">
<?php if (!empty(WIKI_URL)) { ?>
<li class="nav"><a class="nav wikinav" target="_blank" href="<?php echo WIKI_URL; ?> ">Wiki</a></li>
<?php }
echoNav($selnav == "home", "index.php", "Home", true);
if (isset($_SESSION['uid'])) {
$suid = $_SESSION['uid'];
echoNav1($selnav, "people", "People", true);
echoNav1($selnav, "admin", "Admin", hasServerAdminPermission($suid));
echoNav1($selnav, "author", "Author", true);
echoNav1($selnav, "roundcaptain", "Round Captain", (USING_ROUND_CAPTAINS) && hasRoundCaptainPermission($suid));
echoNav1($selnav, "spoiled", "Spoiled", true);
echoNav1($selnav, "editor", "Discussion Editor", hasEditorPermission($suid));
echoNav1($selnav, "approver", "Approval Editor", (USING_APPROVERS) && (hasApproverPermission($suid) || isEditorChief($suid)));
echoNav1($selnav, "testsolving", "Testsolving", true);
// echoNav1($selnav, "factcheck", "Fact Check", true);
echoNav1($selnav, "ffc", "Final Fact Check", hasFactCheckerPermission($suid));
echoNav1($selnav, "editorlist", "Editor List", isEditorChief($suid) || hasServerAdminPermission($suid));
echoNav1($selnav, "testadmin", "Testing Admin", hasTestAdminPermission($suid));
echoNav1($selnav, "testsolveteams", "TS Team Assignments", (USING_TESTSOLVE_TEAMS) && hasTestAdminPermission($suid));
echoNav1($selnav, "answers", "Answers", canChangeAnswers($suid));
echoNav1($selnav, "allpuzzles", "All Puzzles", canSeeAllPuzzles($suid));
echoNav1($selnav, "editor-pick-special", "Puzzles Needing Help", hasEditorPermission($suid));
}
?>
</ul>
</div>
<div class="clear"></div>
</div>
<div id="body">
<?php
}
function foot() {
?>
</div>
<div id="footer">
<hr />
<p>
This is the website for the hunt writing team.
For technical assistance, please contact the <a href="mailto:<?php echo HELP_EMAIL; ?>">Server Administrators</a>.<br/>
This software is available <a href="http://github.com/mysteryhunt/puzzle-editing/" target="_blank">on GitHub</a> under the Simplified BSD license.<br/>
The copyrights for the puzzles and comments contained herein are retained by the puzzle authors.</p>
</div>
</div>
</body>
</html>
<?php
}
function printPerson($p) {
$id = $p['uid'];
$uname = $p['username'];
$picture = $p['picture'];
$fullname = $p['fullname'];
$email = $p['email'];
if (strncmp($uname, "test", 4) == 0) {
// Ignore test users.
return;
}
$pic = "<img src=\"nophoto.gif\" />";
if ($picture != "") {
if (USING_AWS) {
$picsrc = AWS_ENDPOINT . AWS_BUCKET . "/uploads/pictures/thumbs/$id.jpg";
$pic = "<img src=\"".$picsrc."\" />";
} else {
$picsrc = "uploads/pictures/thumbs/$id.jpg";
if (file_exists($picsrc)) {
$pic = "<img src=\"".$picsrc."\" />";
}
}
}
$roleNames = getUserRolesAsList($id);
if (canSeeAllPuzzles($id)) {
$profclass = "seeallprofilebox";
} elseif (hasApproverPermission($id)) {
$profclass = "approverprofilebox";
} elseif ($roleNames) {
$profclass = "specprofilebox";
} else {
$profclass = "profilebox";
}
?>
<div class="<?php echo $profclass; ?>">
<div class="profileimg"><?php echo $pic ?></div>
<div class="profiletxt">
<span class="profilename"><?php echo "$fullname"; ?> (<?php echo "$uname"; ?>)</span>
<span class="profiletitle"><?php echo $roleNames; ?></span>
<span class="profilecontact"><a href="mailto:<?php echo $email ?>"><?php echo $email ?></a></span>
<?php
$sql = "SELECT * FROM user_info_keys";
$result = get_rows($sql);
foreach ($result as $r) {
$shortname = $r['shortname'];
$longname = $r['longname'];
$user_key_id = $r['id'];
$sql = sprintf("SELECT value FROM user_info_values WHERE person_id = '%s' AND user_info_key_id = '%s'",
mysql_real_escape_string($id), mysql_real_escape_string($user_key_id));
$res = get_rows($sql);
if (count($res) > 0 && $res[0]['value'] != "") {
?>
<span class="profilesect"><?php echo "<b>$longname</b>: " . $res[0]['value']; ?></span>
<?php
}
}
?>
</div>
<div class="profilefooter"></div>
</div>
<?php
}
function displayQueue($uid, $puzzles, $fields, $test, $filter = array(), $addLinkArgs = "", $hidedeadpuzzles = TRUE) {
$fields = explode(" ", $fields);
$showNotes = in_array("notes", $fields);
$showAnswer = in_array("answer", $fields);
$showSummary = in_array("summary", $fields);
$showEditorNotes = in_array("editornotes", $fields);
$showTags = in_array("tags", $fields);
$showAuthorsAndEditors = in_array("authorsandeditors", $fields);
$showNumTesters = in_array("numtesters", $fields);
$showTesters = in_array("testers", $fields);
$showCurrentPuzzleTesterCount = in_array("currentpuzzletestercount", $fields);
$showFinalLinks = in_array("finallinks", $fields);
if (!$puzzles) {
echo "<span class='emptylist'>No puzzles to list</span><br/>";
return;
}
$statuses = getPuzzleStatuses();
$statusSort = get_assoc_array("SELECT id, ord FROM pstatus", "id", "ord");
$deadstatusid = getDeadStatusId();
$flaggedPuzzles = getFlaggedPuzzles($uid);
?>
<table class="tablesorter">
<thead>
<tr>
<th class="puzzidea">ID</th>
<?php if (USING_CODENAMES) {echo '<th class="puzzidea">Codename</th>';} ?>
<th class="puzzidea">Title</th>
<th class="puzzidea">Puzzle Status</th>
<th class="puzzidea">Round(s)</th>
<?php if ($showSummary) {echo '<th class="puzzidea">Summary</th>';} ?>
<?php if ($showEditorNotes) {echo '<th class="puzzidea">Editor Notes</th>';} ?>
<?php if ($showTags) {echo '<th class="puzzidea">Tags</th>';} ?>
<?php if ($showNotes) {echo '<th class="puzzidea">Status Notes</th>';} ?>
<?php if ($showNotes) {echo '<th class="puzzidea">Runtime Info</th>';} ?>
<?php if ($showNotes) {echo '<th class="puzzidea">Priority</th>';} ?>
<?php if ($showAnswer) {echo '<th class="puzzidea">Answer</th>';} ?>
<?php if (!$test) { echo '<th class="puzzidea">Last Commenter</th>';} ?>
<?php if (!$test) { echo '<th class="puzzidea">Last Comment</th>';}?>
<?php if (!$test){ echo '<th class="puzzidea">Last Status Change</th>';}?>
<?php if ($showAuthorsAndEditors) {echo '<th class="puzzidea">Authors</th>';} ?>
<?php if ($showAuthorsAndEditors) {echo '<th class="puzzidea">Discussion Editors</th>';} ?>
<?php if (MIN_EDITORS >= 0 && $showAuthorsAndEditors) {echo '<th class="puzzidea">D.Eds Needed</th>';} ?>
<?php if (USING_APPROVERS && $showAuthorsAndEditors) {echo '<th class="puzzidea">Approval Editors</th>';} ?>
<?php if ($showAuthorsAndEditors) {echo '<th class="puzzidea">Approvals</th>';} ?>
<?php if ($showNumTesters) {echo '<th class="puzzidea"># Testers</th>';} ?>
<?php if ($showCurrentPuzzleTesterCount) {echo '<th class="puzzidea"># Current Testers';} ?>
<?php if ($showTesters) {echo '<th class="puzzidea">Testers</th>';} ?>
<?php if ($showTesters) {echo '<th class="puzzidea">Last Test Report</th>';} ?>
<?php if (($showTesters) && (USING_TESTSOLVE_REQUESTS)) {echo '<th class="puzzidea">Testsolve requests</th>';} ?>
<?php if ($showFinalLinks) {echo '<th class="puzzidea">Final Links</th>';} ?>
</tr>
</thead>
<tbody>
<?php
foreach ($puzzles as $pid) {
$puzzleInfo = getPuzzleInfo($pid);
$tags = getTagsAsList($pid);
$roundDict = getRoundDictForPuzzle($pid);
$rounds = array_map(function($r) {return $r['rid'];}, $roundDict);
// This is totally the wrong way to do this. The right way involves
// writing SQL.
if ($filter) {
if ($filter[0] == "status" && $filter[1] != $puzzleInfo["pstatus"]) {
continue;
}
if ($filter[0] == "author" && !isAuthorOnPuzzle($filter[1], $pid)) {
continue;
}
if ($filter[0] == "editor" && !isEditorOnPuzzle($filter[1], $pid)) {
continue;
}
if ($filter[0] == "approver" && !isApproverOnPuzzle($filter[1], $pid)) {
continue;
}
if ($filter[0] == "tag" && !isTagOnPuzzle($filter[1], $pid)) {
continue;
}
if ($filter[0] == "round" && !in_array($filter[1], $rounds)) {
continue;
}
if ($filter[0] != "status" && $hidedeadpuzzles && $puzzleInfo["pstatus"] == $deadstatusid) {
continue;
}
}
elseif ($hidedeadpuzzles && $puzzleInfo["pstatus"] == $deadstatusid) {
continue;
}
$title = $puzzleInfo["title"];
if ($title == NULL) {
$title = '(untitled)';
}
$codename = getCodename($pid);
$lastComment = getLastCommentDate($pid);
$lastCommenter = getLastCommenter($pid);
$lastVisit = getLastVisit($uid, $pid);
$flagged = in_array($pid, $flaggedPuzzles);
$status = $puzzleInfo["pstatus"];
if (($lastVisit == NULL || strtotime($lastVisit) < strtotime($lastComment)) || $test) {
echo '<tr class="puzz-new">';
} elseif ($flagged) {
echo '<tr class="puzz-flag">';
} else {
echo '<tr class="puzz">';
}
if ($test) {
echo "<td class='puzzidea'><a href='test.php?pid=$pid$addLinkArgs'>$pid</a></td>";
} else {
echo "<td class='puzzidea'><a href='puzzle.php?pid=$pid$addLinkArgs'>$pid</a></td>";
}
?>
<?php if (USING_CODENAMES) {echo '<td class="puzzidea">' . $codename . '</th>';} ?>
<td class='puzzidea'><?php echo $title; ?></td>
<td class='puzzidea' data-sort-value='<?php echo $statusSort[$status] ?>'><?php echo $statuses[$status]; ?></td>
<td class='puzzidea'><?php echo implode(', ', array_map(function($r) {return $r['name'];}, $roundDict)); ?></td>
<?php if ($showSummary) {echo "<td class='puzzideasecure'>" . $puzzleInfo["summary"] . "</td>";} ?>
<?php if ($showEditorNotes) {echo "<td class='puzzideasecure'>" . $puzzleInfo["editor_notes"] . "</td>";} ?>
<?php if ($showTags) {echo "<td class='puzzidea'>" . $tags . "</td>";} ?>
<?php if ($showNotes) {echo "<td class='puzzidea'>" . $puzzleInfo["notes"] . "</td>";} ?>
<?php if ($showNotes) {echo "<td class='puzzidea'>" . $puzzleInfo["runtime_info"] . "</td>";} ?>
<?php if ($showNotes) {echo "<td class='puzzidea'>" . getPriorityWord($puzzleInfo["priority"]) . "</td>";} ?>
<?php
if ($showAnswer) {
if (getAnswersForPuzzleAsList($pid) != "") {
echo "<td class='puzzideasecure'>";
} else {
echo "<td class='puzzidea'>";
}
echo getAnswersForPuzzleAsList($pid) . "</td>";
} ?>
<?php if (!$test) {echo "<td class='puzzidea'>$lastCommenter</td>";} ?>
<?php if (!$test) {echo "<td class='puzzidea'>$lastComment</td>";} ?>
<?php if (!$test) {echo "<td class='puzzidea'>" . getLastStatusChangeDate($pid). "</td>";} ?>
<?php if ($showAuthorsAndEditors) {echo "<td class='puzzidea'>" . getAuthorsAsList($pid) . "</td>";} ?>
<?php if ($showAuthorsAndEditors) {
$est = getEditorStatus($pid);
echo "<td class='puzzidea'>" . $est[0] . "</td>";
if (MIN_EDITORS >= 0) {
echo "<td class='puzzidea'>" . $est[1] . "</td>";
}
} ?>
<?php if (USING_APPROVERS && $showAuthorsAndEditors) {echo "<td class='puzzidea'>" . getApproversAsList($pid) . "</td>";} ?>
<?php if ($showAuthorsAndEditors) {echo "<td class='puzzidea'>" . countPuzzApprovals($pid) . "</td>";} ?>
<?php if ($showNumTesters) {echo "<td class='puzzidea'>" . getNumTesters($pid) . "</td>";} ?>
<?php if ($showCurrentPuzzleTesterCount) {echo "<td class='puzzidea'>" . getCurrentPuzzleTesterCount($pid) . "</td>";} ?>
<?php if ($showTesters) {echo "<td class='puzzidea'>" . getCurrentTestersAsList($pid) . "</td>";} ?>
<?php if ($showTesters) {echo "<td class='puzzidea'>" . getLastTestReportDate($pid) . "</td>";} ?>
<?php if (($showTesters) && (USING_TESTSOLVE_REQUESTS)) {echo "<td class='puzzidea'>" . getTestsolveRequestsForPuzzle($pid) . "</td>";} ?>
<?php if ($showFinalLinks) {echo "<td class='puzzidea'><a href='" . getBetaLink($title) . "' target='_blank'>beta</a> <a href='". getFinalLink($title)."' target='_blank'>final</a></td>";} ?>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
// Make groups of checkboxes
// Takes an associative array and the name of the form element
function makeOptionElements($toDisplay, $name, $highlightKey = NULL) {
if (!$toDisplay) {
echo '<em>(none)</em>';
return;
}
$maxLength = 5;
$maxCol = 10;
// Figure out how many columns are necessary to maintain max length
// Use maxCol to keep from having too many columns
$numCol = min(ceil(count(array_keys($toDisplay))/$maxLength), $maxCol);
$i = 1;
echo '<table>';
foreach ($toDisplay as $key => $value) {
if ($key == NULL) {
continue;
}
// Start a new row, if necessary
if (($i % $numCol) == 1) {
echo '<tr>';
}
// Add answer information
if ($key == $highlightKey) {
echo "<td class='highlightkey'>";
} else {
echo '<td>';
}
echo "<label><input type='checkbox' name='$name" . "[]' value='$key' /> $value</label>";
echo '</td>';
// End row, if number of columns reached
if (($i % $numCol) == 0) {
echo '</tr>';
}
$i++;
}
// Close last row, if necessary
if (($i % $numCol) != 1) {
echo '</tr>';
}
echo '</table>';
}
function displayPuzzleStats($uid) {
$max_rows = 6;
$totalNumberOfPuzzles = countLivePuzzles();
$numberOfEditors = getNumberOfEditorsOnPuzzles("discuss");
$moreThanThree = $totalNumberOfPuzzles - $numberOfEditors['0'] - $numberOfEditors['1'] - $numberOfEditors['2'] - $numberOfEditors['3'];
$numberOfApprovalEditors = getNumberOfEditorsOnPuzzles("approval");
$moreThanThreeApproval = $totalNumberOfPuzzles - $numberOfApprovalEditors['0'] - $numberOfApprovalEditors['1'] - $numberOfApprovalEditors['2'] - $numberOfApprovalEditors['3'];
$userNumbers = getNumberOfPuzzlesForUser($uid);
$editor = $userNumbers['editor'];
$tester = $userNumbers['currentTester'];
if ($userNumbers['doneTester'] > 0) {
$tester .= ' (+' . $userNumbers['doneTester'] . ' done)';
}
?>
<table><tr>
<td class="puzz-stats">
<table>
<tr>
<th class="puzz-stats" colspan="2"><?php echo $totalNumberOfPuzzles; ?> Total Live Puzzles/Ideas</th>
</tr>
<tr>
<td class="puzz-stats">You Are Discuss Ed</td>
<td class="puzz-stats"><?php echo $editor; ?></td>
</tr>
<tr>
<td class="puzz-stats">You Are Approve Ed</td>
<td class="puzz-stats"><?php echo $userNumbers['approver']; ?></td>
</tr>
<tr>
<td class="puzz-stats">You Are Author</td>
<td class="puzz-stats"><?php echo $userNumbers['author']; ?></td>
</tr>
<tr>
<td class="puzz-stats">You Are Spoiled</td>
<td class="puzz-stats"><?php echo $userNumbers['spoiled']; ?></td>
</tr>
<tr>
<td class="puzz-stats">You Are Tester</td>
<td class="puzz-stats"><?php echo $tester; ?></td>
</tr>
<!--<tr>
<td class="puzz-stats">Available To Edit</td>
<td class="puzz-stats"><?php echo $userNumbers['available']; ?></td>
</tr>-->
</table>
</td>
<td class="discussion-ed-stats">
<table>
<tr>
<th class="discussion-ed-stats" colspan="2">Discuss Eds</th>
</tr>
<tr>
<td class="discussion-ed-stats">Zero</td>
<td class="discussion-ed-stats"><?php echo $numberOfEditors['0']; ?></td>
</tr>
<tr>
<td class="discussion-ed-stats">One</td>
<td class="discussion-ed-stats"><?php echo $numberOfEditors['1']; ?></td>
</tr>
<tr>
<td class="discussion-ed-stats">Two</td>
<td class="discussion-ed-stats"><?php echo $numberOfEditors['2']; ?></td>
</tr>
<tr>
<td class="discussion-ed-stats">Three</td>
<td class="discussion-ed-stats"><?php echo $numberOfEditors['3']; ?></td>
</tr>
<tr>
<td class="discussion-ed-stats">>Three</td>
<td class="discussion-ed-stats"><?php echo $moreThanThree; ?></td>
</tr>
</table>
</td>
<?php
if (USING_APPROVERS) {
?>
<td class="approval-ed-stats">
<table>
<tr>
<th class="approval-ed-stats" colspan="2">Approval Eds</th>
</tr>
<tr>
<td class="approval-ed-stats">Zero</td>
<td class="approval-ed-stats"><?php echo $numberOfApprovalEditors['0']; ?></td>
</tr>
<tr>
<td class="approval-ed-stats">One</td>
<td class="approval-ed-stats"><?php echo $numberOfApprovalEditors['1']; ?></td>
</tr>
<tr>
<td class="approval-ed-stats">Two</td>
<td class="approval-ed-stats"><?php echo $numberOfApprovalEditors['2']; ?></td>
</tr>
<tr>
<td class="approval-ed-stats">Three</td>
<td class="approval-ed-stats"><?php echo $numberOfApprovalEditors['3']; ?></td>
</tr>
<tr>
<td class="approval-ed-stats">>Three</td>
<td class="approval-ed-stats"><?php echo $moreThanThreeApproval; ?></td>
</tr>
</table>
</td>
<?php
}
$puzzleStatuses = getPuzzleStatuses();
$pstatusCol = ceil(count($puzzleStatuses) / $max_rows) * 2;
$statuses = NULL;
$statusCounts = getPuzzleStatusCounts();
foreach ($puzzleStatuses as $sid => $name) {
$count = (array_key_exists($sid, $statusCounts) ? $statusCounts[$sid] : 0);
$status = NULL;
$status['id'] = $sid;
$status['name'] = $name;
$status['count'] = $count;
$statuses[] = $status;
}
?>
<td class="p-stats">
<table>
<tr>
<th class="p-stats" colspan="<?php echo $pstatusCol; ?>">Puzzle Status</th>
</tr>
<?php
for ($row = 0; $row < $max_rows; $row++) {
for ($col = 0; $col < ($pstatusCol / 2); $col++) {
$n = $row + ($col * $max_rows);
if ($col==0) {
echo '
<tr>';
}
if ($n >= count($puzzleStatuses)) {
echo '
<td></td>';
echo '
<td></td>';
} else {
$num = $statuses[$n];
$name = $num['name'];
$count = $num['count'];
echo '
<td class="p-stats">' . $name . '</td>';
echo '
<td class="p-stats">' . $count . '</td>';
}
if ($col == ($pstatusCol/2 - 1)) {
echo '
</tr>';
}
}
}
?>
</table>
</td>
<td class="answer-stats">
<table>
<tr>
<th class="answer-stats" colspan="2"> Answer Status</th>
</tr>
<tr>
<td class="answer-stats"> Total Answers </td>
<td class="answer-stats"> <?php echo numAnswers(); ?> </td>
</tr>
<tr>
<td class="answer-stats"> Assigned </td>
<td class="answer-stats"> <?php echo answersAssigned(); ?> </td>
</tr>
<tr>
<td class="answer-stats"> Unassigned </td>
<td class="answer-stats"> <?php echo (numAnswers() - answersAssigned()); ?> </td>
</tr>
</table>
</td>
</tr></table>
<?php
}