You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1006 B
28 lines
1006 B
<?php
|
|
require_once INCLUDE_DIR . 'class.export.php';
|
|
|
|
class ExportAjaxAPI extends AjaxController {
|
|
|
|
function check($id) {
|
|
global $thisstaff;
|
|
|
|
if (!$thisstaff)
|
|
Http::response(403, 'Agent login is required');
|
|
elseif (!($exporter=Exporter::load($id)) || !$exporter->isAvailable())
|
|
Http::response(404, 'No such export');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
if ($exporter->isReady())
|
|
Http::response(201, $this->json_encode([
|
|
'status' => 'ready',
|
|
'href' => sprintf('export.php?id=%s',
|
|
$exporter->getId()),
|
|
'filename' => $exporter->getFilename()]));
|
|
else // Export is not ready... checkback in a few
|
|
Http::response(200, $this->json_encode([
|
|
'status' => 'notready']));
|
|
}
|
|
|
|
include STAFFINC_DIR . 'templates/export.tmpl.php';
|
|
}
|
|
}
|