siteimagesgroup.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Group images
  4. *
  5. */
  6. $container_guid = (int)get_input('guid');
  7. elgg_set_page_owner_guid($container_guid);
  8. group_gatekeeper();
  9. $container = get_entity($container_guid);
  10. if(!$container || !(elgg_instanceof($container, 'group'))) {
  11. return;
  12. }
  13. $db_prefix = elgg_get_config('dbprefix');
  14. $filter = '';
  15. // set up breadcrumbs
  16. elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
  17. elgg_push_breadcrumb($container->name);
  18. $offset = (int)get_input('offset', 0);
  19. $limit = (int)get_input('limit', 16);
  20. // grab the html to display the most recent images
  21. $result = elgg_list_entities(array('type' => 'object',
  22. 'subtype' => 'image',
  23. 'owner_guid' => NULL,
  24. 'joins' => array("join {$db_prefix}entities u on e.container_guid = u.guid"),
  25. 'wheres' => array("u.container_guid = {$container_guid}"),
  26. 'order_by' => "e.time_created desc",
  27. 'limit' => $limit,
  28. 'offset' => $offset,
  29. 'full_view' => false,
  30. 'list_type' => 'gallery',
  31. 'gallery_class' => 'tidypics-gallery'
  32. ));
  33. $title = elgg_echo('tidypics:siteimagesgroup', array($container->name));
  34. if (elgg_is_logged_in()) {
  35. elgg_register_menu_item('title', array('name' => 'addphotos',
  36. 'href' => "ajax/view/photos/selectalbum/?owner_guid=" . $container_guid,
  37. 'text' => elgg_echo("photos:addphotos"),
  38. 'link_class' => 'elgg-button elgg-button-action elgg-lightbox'));
  39. }
  40. // only show slideshow link if slideshow is enabled in plugin settings and there are images
  41. if (elgg_get_plugin_setting('slideshow', 'tidypics') && !empty($result)) {
  42. $url = elgg_get_site_url() . "photos/siteimagesgroup/$container_guid?limit=64&offset=$offset&view=rss";
  43. $url = elgg_format_url($url);
  44. $slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'$url'})";
  45. elgg_register_menu_item('title', array('name' => 'slideshow',
  46. 'href' => $slideshow_link,
  47. 'text' => "<img src=\"".elgg_get_site_url() ."mod/tidypics/graphics/slideshow.png\" alt=\"".elgg_echo('album:slideshow')."\">",
  48. 'title' => elgg_echo('album:slideshow'),
  49. 'link_class' => 'elgg-button elgg-button-action'));
  50. }
  51. if (!empty($result)) {
  52. $area2 = $result;
  53. } else {
  54. $area2 = elgg_echo('tidypics:siteimagesgroup:nosuccess');
  55. }
  56. $body = elgg_view_layout('content', array(
  57. 'filter_override' => $filter,
  58. 'content' => $area2,
  59. 'title' => $title,
  60. 'sidebar' => elgg_view('photos/sidebar', array('page' => 'owner')),
  61. ));
  62. // Draw it
  63. echo elgg_view_page($title, $body);