Example #1
0
function displayStatus($uid, $pid)
{
    $status = getStatusNameForPuzzle($pid);
    ?>
    <table class="statusInfo">
        <tr>
            <td class='statusInfo'>
                <strong>Puzzle Status: </strong> <?php 
    echo $status;
    ?>
            </td>
            <td class='statusInfo'>
                <?php 
    if (canChangeStatus($uid)) {
        ?>
<a href="#" class="changeLink">[Change]</a><?php 
    }
    ?>
            </td>
        </tr>
    <?php 
    if (canChangeStatus($uid)) {
        ?>
        <tr>
            <td colspan='3'>
                <table>
                <form method="post" action="form-submit.php">
                        <input type="hidden" name="uid" value="<?php 
        echo $uid;
        ?>
" />
                        <input type="hidden" name="pid" value="<?php 
        echo $pid;
        ?>
" />
                    <tr>
                        <td>
                            <p><strong>Change Puzzle Status:</strong></p>
                            <?php 
        echo displayChangePuzzleStatus($pid);
        ?>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input type="submit" name="changeStatus" value="Change Status" />
                        </td>
                    </tr>
                </form>
                </table>
            </td>
        </tr>
    <?php 
    }
    ?>
    </table>
<?php 
}
<?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();
header("Content-type: text/json");
$puzzles = getPuzzlesInPostprodAndLater($uid);
$exportdata = array();
foreach ($puzzles as $pid) {
    # pid, status, title, slug, round name, round slug.
    $status = getStatusNameForPuzzle($pid);
    $title = getTitle($pid);
    $titleslug = postprodCanon($title);
    $rinfo = getRoundForPuzzle($pid);
    $answer = getAnswersForPuzzleAsList($pid);
    if ($rinfo) {
        $roundname = $rinfo['name'];
        $roundslug = postprodCanonRound($roundname);
        $exportdata[] = array('url' => "/{$roundslug}/{$titleslug}/", 'pid' => $pid, 'status' => $status, 'title' => $title, 'titleslug' => $titleslug, 'round' => $roundname, 'roundslug' => $roundslug, 'answer' => $answer);
    }
}
print json_encode($exportdata) . "\n";
Example #3
0
function displayAnswers($uid)
{
    $rounds = getRounds();
    if (!$rounds) {
        ?>
<span class="emptylist">No rounds to list</span>
<?php 
    }
    foreach ($rounds as $round) {
        $answers = getAnswersForRound($round['rid']);
        ?>
        <table class="boxed">
        <tr><th colspan="6"><b><?php 
        echo "{$round['name']}: {$round['answer']}";
        ?>
</b></th></tr>
            <tr>
                <td><b>Answer</b></td>
                <td><b>ID</b></td>
                <td><b>Title</b></td>
                <td><b>Status</b></td>
                <td><b>Editor Notes</b></td>
                <td><b>Status Notes</b></td>
            </tr>
    <?php 
        if (!$answers) {
            ?>
            <tr><td colspan="6"><span class="emptylist">No answers added yet</span></td></tr>
    <?php 
        }
        foreach ($answers as $answer) {
            $pid = $answer['pid'];
            ?>
            <tr><td><?php 
            echo $answer['answer'];
            ?>
</td>
                <td><?php 
            echo $pid ? "<a href=\"puzzle.php?pid={$pid}\">" . $pid . "</a>" : "unassigned";
            ?>
</td>
                <td><?php 
            echo $pid ? getTitle($pid) : "";
            ?>
</td>
                <td><?php 
            echo $pid ? getStatusNameForPuzzle($pid) : "";
            ?>
</td>
                <td><?php 
            echo $pid ? getEditorNotes($pid) : "";
            ?>
</td>
                <td><?php 
            echo $pid ? getNotes($pid) : "";
            ?>
</td>
            </tr>
    <?php 
        }
        ?>

            <tr>
                <form method="post" action="answers.php" />
                <td><input type="text" name="newAnswer" />
                <input type="hidden" name="round" value='<?php 
        echo $round['rid'];
        ?>
'/></td>
                <td colspan="5"><input type="submit" value='Add Answer For Round <?php 
        echo $round['rid'];
        ?>
' /></td></form>
            </tr>
        </table>
        <br />
<?php 
    }
    ?>
    <table class="boxed">
        <tr><th colspan="3"><b>New Round</b></th></tr>
        <tr>
            <td>Round Name</td><td>Meta Answer Word</td><td></td>
        </tr>
        <tr>
            <form method="post" action="answers.php" />
            <td><input type="text" name="newRound" /></td>
            <td><input type="text" name="roundAnswer" /></td>
            <td><input type="submit" value="Add New Round" /></td></form>
        </tr>
    </table>
<?php 
}