42 lines
1 KiB
PHP
42 lines
1 KiB
PHP
<?php
|
|
session_start();
|
|
require_once(__DIR__ . "/services/apiBranch.inc.php");
|
|
require_once(__DIR__ . "/services/jsonBuilder.inc.php");
|
|
require_once(__DIR__ . "/services/responses.inc.php");
|
|
require_once(__DIR__ . "/services/jugglDbApi.inc.php");
|
|
|
|
class GetRecordsBranch extends ApiBranch
|
|
{
|
|
function get(ParamCleaner $params)
|
|
{
|
|
respondStatus(405);
|
|
}
|
|
|
|
function post(ParamCleaner $params)
|
|
{
|
|
$user_id = $params->get("user_id");
|
|
|
|
$limit = NULL;
|
|
if ($params->exists(["limit"])) {
|
|
$limit = $params->get("limit");
|
|
}
|
|
$finished = NULL;
|
|
if ($params->exists(["finished"])) {
|
|
$finished = $params->get("finished");
|
|
}
|
|
$visible = NULL;
|
|
if ($params->exists(["visible"])) {
|
|
$visible = $params->get("visible");
|
|
}
|
|
|
|
$records = getRecords($user_id, $limit, $finished, $visible);
|
|
|
|
$json = new JsonBuilder();
|
|
$json->addRecords($records);
|
|
|
|
respondJson($json);
|
|
}
|
|
}
|
|
|
|
$branch = new GetRecordsBranch();
|
|
$branch->execute();
|