public function testAgo() { $datetime = DateUtils::daysAgo(1, 1405267200); $this->assertInternalType('string', $datetime); $expected = '2014-07-12 16:00:00'; $this->assertEquals($expected, $datetime); }
if (!$response) { $response = ['message' => __t('unable_to_find_record_in_x_with_id_x', ['table' => $table, 'id' => $id]), 'success' => false]; } JsonView::render($response); })->via('DELETE', 'GET', 'PUT', 'PATCH'); /** * ACTIVITY COLLECTION */ // @todo: create different activity endpoints // ex: /activity/:table, /activity/recents/:days $app->get("/{$v}/activity/?", function () use($params, $ZendDb, $acl) { $Activity = new DirectusActivityTableGateway($acl, $ZendDb); // @todo move this to backbone collection if (!$params['adv_search']) { unset($params['perPage']); $params['adv_search'] = 'datetime >= "' . DateUtils::daysAgo(30) . '"'; } $new_get = $Activity->fetchFeed($params); $new_get['active'] = $new_get['total']; JsonView::render($new_get); }); /** * COLUMNS COLLECTION */ // GET all table columns, or POST one new table column $app->map("/{$v}/tables/:table/columns/?", function ($table_name) use($ZendDb, $params, $requestPayload, $app, $acl) { $params['table_name'] = $table_name; if ($app->request()->isPost()) { /** * @todo check if a column by this name already exists * @todo build this into the method when we shift its location to the new layer