Exemplo n.º 1
0
    echo json_encode(array("id" => $result));
});
$app->post('/rating/list', function () {
    $request = \Slim\Slim::getInstance()->request();
    $rating = json_decode($_POST["json"]);
    $ratingDAO = new Rating();
    $result = $ratingDAO->list_($rating);
    if (sizeof($result) > 0) {
        echo json_encode($result);
    } else {
        echo json_encode(array(array("id" => "false")));
    }
});
$app->get('/commentary', function () {
    $commentaryDAO = new Commentary();
    $result = $commentaryDAO->get();
    echo json_encode($result);
});
$app->post('/commentary/set', function () {
    $request = \Slim\Slim::getInstance()->request();
    $commentary = json_decode($_POST["json"]);
    $commentaryDAO = new Commentary();
    $commentaryDAO->insert($commentary);
    $result = array();
    $result["success"] = true;
    echo json_encode($result);
});
$app->post('/commentary/delete', function () {
    $request = \Slim\Slim::getInstance()->request();
    $commentary = json_decode($_POST["json"]);
    $commentaryDAO = new Commentary();