diff options
-rw-r--r-- | friends/pickercallback.php | 4 | ||||
-rw-r--r-- | views/default/friends/collection.php | 6 | ||||
-rw-r--r-- | views/default/friends/collectiontabs.php | 2 | ||||
-rw-r--r-- | views/default/friends/tablelist.php | 2 | ||||
-rw-r--r-- | views/default/friends/tablelistcountupdate.php | 22 |
5 files changed, 31 insertions, 5 deletions
diff --git a/friends/pickercallback.php b/friends/pickercallback.php index 478549d3d..26a8718a0 100644 --- a/friends/pickercallback.php +++ b/friends/pickercallback.php @@ -27,6 +27,7 @@ }*/
$collection = (int) get_input('collection',0);
$members = get_members_of_access_collection($collection, true);
+ if (!$members) $members = array();
$friendspicker = (int) get_input('friendspicker',0);
@@ -38,7 +39,8 @@ switch($type) {
case 'list':
- $content = elgg_view('friends/tablelist',array('entities' => $members));
+ $js_segment = elgg_view('friends/tablelistcountupdate',array('friendspicker' => $friendspicker, 'count' => sizeof($members)));
+ $content = elgg_view('friends/tablelist',array('entities' => $members, 'content' => $js_segment));
break;
default: $friends = $pageowner->getFriends('',9999);
$content = elgg_view('friends/picker',array(
diff --git a/views/default/friends/collection.php b/views/default/friends/collection.php index 438d82e8c..09a684fac 100644 --- a/views/default/friends/collection.php +++ b/views/default/friends/collection.php @@ -17,8 +17,8 @@ */
$coll = $vars['collection'];
-
- if (is_array($vars['collection']->entities)) {
+
+ if (is_array($vars['collection']->members)) {
$count = sizeof($vars['collection']->members);
} else {
$count = 0;
@@ -32,7 +32,7 @@ echo "</div>";
echo $coll->name;
- echo " ({$count}) </h2>";
+ echo " (<span id=\"friends_membership_count{$vars['friendspicker']}\">{$count}</span>) </h2>";
// individual collection panels
if($friends = $vars['collection']->entities){
diff --git a/views/default/friends/collectiontabs.php b/views/default/friends/collectiontabs.php index cdeb6b798..61970af4a 100644 --- a/views/default/friends/collectiontabs.php +++ b/views/default/friends/collectiontabs.php @@ -21,7 +21,7 @@ $(document).ready(function () { $('a.collectionmembers<?php echo $friendspicker; ?>').click(function () {
// load collection members pane
- $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&collection=<?php echo $collectionid; ?>');
+ $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>');
// remove selected state from previous tab
$(this).parent().parent().find("li.selected").removeClass("selected");
diff --git a/views/default/friends/tablelist.php b/views/default/friends/tablelist.php index a5f791f46..c0c481e00 100644 --- a/views/default/friends/tablelist.php +++ b/views/default/friends/tablelist.php @@ -59,5 +59,7 @@ if ($column < 3 && $column != 0) echo "</tr>";
echo "</table>";
}
+
+ if (isset($vars['content'])) echo $vars['content'];
?>
\ No newline at end of file diff --git a/views/default/friends/tablelistcountupdate.php b/views/default/friends/tablelistcountupdate.php new file mode 100644 index 000000000..64f793a07 --- /dev/null +++ b/views/default/friends/tablelistcountupdate.php @@ -0,0 +1,22 @@ +<?php
+
+ /**
+ * Elgg friends picker count updater
+ * Updates the friends count on a collection
+ *
+ * @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['count'] The count
+ * @uses $vars['friendspicker'] The friendspicker counter number
+ */
+
+?>
+
+<script language="text/javascript">
+ $("#friends_membership_count<?php echo $vars['friendspicker']; ?>").html("<?php echo $vars['count']; ?>");
+</script>
\ No newline at end of file |