aboutsummaryrefslogtreecommitdiff
path: root/views/default/core/friends/collectiontabs.php
blob: 2fafe6a8c4cc56d61e1c7eea46966bfa27aec861 (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
<?php
/**
 * Elgg friends collections
 * Lists a user's friends collections
 *
 * @package Elgg
 * @subpackage Core
 *
 * @uses $vars['collections'] The array of friends collections
 */

$friendspicker = $vars['friendspicker'];

$collectionid = $vars['collection']->id;
$ownerid = $vars['owner']->getGUID();

?>

<ul class="elgg-tabs">
	<li class="elgg-state-selected">
		<a href="#" class="collectionmembers<?php echo $friendspicker; ?>">
			<?php echo elgg_echo('friends:collections:members'); ?>
		</a>
	</li>
	<li>
		<a href="#" class="editmembers<?php echo $friendspicker; ?>">
			<?php echo elgg_echo('friends:collections:edit'); ?>
		</a>
	</li>
</ul>

<?php //@todo JS 1.8: no ?>
<script type="text/javascript">
$(document).ready(function () {

	$('a.collectionmembers<?php echo $friendspicker; ?>').click(function () {
		// load collection members pane
		$('#friends-picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo elgg_get_site_url(); ?>pages/friends/collections/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=list&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>');

		// remove selected state from previous tab
		$(this).parent().parent().find("li.elgg-state-selected").removeClass("elgg-state-selected");
		// add selected class to current tab
		$(this).parent().addClass("elgg-state-selected");

		return false;
	});

	$('a.editmembers<?php echo $friendspicker; ?>').click(function () {
		// load friends picker pane
		$('#friends-picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo elgg_get_site_url(); ?>pages/friends/collections/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=picker&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>');

		// remove selected state from previous tab
		$(this).parent().parent().find("li.elgg-state-selected").removeClass("elgg-state-selected");
		// add selected class to current tab
		$(this).parent().addClass("elgg-state-selected");

		return false;
	});


});
</script>