aboutsummaryrefslogtreecommitdiff
path: root/mod/bookmarks/views/default/bookmarks/form.php
blob: 7273836e26214dd4b5a6ce7db4aa91a0c50afc02 (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
109
<?php

/**
 * Elgg bookmarks plugin form
 * 
 * @package ElggBookmarks
 */

if(isset($vars['entity'])){
	$guid = $vars['entity']->guid;
	$title = $vars['entity']->title;
	$address = $vars['entity']->address;
	$access_id = $vars['entity']->access_id;
	$tags = $vars['entity']->tags;
	$notes = $vars['entity']->description;
	$owner = get_entity($vars['entity']->container_guid);
	$url = "action/bookmarks/edit";
}else{
	//set some variables
	$guid = '';
	$title = get_input('title',"");
	$title = stripslashes($title); // strip slashes from URL encoded apostrophes
	$address = get_input('address',"");
	$notes = '';
	if ($address == "previous")
		$address = $_SERVER['HTTP_REFERER'];
	$tags = array();
	if(elgg_get_page_owner() instanceof ElggGroup){
		//if in a group, set the access level to default to the group
		$access_id = elgg_get_page_owner()->group_acl;
	}else{
		$access_id = get_default_access(get_loggedin_user());
	}
	$owner = get_loggedin_user();
	$url = "action/bookmarks/add";
}
?>
<form id="bookmark_edit_form" class="margin-top" action="<?php echo elgg_get_site_url() . $url; ?>" method="post">
	<?php echo elgg_view('input/securitytoken'); ?>
	<p>
		<label>
			<?php 	echo elgg_echo('title'); ?>
			<?php
					echo elgg_view('input/text',array(
							'internalname' => 'title',
							'value' => $title,
					)); 
			?>
		</label>
	</p>
	<p>
		<label>
			<?php 	echo elgg_echo('bookmarks:address'); ?>
			<?php
					echo elgg_view('input/url',array(
							'internalname' => 'address',
							'value' => $address,
					)); 
			?>
		</label>
	</p>
	<p>
		<label>
			<?php 	echo elgg_echo('bookmarks:addnote'); ?>
			<br />
			<?php

					echo elgg_view('input/text',array(
							'internalname' => 'notes',
							'value' => $notes,
					)); 
			
			?>
		</label>
	</p>
	<p>
		<label>
			<?php 	echo elgg_echo('tags'); ?>
			<?php
					echo elgg_view('input/tags',array(
							'internalname' => 'tags',
							'value' => $tags,
					)); 
			?>
		</label>
	</p>
	<p>
		<label>
			<?php 	echo elgg_echo('access'); ?>
			<?php
					//if it is a group, pull out the group access view
					if(elgg_get_page_owner() instanceof ElggGroup){
						$access_options = group_access_options($owner);
						echo elgg_view('input/access', array('internalname' => 'access', 
																		'value' => $access_id, 
																		'options' => $access_options));
					}else{
						echo elgg_view('input/access', array('internalname' => 'access', 
																		'value' => $access_id));
					}
			?>
		</label>
	</p>
	<p>
		<?php echo $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; ?>
		<input type="hidden" value="<?php echo $guid; ?>" name="guid" />
		<input type="submit" onfocus="blur()" value="<?php echo elgg_echo('save'); ?>" />
	</p>
</form>