group_tp_images_module.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Group images module
  4. */
  5. $group = $vars['entity'];
  6. if ($group->tp_images_enable == "no") {
  7. return true;
  8. }
  9. $all_link = elgg_view('output/url', array(
  10. 'href' => "photos/siteimagesgroup/$group->guid",
  11. 'text' => elgg_echo('link:view:all'),
  12. 'is_trusted' => true,
  13. ));
  14. $container_guid = elgg_get_page_owner_guid();
  15. $db_prefix = elgg_get_config('dbprefix');
  16. elgg_push_context('groups');
  17. $options = 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' => 6,
  24. 'full_view' => false,
  25. 'list_type_toggle' => false,
  26. 'list_type' => 'gallery',
  27. 'pagination' => false,
  28. 'gallery_class' => 'tidypics-gallery-widget'
  29. );
  30. $content = elgg_list_entities($options);
  31. elgg_pop_context();
  32. if (!$content) {
  33. $content = '<p>' . elgg_echo('tidypics:none') . '</p>';
  34. }
  35. if (elgg_is_logged_in()) {
  36. elgg_load_js('lightbox');
  37. elgg_load_css('lightbox');
  38. $new_link = elgg_view('output/url', array(
  39. 'href' => "ajax/view/photos/selectalbum/?owner_guid=" .$group->guid,
  40. 'text' => elgg_echo("photos:addphotos"),
  41. 'link_class' => 'elgg-lightbox',
  42. 'is_trusted' => true,
  43. ));
  44. }
  45. echo elgg_view('groups/profile/module', array(
  46. 'title' => elgg_echo('tidypics:mostrecent'),
  47. 'content' => $content,
  48. 'all_link' => $all_link,
  49. 'add_link' => $new_link,
  50. ));