From 141595e7096befe63d5c8a7176986f2e7bacbb5c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 14 Feb 2010 07:35:03 -0800 Subject: Create an items REST collection requests that accepts a list of resource urls and returns the items associated with them. --- modules/gallery/helpers/items_rest.php | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 modules/gallery/helpers/items_rest.php (limited to 'modules') diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php new file mode 100644 index 00000000..c4dd4a5f --- /dev/null +++ b/modules/gallery/helpers/items_rest.php @@ -0,0 +1,44 @@ +params->url)) { + foreach($request->params->url as $url) { + $item = rest::resolve($url); + if (access::can("view", $item)) { + $members = array(); + if ($item->type == "album") { + foreach ($item->children() as $child) { + $members[] = rest::url("item", $child); + } + } + $items[] = array("url" => $url, + "entity" => $item->as_restful_array(), + "members" => $members, + "relationship" => rest::relationships("item", $item)); + } + } + } + + return $items; + } +} -- cgit v1.2.3