owner.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Show all the albums that belong to a user or group
  4. *
  5. * @author Cash Costello
  6. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
  7. */
  8. group_gatekeeper();
  9. $owner = elgg_get_page_owner_entity();
  10. if (!$owner) {
  11. forward(REFERER);
  12. }
  13. $title = elgg_echo('album:user', array($owner->name));
  14. // set up breadcrumbs
  15. elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
  16. elgg_push_breadcrumb(elgg_echo('tidypics:albums'), 'photos/all');
  17. elgg_push_breadcrumb($owner->name);
  18. $offset = (int)get_input('offset', 0);
  19. $limit = (int)get_input('limit', 16);
  20. $content = elgg_list_entities(array(
  21. 'type' => 'object',
  22. 'subtype' => 'album',
  23. 'container_guid' => $owner->getGUID(),
  24. 'limit' => $limit,
  25. 'offset' => $offset,
  26. 'full_view' => false,
  27. 'list_type' => 'gallery',
  28. 'list_type_toggle' => false,
  29. 'gallery_class' => 'tidypics-gallery',
  30. ));
  31. if (!$content) {
  32. $content = elgg_echo('tidypics:none');
  33. }
  34. if (elgg_is_logged_in()) {
  35. if ($owner instanceof ElggGroup) {
  36. $logged_in_guid = $owner->getGUID();
  37. } else {
  38. $logged_in_guid = elgg_get_logged_in_user_guid();
  39. }
  40. elgg_register_menu_item('title', array('name' => 'addphotos',
  41. 'href' => "ajax/view/photos/selectalbum/?owner_guid=" . $logged_in_guid,
  42. 'text' => elgg_echo("photos:addphotos"),
  43. 'link_class' => 'elgg-button elgg-button-action elgg-lightbox'));
  44. }
  45. elgg_register_title_button();
  46. $params = array(
  47. 'filter_context' => 'mine',
  48. 'content' => $content,
  49. 'title' => $title,
  50. 'sidebar' => elgg_view('photos/sidebar', array('page' => 'owner')),
  51. );
  52. // don't show filter if out of filter context
  53. if ($owner instanceof ElggGroup) {
  54. $params['filter'] = false;
  55. }
  56. if ($owner->getGUID() != elgg_get_logged_in_user_guid()) {
  57. $params['filter_context'] = '';
  58. }
  59. $body = elgg_view_layout('content', $params);
  60. echo elgg_view_page($title, $body);