siteimagesfriends.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * Most recently uploaded images - logged in user's images
  4. *
  5. */
  6. gatekeeper();
  7. $owner = elgg_get_logged_in_user_entity();
  8. // set up breadcrumbs
  9. elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
  10. elgg_push_breadcrumb($owner->name, "photos/siteimagesfriends/$owner->username");
  11. elgg_push_breadcrumb(elgg_echo('friends'));
  12. $offset = (int)get_input('offset', 0);
  13. $limit = (int)get_input('limit', 16);
  14. if ($friends = $owner->getFriends(array('limit' => false))) {
  15. $friendguids = array();
  16. foreach ($friends as $friend) {
  17. $friendguids[] = $friend->getGUID();
  18. }
  19. $result = elgg_list_entities(array(
  20. 'type' => 'object',
  21. 'subtype' => 'image',
  22. 'owner_guids' => $friendguids,
  23. 'limit' => $limit,
  24. 'offset' => $offset,
  25. 'full_view' => false,
  26. 'pagination' => true,
  27. 'list_type' => 'gallery',
  28. 'list_type_toggle' => false,
  29. 'gallery_class' => 'tidypics-gallery'
  30. ));
  31. if (!empty($result)) {
  32. $area2 = $result;
  33. } else {
  34. $area2 = elgg_echo("tidypics:siteimagesfriends:nosuccess");
  35. }
  36. } else {
  37. $area2 = elgg_echo("friends:none:you");
  38. }
  39. $title = elgg_echo('tidypics:siteimagesfriends');
  40. $owner_guid = elgg_get_logged_in_user_guid();
  41. elgg_register_menu_item('title', array('name' => 'addphotos',
  42. 'href' => "ajax/view/photos/selectalbum/?owner_guid=$owner_guid",
  43. 'text' => elgg_echo("photos:addphotos"),
  44. 'link_class' => 'elgg-button elgg-button-action elgg-lightbox'
  45. ));
  46. // only show slideshow link if slideshow is enabled in plugin settings and there are images
  47. if (elgg_get_plugin_setting('slideshow', 'tidypics') && !empty($result)) {
  48. $url = elgg_get_site_url() . "photos/siteimagesfriends/$owner->username?limit=64&offset=$offset&view=rss";
  49. $url = elgg_format_url($url);
  50. $slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'$url'})";
  51. elgg_register_menu_item('title', array('name' => 'slideshow',
  52. 'href' => $slideshow_link,
  53. 'text' => "<img src=\"".elgg_get_site_url() ."mod/tidypics/graphics/slideshow.png\" alt=\"".elgg_echo('album:slideshow')."\">",
  54. 'title' => elgg_echo('album:slideshow'),
  55. 'link_class' => 'elgg-button elgg-button-action'
  56. ));
  57. }
  58. $body = elgg_view_layout('content', array(
  59. 'filter_override' => elgg_view('filter_override/siteimages', array('selected' => 'friends')),
  60. 'content' => $area2,
  61. 'title' => $title,
  62. 'sidebar' => elgg_view('photos/sidebar', array('page' => 'all')),
  63. ));
  64. // Draw it
  65. echo elgg_view_page($title, $body);