aboutsummaryrefslogtreecommitdiff
path: root/actions/ajax_upload_complete.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2010-10-31 12:47:25 +0000
committerCash Costello <cash.costello@gmail.com>2010-10-31 12:47:25 +0000
commit92ec25ec441330323e4fcbdfa33ebcf900420097 (patch)
tree5516b59d4feced2cd7bc1b60f2b897ce42a63354 /actions/ajax_upload_complete.php
parentf1b63cb2469bd332a20ed8f47109ab52f6381f4c (diff)
downloadelgg-92ec25ec441330323e4fcbdfa33ebcf900420097.tar.gz
elgg-92ec25ec441330323e4fcbdfa33ebcf900420097.tar.bz2
integrated Jeff's batch code into trunk
Diffstat (limited to 'actions/ajax_upload_complete.php')
-rw-r--r--actions/ajax_upload_complete.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/actions/ajax_upload_complete.php b/actions/ajax_upload_complete.php
index 0912854a3..b66b563e3 100644
--- a/actions/ajax_upload_complete.php
+++ b/actions/ajax_upload_complete.php
@@ -21,6 +21,29 @@ if ($album->new_album == TP_NEW_ALBUM) {
add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);
}
+$params = array(
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'metadata_names' => 'batch',
+ 'metadata_values' => get_input('batch'),
+);
+$images = elgg_get_entities_from_metadata($params);
+if ($images) {
+ // Create a new batch object to contain these photos
+ $batch = new ElggObject();
+ $batch->subtype = "tidypics_batch";
+ $batch->access_id = ACCESS_PUBLIC;
+ $batch->container_guid = $album->guid;
+ if ($batch->save()) {
+ foreach ($images as $image) {
+ add_entity_relationship($image->guid, "belongs_to_batch", $batch->getGUID());
+ }
+ if (get_plugin_setting('img_river_view', 'tidypics') == "batch") {
+ add_to_river('river/object/tidypics_batch/create', 'create', $batch->getObjectOwnerGUID(), $batch->getGUID());
+ }
+ }
+}
+
// plugins can register to be told when a Tidypics album has had images added
trigger_elgg_event('upload', 'tp_album', $album);