aboutsummaryrefslogtreecommitdiff
path: root/views/default/friends/forms/edit.php
blob: d9434f10b94ca6dae8d22f60ad1ceb760cfd9ead (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
<?php

	/**
	 * Elgg friend collections add/edit 
	 * 
	 * @package Elgg
	 * @subpackage Core
	 * @author Curverider Ltd
	 * @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;
			$highlight = 'default';
		} else  {
			$action = "friends/addcollection";
			$title = "";
			$highlight = 'all';
	    }

	    
	    $form_body = "<div class='contentWrapper'><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") . "</label>". 
        				elgg_view('friends/picker',array('entities' => $vars['friends'], 'internalname' => 'friends_collection', 'highlight' => $highlight)) . "</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></div>";
		
		echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$vars['url']}action/$action"));
?>