forked from eastern-toys/puzzle-editing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postprod-export.php
26 lines (24 loc) · 977 Bytes
/
postprod-export.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
<?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";