39 lines
973 B
PHP
39 lines
973 B
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 GetStatsBranch extends ApiBranch
|
||
|
{
|
||
|
function get(ParamCleaner $params)
|
||
|
{
|
||
|
respondStatus(405);
|
||
|
}
|
||
|
|
||
|
function post(ParamCleaner $params)
|
||
|
{
|
||
|
$user_id = $params->get("user_id");
|
||
|
|
||
|
$from_date = date("Y-m-d");
|
||
|
if ($params->exists(["from_date"])) {
|
||
|
$from_date = $params->get("from_date");
|
||
|
}
|
||
|
$until_date = date("Y-m-d");
|
||
|
if ($params->exists(["until_date"])) {
|
||
|
$until_date = $params->get("until_date");
|
||
|
}
|
||
|
|
||
|
$stats = getStats($user_id, $from_date, $until_date);
|
||
|
|
||
|
$json = new JsonBuilder();
|
||
|
$json->addStats($stats);
|
||
|
|
||
|
respondJson($json);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$branch = new GetStatsBranch();
|
||
|
$branch->execute();
|