protected function _get_page_links($count, $offset, $limit) { $links = array(); $route = Route::name($this->request->route()); $query = $this->request->query(); $internal = array('kohana_uri' => null, 'oauth_consumer_key' => null, 'oauth_nonce' => null, 'oauth_signature_method' => null, 'oauth_timestamp' => null, 'oauth_token' => null, 'oauth_version' => null, 'oauth_signature' => null); $query = array_diff_key($query, $internal); $query['limit'] = $limit; if ($count > ($query['offset'] = $offset + $limit)) { $links[] = Controller_Resources::to_href('next', $route, $this->request->param(), $query); } if (0 <= ($query['offset'] = $offset - $limit)) { $links[] = Controller_Resources::to_href('previous', $route, $this->request->param(), $query); } return $links; }
/** * Return the link using routename. * * @param string $rel Relationship of the route name to the resource * @param string $route_name Route Name * @param array $parameters Parameters required for the route * @return array Standard ReST HATEOAS */ public function to_rest_href($rel, $route_name, $parameters = array(), $query = array(), $method = Controller_Resources::METHOD_GET) { return Controller_Resources::to_href($rel, $route_name, $parameters, $query, $method); }