collection.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * View a friends collection
  4. *
  5. * @package Elgg
  6. * @subpackage Core
  7. *
  8. * @uses $vars['collection'] The individual friends collection
  9. */
  10. $coll = $vars['collection'];
  11. if (is_array($vars['collection']->members)) {
  12. $count = sizeof($vars['collection']->members);
  13. } else {
  14. $count = 0;
  15. }
  16. echo "<li><h2>";
  17. //as collections are private, check that the logged in user is the owner
  18. if ($coll->owner_guid == elgg_get_logged_in_user_guid()) {
  19. echo "<div class=\"friends_collections_controls\">";
  20. echo elgg_view('output/url', array(
  21. 'href' => 'action/friends/collections/delete?collection=' . $coll->id,
  22. 'class' => 'delete_collection',
  23. 'text' => elgg_view_icon('delete'),
  24. 'encode_text' => false,
  25. 'confirm' => true,
  26. ));
  27. echo "</div>";
  28. }
  29. echo $coll->name;
  30. echo " (<span id=\"friends_membership_count{$vars['friendspicker']}\">{$count}</span>) </h2>";
  31. // individual collection panels
  32. $friends = $vars['collection']->entities;
  33. if ($friends) {
  34. $content = elgg_view('core/friends/collectiontabs', array(
  35. 'owner' => elgg_get_logged_in_user_entity(),
  36. 'collection' => $vars['collection'],
  37. 'friendspicker' => $vars['friendspicker'],
  38. ));
  39. echo elgg_view('input/friendspicker', array(
  40. 'entities' => $friends,
  41. 'value' => $vars['collection']->members,
  42. 'content' => $content,
  43. 'replacement' => '',
  44. 'friendspicker' => $vars['friendspicker'],
  45. ));
  46. ?>
  47. <?php //@todo JS 1.8: no ?>
  48. <script type="text/javascript">
  49. $(function () {
  50. $('#friends-picker_placeholder<?php echo $vars['friendspicker']; ?>').load(elgg.config.wwwroot + 'pages/friends/collections/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=list&collection=<?php echo $vars['collection']->id; ?>');
  51. });
  52. </script>
  53. <?php
  54. }
  55. // close friends-picker div and the accordian list item
  56. echo "</li>";