summaryrefslogtreecommitdiff
path: root/modules/gallery/models
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-06-10 08:16:07 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-06-10 08:16:07 -0700
commit6119ddc735ccfa6816b78bb7028c56dabf322019 (patch)
treeb9cccdf2fb28e67b5cf37b26d0e0635a8cf7ad2a /modules/gallery/models
parentd5b80f29444e03aadc1130ab1624a09c0689fb93 (diff)
parent26d0af45eabe962c5366cb1e95de7e252b831796 (diff)
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules/gallery/models')
-rw-r--r--modules/gallery/models/item.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 409ed3cc..009457c1 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -924,17 +924,21 @@ class Item_Model extends ORM_MPTT {
/**
* Same as ORM::as_array() but convert id fields into their RESTful form.
*/
- public function as_restful_array() {
+ public function as_restful_array($convert_ids=true) {
// Convert item ids to rest URLs for consistency
$data = $this->as_array();
- if ($tmp = $this->parent()) {
- $data["parent"] = rest::url("item", $tmp);
- }
- unset($data["parent_id"]);
- if ($tmp = $this->album_cover()) {
- $data["album_cover"] = rest::url("item", $tmp);
+
+ if ($convert_ids) {
+ if ($tmp = $this->parent()) {
+ $data["parent"] = rest::url("item", $tmp);
+ }
+ unset($data["parent_id"]);
+
+ if ($tmp = $this->album_cover()) {
+ $data["album_cover"] = rest::url("item", $tmp);
+ }
+ unset($data["album_cover_item_id"]);
}
- unset($data["album_cover_item_id"]);
if (access::can("view_full", $this) && $this->is_photo()) {
$data["file_url"] = $this->file_url(true);
@@ -944,6 +948,7 @@ class Item_Model extends ORM_MPTT {
$data["resize_url"] = $tmp;
}
$data["thumb_url"] = $this->thumb_url(true);
+ $data["can_edit"] = access::can("edit", $this);
// Elide some internal-only data that is going to cause confusion in the client.
foreach (array("relative_path_cache", "relative_url_cache", "left_ptr", "right_ptr",