content.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Tidypics Plugin
  4. *
  5. * Groups page Latest Photos widget for Widget Manager plugin
  6. *
  7. */
  8. // get widget settings
  9. $count = sanitise_int($vars["entity"]->tp_latest_photos_count, false);
  10. if(empty($count)){
  11. $count = 12;
  12. }
  13. $container_guid = elgg_get_page_owner_guid();
  14. $db_prefix = elgg_get_config('dbprefix');
  15. $prev_context = elgg_get_context();
  16. elgg_set_context('groups');
  17. $image_html = elgg_list_entities(array(
  18. 'type' => 'object',
  19. 'subtype' => 'image',
  20. 'joins' => array("join {$db_prefix}entities u on e.container_guid = u.guid"),
  21. 'wheres' => array("u.container_guid = {$container_guid}"),
  22. 'order_by' => "e.time_created desc",
  23. 'limit' => $count,
  24. 'full_view' => false,
  25. 'list_type_toggle' => false,
  26. 'list_type' => 'gallery',
  27. 'pagination' => false,
  28. 'gallery_class' => 'tidypics-gallery-widget',
  29. ));
  30. elgg_set_context($prev_context);
  31. if (elgg_is_logged_in()) {
  32. elgg_load_js('lightbox');
  33. elgg_load_css('lightbox');
  34. $image_html .= elgg_view('output/url', array(
  35. 'href' => "ajax/view/photos/selectalbum/?owner_guid=" . $container_guid,
  36. 'text' => elgg_echo("photos:addphotos"),
  37. 'link_class' => 'elgg-lightbox',
  38. 'is_trusted' => true,
  39. ));
  40. }
  41. echo $image_html;