function _node_resource_index in Services 7
Same name and namespace in other branches
- 6.3 resources/node_resource.inc \_node_resource_index()
- 6.2 services/node_service/node_resource.inc \_node_resource_index()
- 7.3 resources/node_resource.inc \_node_resource_index()
1 string reference to '_node_resource_index'
- node_resource_service_resource in services/
node_service/ node_resource.module
File
- services/
node_service/ node_resource.inc, line 74
Code
function _node_resource_index($page = 0, $fields = array(), $parameters = array()) {
if (module_exists('query_builder')) {
$builder = new QueryBuilder();
$parameters = (array) $parameters;
if (isset($parameters['__describe'])) {
return $builder
->describe();
}
if (is_string($fields) && !empty($fields)) {
$fields = preg_split('/,\\s?/', $fields);
}
if (!user_access('administer nodes') || !isset($parameters['status'])) {
$parameters['status'] = 1;
}
list($sql, $params) = $builder
->query($fields, $parameters);
}
else {
$sql = "SELECT * FROM {node} WHERE status=1 ORDER BY sticky DESC, created DESC";
}
$res = db_query_range($sql, $params, $page * 20, 20);
$events = array();
while ($event = db_fetch_object($res)) {
$event->uri = services_resource_uri(array(
'node',
$event->nid,
));
$events[] = $event;
}
return $events;
}