summaryrefslogtreecommitdiff
path: root/core/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-04-29 15:57:29 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-04-29 15:57:29 +0000
commit820cbdf1c3a4810a1f00c16beee729e28a0d3056 (patch)
treee06191232a3b42fcf83abe089cf15905ee5109d7 /core/helpers
parent33122e8968e2d7890f7fabe45ce168aa0d217bbb (diff)
Refactor the creation and removal of the album covers into
make_album_cover and remove_album_cover methods in Item_Model. Usage: $photo->make_album_cover() $album->remove_album_cover()
Diffstat (limited to 'core/helpers')
-rw-r--r--core/helpers/core.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/helpers/core.php b/core/helpers/core.php
index f8c08ca9..4c73f148 100644
--- a/core/helpers/core.php
+++ b/core/helpers/core.php
@@ -31,14 +31,17 @@ class core_Core {
static function move_item($source, $target) {
access::required("edit", $source);
access::required("edit", $target);
+
+ $parent = $source->parent();
+ if ($parent->album_cover_item_id == $source->id) {
+ $parent->remove_album_cover();
+ }
+
$source->move_to($target);
// If the target has no cover item, make this it.
if ($target->album_cover_item_id == null) {
- $target->album_cover_item_id =
- $source->is_album() ? $source->album_cover_item_id : $source->id;
- $target->save();
- graphics::generate($target);
+ $source->make_album_cover();
}
}
} \ No newline at end of file