aboutsummaryrefslogtreecommitdiff
path: root/views/default/friends/forms/edit.php
blob: e4065e67e0ce8deb0c9defd252b1d00ee0db1b5d (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?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"));
?>

<!-- 	<form action="<?php echo $vars['url']; ?>action/<?php echo $action; ?>" method="post">
		<p>
			<label><?php echo elgg_echo("friends:collectionname"); ?><br />
			<?php

				echo elgg_view("input/text", array(
									"internalname" => "collection_name",
									"value" => $title,
													));
			
			?>
			</label>
		</p>
		<p>
		<?php
		    if($vars['collection_members']){
    		    echo elgg_echo("friends:collectionfriends") . "<br />";
        	    foreach($vars['collection_members'] as $mem){
            	    
            	   echo elgg_view("profile/icon",array('entity' => $mem, 'size' => 'tiny'));
            	   echo $mem->name;
  
        	    }
    	    }
    	?>
    	</p>
		<p>
			<label><?php echo elgg_echo("friends:addfriends"); ?><br />
			<?php

				//echo elgg_view('friends/friendslist');
				echo elgg_view('friends/picker',array('entities' => $vars['friends'], 'internalname' => 'friends_collection'));
			
			?>
			</label>
		</p>
		<p>
			<?php

				if (isset($vars['collection'])) {
					?><input type="hidden" name="collection_id" value="<?php echo $vars['collection'][0]->id; ?>" /><?php
				}
			
			?>
			<input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" />
		</p>
	
	</form> -->