public function doGet() { $r = DepartamentoResource::getInstance(); if ($r->getRequest("limit")) { ok_header(); require "../lib/util/LimitHelper.php"; LimitHelper::init($r->getRequest("limit")); echo LimitHelper::json(); } else { if ($r->getRequest("id")) { // departamento } else { // todos os departamentos } } }
require "../app/project.php"; require "../lib/util/LimitHelper.php"; ?> <?php getController("Departamento"); ?> <?php function limit_query() { return DepartamentoController::cadastrados(); } function json_itens($v) { return json_transposta($v->get_array(), "id,nome"); } function get_limit() { return LimitHelper::$limit; } ?> <?php if (isset($_GET["limit"])) { LimitHelper::init($_GET["limit"]); echo LimitHelper::json(); } else { bad_request_header(); }