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> <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 }
function displayChangePuzzleStatus($pid) { $statuses = getPuzzleStatuses(); $current = getStatusForPuzzle($pid); foreach ($statuses as $sid => $name) { echo "<input type ='radio' name='status' value='{$sid}'"; if ($sid == $current) { echo ' checked'; } echo " /> {$name}<br />"; } }
function getDeadStatusId() { // terrible hack to figure out which status ID is "dead" // so we can omit them by default from queue $statuses = getPuzzleStatuses(); $deadstatusid = array(); foreach ($statuses as $sid => $sname) { if (strtoupper($sname) == "DEAD") { $deadstatusid = $sid; } } return $deadstatusid; }
{ global $filt; if (count($filt) == 2 && $filt[0] == $key && $filt[1] == $value) { return "selected"; } return ""; } displayPuzzleStats($uid); ?> <div class="inlbox"> <form method="get" action="allpuzzles.php" class="inlform"> <input type="hidden" name="filterkey" value="status"> <select name="filtervalue"> <option value='-'>-</option> <?php $statuses = getPuzzleStatuses(); foreach ($statuses as $sid => $sname) { $slct = selected('status', $sid); echo "<option value='{$sid}' {$slct}>{$sname}</option>"; } ?> </select> <input type="submit" value="Filter status"> </form> <form method="get" action="allpuzzles.php" class="inlform"> <input type="hidden" name="filterkey" value="approver"> <select name="filtervalue"> <option value='-'>-</option> <?php $editors = getAllEditors(); if (USING_APPROVERS) {