aboutsummaryrefslogtreecommitdiff
path: root/pages/viewalbum.php
blob: 870596769c6b2932a0f0c041b86cb7a8b77346c1 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php

/**
 * Tidypics Album View Page
 *
 * This displays a listing of all the photos that belong to an album
 */

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

// if this page belongs to a closed group, prevent anyone outside group from seeing
if (is_callable('group_gatekeeper')) {
	group_gatekeeper();
}

// get the album entity
$album_guid = (int) get_input('guid');
$album = get_entity($album_guid);

// panic if we can't get it
if (!$album) {
	forward();
}

// container should always be set, but just in case
if ($album->container_guid) {
	set_page_owner($album->container_guid);
} else {
	set_page_owner($album->owner_guid);
}

$owner = page_owner_entity();

// setup group menu
if ($owner instanceof ElggGroup) {
	add_submenu_item(	sprintf(elgg_echo('album:group'),$owner->name),
			$CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
}

// allow other plugins to override the slideshow
$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array('album' => $album), null);
if ($slideshow_link) {
	add_submenu_item(elgg_echo('album:slideshow'),
			$slideshow_link,
			'photos' );
}

if (can_write_to_container(0, $album->container_guid)) {
	if ($owner instanceof ElggGroup) {
		add_submenu_item(	elgg_echo('album:create'),
				$CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
				'photos');
	}
	add_submenu_item(	elgg_echo('album:addpix'),
			$CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid,
			'photos');
	add_submenu_item(	elgg_echo('album:sort'),
			$CONFIG->wwwroot . 'pg/photos/sort/' . $album_guid,
			'photos');
	add_submenu_item(	elgg_echo('album:edit'),
			$CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid,
			'photos');
	$ts = time();
	$token = generate_action_token($ts);
	add_submenu_item(	elgg_echo('album:delete'),
			$CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $album_guid . '&amp;__elgg_token=' . $token . '&amp;__elgg_ts=' . $ts,
			'photos',
			true);
}

// create body
$area2 = elgg_view_entity($album, true);
$body = elgg_view_layout('two_column_left_sidebar', '', $area2);

page_draw($album->title, $body);