group_module.php 955 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Latest forum posts
  4. *
  5. * @uses $vars['entity']
  6. */
  7. if ($vars['entity']->forum_enable == 'no') {
  8. return true;
  9. }
  10. $group = $vars['entity'];
  11. $all_link = elgg_view('output/url', array(
  12. 'href' => "discussion/owner/$group->guid",
  13. 'text' => elgg_echo('link:view:all'),
  14. 'is_trusted' => true,
  15. ));
  16. elgg_push_context('widgets');
  17. $options = array(
  18. 'type' => 'object',
  19. 'subtype' => 'groupforumtopic',
  20. 'container_guid' => $group->getGUID(),
  21. 'limit' => 6,
  22. 'full_view' => false,
  23. 'pagination' => false,
  24. 'no_results' => elgg_echo('discussion:none'),
  25. );
  26. $content = elgg_list_entities($options);
  27. elgg_pop_context();
  28. $new_link = elgg_view('output/url', array(
  29. 'href' => "discussion/add/" . $group->getGUID(),
  30. 'text' => elgg_echo('groups:addtopic'),
  31. 'is_trusted' => true,
  32. ));
  33. echo elgg_view('groups/profile/module', array(
  34. 'title' => elgg_echo('discussion:group'),
  35. 'content' => $content,
  36. 'all_link' => $all_link,
  37. 'add_link' => $new_link,
  38. ));