diff options
author | cash <cash.costello@gmail.com> | 2011-11-19 23:13:26 -0500 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2011-11-19 23:13:26 -0500 |
commit | c51b483f24936c8d04a54a6999412937ec21c49a (patch) | |
tree | d45e3b9ede0115e3ce3b84ea1622bfc98d7470a0 /actions/photos/batch | |
parent | 98664daa72a390fe760b69116af8bfa9327826e3 (diff) | |
download | elgg-c51b483f24936c8d04a54a6999412937ec21c49a.tar.gz elgg-c51b483f24936c8d04a54a6999412937ec21c49a.tar.bz2 |
uploading photos through the basic interface works now
Diffstat (limited to 'actions/photos/batch')
-rw-r--r-- | actions/photos/batch/edit.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/actions/photos/batch/edit.php b/actions/photos/batch/edit.php new file mode 100644 index 000000000..6d376a9db --- /dev/null +++ b/actions/photos/batch/edit.php @@ -0,0 +1,42 @@ +<?php +/** + * Edit the images in a batch + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$guids = get_input('guid'); +$titles = get_input('title'); +$captions = get_input('caption'); +$tags = get_input('tags'); + +$not_updated = array(); +foreach ($guids as $key => $guid) { + $image = get_entity($guid); + + if ($image->canEdit()) { + + // set title appropriately + if ($titles[$key]) { + $image->title = $titles[$key]; + } else { + $image->title = substr($image->originalfilename, 0, strrpos($image->originalfilename, '.')); + } + + // set description appropriately + $image->description = $captions[$key]; + $image->tags = string_to_tag_array($tags[$key]); + + if (!$image->save()) { + array_push($not_updated, $image->getGUID()); + } + } +} + +if (count($not_updated) > 0) { + register_error(elgg_echo("images:notedited")); +} else { + system_message(elgg_echo("images:edited")); +} +forward($image->getContainerEntity()->getURL()); |