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
|
<?php
/**
* Elgg friend collections add/edit
*
* @package Elgg
* @subpackage Core
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd
* @copyright Curverider Ltd 2008
* @link http://elgg.org/
*
* @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;
} else {
$action = "friends/addcollection";
$title = "";
}
$form_body = "<p><label>" . elgg_echo("friends:collectionname") . "<br />" .
elgg_view("input/text", array(
"internalname" => "collection_name",
"value" => $title,
)) . "</label></p>";
$form_body .= "<p>";
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 .= "</p>";
$form_body .= "<p><label>" . elgg_echo("friends:addfriends") . "<br />".
elgg_view('friends/picker',array('entities' => $vars['friends'], 'internalname' => 'friends_collection')) . "</label></p>";
$form_body .= "<p>";
if (isset($vars['collection'])) {
$form_body .= elgg_view('input/hidden', array('internalname' => 'collection_id', 'value' => "{$vars['collection'][0]->id}"));
}
$form_body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save')));
$form_body .= "</p>";
echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$vars['url']}action/$action"));
?>
|