friends.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * List all the albums of someone's friends
  4. *
  5. * @author Cash Costello
  6. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
  7. */
  8. gatekeeper();
  9. $owner = elgg_get_page_owner_entity();
  10. elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
  11. elgg_push_breadcrumb(elgg_echo('tidypics:albums'), 'photos/all');
  12. elgg_push_breadcrumb($owner->name, "photos/friends/$owner->username");
  13. elgg_push_breadcrumb(elgg_echo('friends'));
  14. $title = elgg_echo('album:friends');
  15. $offset = (int)get_input('offset', 0);
  16. $limit = (int)get_input('limit', 16);
  17. if ($friends = $owner->getFriends(array('limit' => false))) {
  18. $friendguids = array();
  19. foreach ($friends as $friend) {
  20. $friendguids[] = $friend->getGUID();
  21. }
  22. $result = elgg_list_entities(array(
  23. 'type' => 'object',
  24. 'subtype' => 'album',
  25. 'owner_guids' => $friendguids,
  26. 'limit' => $limit,
  27. 'offset' => $offset,
  28. 'full_view' => false,
  29. 'pagination' => true,
  30. 'list_type' => 'gallery',
  31. 'list_type_toggle' => false,
  32. 'gallery_class' => 'tidypics-gallery'
  33. ));
  34. if (!empty($result)) {
  35. $area2 = $result;
  36. } else {
  37. $area2 = elgg_echo("tidypics:none");
  38. }
  39. } else {
  40. $area2 = elgg_echo("friends:none:you");
  41. }
  42. $logged_in_guid = elgg_get_logged_in_user_guid();
  43. elgg_register_menu_item('title', array('name' => 'addphotos',
  44. 'href' => "ajax/view/photos/selectalbum/?owner_guid=" . $logged_in_guid,
  45. 'text' => elgg_echo("photos:addphotos"),
  46. 'link_class' => 'elgg-button elgg-button-action elgg-lightbox'
  47. ));
  48. elgg_register_title_button();
  49. $body = elgg_view_layout('content', array(
  50. 'filter_context' => 'friends',
  51. 'content' => $area2,
  52. 'title' => $title,
  53. 'sidebar' => elgg_view('photos/sidebar', array('page' => 'friends')),
  54. ));
  55. echo elgg_view_page($title, $body);