content.php 722 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Content view of the related groups widget
  4. */
  5. $widget = elgg_extract("entity", $vars);
  6. $num_display = (int) $widget->num_display;
  7. if ($num_display < 1) {
  8. $num_display = 4;
  9. }
  10. $dbprefix = elgg_get_config("dbprefix");
  11. $options = array(
  12. "type" => "group",
  13. "limit" => $num_display,
  14. "relationship" => "related_group",
  15. "relationship_guid" => $widget->getOwnerGUID(),
  16. "full_view" => false,
  17. "pagination" => false,
  18. "joins" => array("JOIN " . $dbprefix . "groups_entity ge ON e.guid = ge.guid"),
  19. "order_by" => "ge.name ASC"
  20. );
  21. $content = elgg_list_entities_from_relationship($options);
  22. if (empty($content)) {
  23. $content = "<div>" . elgg_echo("groups_tools:related_groups:none") . "</div>";
  24. }
  25. echo $content;