tagged.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Tidypics Tagged Listing
  4. *
  5. * List all photos tagged with a user
  6. */
  7. // Get user guid
  8. $guid = get_input('guid');
  9. $user = get_entity($guid);
  10. // set up breadcrumbs
  11. elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
  12. elgg_push_breadcrumb(elgg_echo('tidypics:usertagged'));
  13. $offset = (int)get_input('offset', 0);
  14. $limit = (int)get_input('limit', 16);
  15. if ($user && ($user instanceof ElggUser)) {
  16. $title = elgg_echo('tidypics:usertag', array($user->name));
  17. $options = array('relationship' => 'phototag',
  18. 'relationship_guid' => $guid,
  19. 'inverse_relationship' => false,
  20. 'type' => 'object',
  21. 'subtype' => 'image',
  22. 'limit' => $limit,
  23. 'offset' => $offset,
  24. 'full_view' => false,
  25. 'list_type' => 'gallery',
  26. 'gallery_class' => 'tidypics-gallery'
  27. );
  28. $result = elgg_list_entities_from_relationship($options);
  29. if (!empty($result)) {
  30. $area2 = $result;
  31. } else {
  32. $area2 = elgg_echo('tidypics:usertags_photos:nosuccess');
  33. }
  34. } else {
  35. $title = elgg_echo('tidypics:usertag:nosuccess');
  36. $area2 = '';
  37. }
  38. if (elgg_is_logged_in()) {
  39. $logged_in_guid = elgg_get_logged_in_user_guid();
  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. // only show slideshow link if slideshow is enabled in plugin settings and there are images
  46. if (elgg_get_plugin_setting('slideshow', 'tidypics') && !empty($result)) {
  47. $url = elgg_get_site_url() . "photos/tagged?guid={$user->guid}&limit=64&offset=$offset&view=rss";
  48. $url = elgg_format_url($url);
  49. $slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'$url'})";
  50. elgg_register_menu_item('title', array('name' => 'slideshow',
  51. 'href' => $slideshow_link,
  52. 'text' => "<img src=\"".elgg_get_site_url() ."mod/tidypics/graphics/slideshow.png\" alt=\"".elgg_echo('album:slideshow')."\">",
  53. 'title' => elgg_echo('album:slideshow'),
  54. 'link_class' => 'elgg-button elgg-button-action'));
  55. }
  56. $body = elgg_view_layout('content', array(
  57. 'filter_override' => '',
  58. 'content' => $area2,
  59. 'title' => $title,
  60. 'sidebar' => elgg_view('photos/sidebar', array('page' => 'all')),
  61. ));
  62. // Draw it
  63. echo elgg_view_page($title, $body);