summaryrefslogtreecommitdiff
path: root/core/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-04-22 04:20:05 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-04-22 04:20:05 +0000
commit1956a6ae954463f135fc37671143af538fb7f8df (patch)
treefa9471a7c175539a1053d6fa92660e829eb85eb3 /core/helpers
parent9d31564b7cfe067f5260e3bc904980f3cd3231a7 (diff)
Refactor the move functionality into a helper function so it can be
called from organize
Diffstat (limited to 'core/helpers')
-rw-r--r--core/helpers/core.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/helpers/core.php b/core/helpers/core.php
index 5e5a12a7..f8c08ca9 100644
--- a/core/helpers/core.php
+++ b/core/helpers/core.php
@@ -27,4 +27,18 @@ class core_Core {
Router::$method = "index";
}
}
+
+ static function move_item($source, $target) {
+ access::required("edit", $source);
+ access::required("edit", $target);
+ $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);
+ }
+ }
} \ No newline at end of file