aboutsummaryrefslogtreecommitdiff
path: root/pages/edit_multiple.php
blob: 938ac203c9c4c248ee59d859260bda25bf5bbcc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
 * Tidypics: Edit the properties of multiple images
 *
 * Called after upload only
 */

include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";

gatekeeper();
set_context('photos');

set_page_owner(get_loggedin_userid());


$batch = get_input('batch');
if ($batch) {
	$images = get_entities_from_metadata('batch', $batch, 'object', 'image', get_loggedin_userid(), 100);
} else {
	// parse out photo guids
	$file_string = get_input('files');
	$file_array_sent = explode('-', $file_string);

	$images = array();
	foreach ($file_array_sent as $file_guid) {
		if ($entity = get_entity($file_guid)) {
			if ($entity->canEdit()) {
				array_push($images, $entity);
			}
		}
	}
}

if (!$images) {
	forward($_SERVER['HTTP_REFERER']);
}


$title = elgg_echo('tidypics:editprops');

$content .= elgg_view_title($title);
$content .= elgg_view("tidypics/forms/edit_multi", array('images' => $images));

$body = elgg_view_layout('two_column_left_sidebar', '', $content);
page_draw($title, $body);