diff options
author | Cash Costello <cash.costello@gmail.com> | 2010-10-31 12:47:25 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2010-10-31 12:47:25 +0000 |
commit | 92ec25ec441330323e4fcbdfa33ebcf900420097 (patch) | |
tree | 5516b59d4feced2cd7bc1b60f2b897ce42a63354 /actions/upload.php | |
parent | f1b63cb2469bd332a20ed8f47109ab52f6381f4c (diff) | |
download | elgg-92ec25ec441330323e4fcbdfa33ebcf900420097.tar.gz elgg-92ec25ec441330323e4fcbdfa33ebcf900420097.tar.bz2 |
integrated Jeff's batch code into trunk
Diffstat (limited to 'actions/upload.php')
-rw-r--r-- | actions/upload.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/actions/upload.php b/actions/upload.php index b3ad9ebc3..f2b626f01 100644 --- a/actions/upload.php +++ b/actions/upload.php @@ -120,11 +120,6 @@ foreach($_FILES as $key => $sent_file) { $file->extractExifData(); $file->saveThumbnails($image_lib); - //keep one file handy so we can add a notice to the river if single image option selected - if (!$file_for_river) { - $file_for_river = $file; - } - array_push($uploaded_images, $file->guid); // plugins can register to be told when a new image has been uploaded @@ -171,11 +166,24 @@ if (count($not_uploaded) > 0) { system_message(elgg_echo('tidypics:upl_success')); } +if (count($uploaded_images)) { + // Create a new batch object to contain these photos + $batch = new ElggObject(); + $batch->subtype = "tidypics_batch"; + $batch->access_id = $access_id; + $batch->container_guid = $album_guid; -if (count($uploaded_images) && $img_river_view == "1") { - add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID()); + if ($batch->save()) { + foreach ($uploaded_images as $uploaded_guid) { + add_entity_relationship($uploaded_guid, "belongs_to_batch", $batch->getGUID()); + } + if ($img_river_view == "batch") { + add_to_river('river/object/tidypics_batch/create', 'create', $batch->getObjectOwnerGUID(), $batch->getGUID()); + } + } } + if (count($uploaded_images) > 0) { $album->prependImageList($uploaded_images); } |