collectiontabs.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * Elgg friends collections
  4. * Lists a user's friends collections
  5. *
  6. * @package Elgg
  7. * @subpackage Core
  8. *
  9. * @uses $vars['collections'] The array of friends collections
  10. */
  11. $friendspicker = $vars['friendspicker'];
  12. $collectionid = $vars['collection']->id;
  13. $ownerid = $vars['owner']->getGUID();
  14. ?>
  15. <ul class="elgg-tabs">
  16. <li class="elgg-state-selected">
  17. <a href="#" class="collectionmembers<?php echo $friendspicker; ?>">
  18. <?php echo elgg_echo('friends:collections:members'); ?>
  19. </a>
  20. </li>
  21. <li>
  22. <a href="#" class="editmembers<?php echo $friendspicker; ?>">
  23. <?php echo elgg_echo('friends:collections:edit'); ?>
  24. </a>
  25. </li>
  26. </ul>
  27. <?php //@todo JS 1.8: no ?>
  28. <script type="text/javascript">
  29. $(function () {
  30. $('a.collectionmembers<?php echo $friendspicker; ?>').click(function () {
  31. // load collection members pane
  32. $('#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; ?>');
  33. // remove selected state from previous tab
  34. $(this).parent().parent().find("li.elgg-state-selected").removeClass("elgg-state-selected");
  35. // add selected class to current tab
  36. $(this).parent().addClass("elgg-state-selected");
  37. return false;
  38. });
  39. $('a.editmembers<?php echo $friendspicker; ?>').click(function () {
  40. // load friends picker pane
  41. $('#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; ?>');
  42. // remove selected state from previous tab
  43. $(this).parent().parent().find("li.elgg-state-selected").removeClass("elgg-state-selected");
  44. // add selected class to current tab
  45. $(this).parent().addClass("elgg-state-selected");
  46. return false;
  47. });
  48. });
  49. </script>