aboutsummaryrefslogtreecommitdiff
path: root/views/default/forms/friends/edit.php
blob: 194aa5ff7f4619745d9aebda685db7df6c6b8fad (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
<?php
/**
 * Elgg friend collections add/edit
 *
 * @package Elgg
 * @subpackage Core
 *
 * @uses $vars['object'] Optionally, the collection edit
 */

// var_export($vars['collection'][0]->id);

// Set title, form destination
if (isset($vars['collection'])) {
	$action = "friends/editcollection";
	$title = $vars['collection'][0]->name;
	$highlight = 'default';
} else  {
	$action = "friends/addcollection";
	$title = "";
	$highlight = 'all';
}


$form_body = "<div class='contentWrapper'><div><label>" . elgg_echo("friends:collectionname") . "<br />" .
	elgg_view("input/text", array(
		"name" => "collection_name",
		"value" => $title,
	)) . "</label></div>";

$form_body .= "<div>";

if($vars['collection_members']){
	$form_body .= elgg_echo("friends:collectionfriends") . "<br />";
	foreach($vars['collection_members'] as $mem){
		$form_body .= elgg_view("profile/icon",array('entity' => $mem, 'size' => 'tiny'));
		$form_body .= $mem->name;
	}
}

$form_body .= "</div>";

$form_body .= "<div><label>" . elgg_echo("friends:addfriends") . "</label>".
			elgg_view('core/friends/picker',array('entities' => $vars['friends'], 'name' => 'friends_collection', 'highlight' => $highlight)) . "</div>";

$form_body .= "<div>";
if (isset($vars['collection'])) {
	$form_body .= elgg_view('input/hidden', array('name' => 'collection_id', 'value' => "{$vars['collection'][0]->id}"));
}
$form_body .= elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('save')));
$form_body .= "</div></div>";

echo $form_body;