aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'views/default')
-rw-r--r--views/default/friends/collection.php7
-rw-r--r--views/default/friends/collections.php5
-rw-r--r--views/default/friends/collectiontabs.php15
-rw-r--r--views/default/friends/picker.php19
4 files changed, 26 insertions, 20 deletions
diff --git a/views/default/friends/collection.php b/views/default/friends/collection.php
index 2d6fedac4..8d8afd7d1 100644
--- a/views/default/friends/collection.php
+++ b/views/default/friends/collection.php
@@ -38,15 +38,14 @@
if($friends = $vars['collection']->entities){
$members = $vars['collection']->members;
$implodedmemberslist = implode(',',$members);
- $content = elgg_view('friends/collectiontabs', array('members' => $members, 'friends' => $friends, 'collection' => $vars['collection']));
- echo elgg_view('friends/picker',array('entities' => $friends, 'value' => $members, 'content' => $content, 'replacement' => ''));
- global $friendspicker;
+ $content = elgg_view('friends/collectiontabs', array('members' => $members, 'friends' => $friends, 'collection' => $vars['collection'], 'friendspicker' => $vars['friendspicker']));
+ echo elgg_view('friends/picker',array('entities' => $friends, 'value' => $members, 'content' => $content, 'replacement' => '', 'friendspicker' => $vars['friendspicker']));
?>
<script type="text/javascript">
$(document).ready(function () {
- $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&members=<?php echo $implodedmemberslist; ?>');
+ $('#friends_picker_placeholder<?php echo $vars['friendspicker']; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&members=<?php echo $implodedmemberslist; ?>');
});
</script>
diff --git a/views/default/friends/collections.php b/views/default/friends/collections.php
index a98e80c3a..c67f2f0dc 100644
--- a/views/default/friends/collections.php
+++ b/views/default/friends/collections.php
@@ -14,6 +14,8 @@
* @uses $vars['collections'] The array of friends collections
*/
+ if (!isset($friendspicker)) $friendspicker = 0;
+
if (is_array($vars['collections']) && sizeof($vars['collections'])) {
echo "<div class=\"expandall\"><p>expand all</p></div>";
@@ -21,7 +23,8 @@
foreach($vars['collections'] as $collection) {
- echo elgg_view('friends/collection',array('collection' => $collection));
+ $friendspicker++;
+ echo elgg_view('friends/collection',array('collection' => $collection, 'friendspicker' => $friendspicker));
}
diff --git a/views/default/friends/collectiontabs.php b/views/default/friends/collectiontabs.php
index 25a3a53b3..1e40dd584 100644
--- a/views/default/friends/collectiontabs.php
+++ b/views/default/friends/collectiontabs.php
@@ -1,7 +1,6 @@
<?php
- global $friendspicker;
- if (!isset($friendspicker)) $friendspicker = 0;
+ $friendspicker = $vars['friendspicker'];
if (isset($vars['members'])) {
$members = implode(',',$vars['members']);
@@ -21,9 +20,9 @@
<div id="friendsPickerNavigationTabs">
<ul>
-<li class="selected"><a href="#" class="collectionmembers<?php echo $friendspicker + 1; ?>">Collection members</a></li>
+<li class="selected"><a href="#" class="collectionmembers<?php echo $friendspicker; ?>">Collection members</a></li>
-<li><a href="#" class="editmembers<?php echo $friendspicker + 1; ?>">Edit collection</a></li>
+<li><a href="#" class="editmembers<?php echo $friendspicker; ?>">Edit collection</a></li>
</ul>
</div>
@@ -31,9 +30,9 @@
<script type="text/javascript">
$(document).ready(function () {
- $('a.collectionmembers<?php echo $friendspicker + 1; ?>').click(function () {
+ $('a.collectionmembers<?php echo $friendspicker; ?>').click(function () {
// load collection members pane
- $('#friends_picker_placeholder<?php echo $friendspicker + 1; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&members=<?php echo $members; ?>');
+ $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&members=<?php echo $members; ?>');
// remove selected state from previous tab
$(this).parent().parent().find("li.selected").removeClass("selected");
@@ -43,9 +42,9 @@ $(document).ready(function () {
return false;
});
- $('a.editmembers<?php echo $friendspicker + 1; ?>').click(function () {
+ $('a.editmembers<?php echo $friendspicker; ?>').click(function () {
// load friends picker pane
- $('#friends_picker_placeholder<?php echo $friendspicker + 1; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=picker&members=<?php echo $members; ?>&friends=<?php echo $friends; ?>');
+ $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=picker&members=<?php echo $members; ?>&friends=<?php echo $friends; ?>&friendspicker=<?php echo $friendspicker; ?>');
// remove selected state from previous tab
$(this).parent().parent().find("li.selected").removeClass("selected");
diff --git a/views/default/friends/picker.php b/views/default/friends/picker.php
index ed9d71c3e..279696c24 100644
--- a/views/default/friends/picker.php
+++ b/views/default/friends/picker.php
@@ -38,10 +38,14 @@
$callback = false;
}
- // We need to count the number of friends pickers on the page.
- global $friendspicker;
- if (!isset($friendspicker)) $friendspicker = 0;
- $friendspicker++;
+ // We need to count the number of friends pickers on the page.
+ if (!isset($vars['friendspicker'])) {
+ global $friendspicker;
+ if (!isset($friendspicker)) $friendspicker = 0;
+ $friendspicker++;
+ } else {
+ $friendspicker = $vars['friendspicker'];
+ }
$users = array();
$activeletters = array();
@@ -192,8 +196,9 @@
<script type="text/javascript">
// initialise picker
- $("div#friendsPicker<?php echo $friendspicker; ?>").friendsPicker();
-</script>
+ $("div#friendsPicker<?php echo $friendspicker; ?>").friendsPicker(<?php echo $friendspicker; ?>);
+</script>
+$("div#friendsPicker<?php echo $friendspicker; ?>").friendsPicker(<?php echo $friendspicker; ?>);
<script>
$(document).ready(function () {
// manually add class to corresponding tab for panels that have content
@@ -203,7 +208,7 @@
foreach($activeletters as $letter) {
$tab = strpos($chararray, $letter) + 1;
?>
- $("div#friendsPickerNavigation<?php echo $friendspicker - 1; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent");
+ $("div#friendsPickerNavigation<?php echo $friendspicker; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent");
<?php
}