aboutsummaryrefslogtreecommitdiff
path: root/views/default/tidypics/forms/setupFlickr.php
blob: 8ae7c27bb8876774390e6df12342a937ea8daa1b (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
<?php
require_once( dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . "/lib/flickr.php";

$user = get_loggedin_user();
$flickr_username = get_metadata_byname( $user->guid, "flickr_username" );
$flickr_album_id = get_metadata_byname( $user->guid, "flickr_album_id" );

$action = $vars['url'] . 'action/tidypics/flickrSetup';

$form_body = "<p>";
$form_body .= "Please enter your Flickr username here: <input style='width: 20%;' type='text' name='flickr_username' value='$flickr_username->value' ' class='input-text' /> <br />";
$form_body .= "<input type='hidden' name='return_url' value='$_SERVER[REQUEST_URI]' />";

$albums = get_entities( "object", "album", $user->guid );
$options = array( 0 => "Select album" );
foreach( $albums as $album ) {
	$title = $album->title;
	switch( $album->access_id ) {
		case ACCESS_PRIVATE:
			$title .= " (private)";
			break;
		case ACCESS_PUBLIC:
			$title .= " (public)";
			break;
		default:
			$title .= " (not sure)";
			break;
	}
	$options[$album->guid] = $title;
}

$form_body .= "<br />Album to import photos to: ";
$form_body .= elgg_view('input/pulldown', array('internalname' => 'album_id',
												'options_values' => $options,
												'value' => $flickr_album_id->value ));
$form_body .= "<br />";
$form_body .= elgg_view('input/submit', array('value' => elgg_echo("save")));

flickr_menu();

echo elgg_view('input/form', array('action' => $action, 'body' => $form_body));
?>