featured.php 883 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Featured groups
  4. *
  5. * @package ElggGroups
  6. */
  7. $limit = (int) elgg_extract("limit", $vars, 10);
  8. $sort = elgg_extract("sort", $vars);
  9. $featured_groups_options = array(
  10. "metadata_name" => "featured_group",
  11. "metadata_value" => "yes",
  12. "types" => "group",
  13. "limit" => $limit,
  14. );
  15. if (!empty($sort) && ($sort == "alphabetical")) {
  16. $featured_groups_options["joins"] = array("JOIN " . elgg_get_config("dbprefix") . "groups_entity ge ON e.guid = ge.guid");
  17. $featured_groups_options["order_by"] = "ge.name ASC";
  18. }
  19. elgg_push_context("widgets");
  20. $body = "";
  21. $featured_groups = new ElggBatch("elgg_get_entities_from_metadata", $featured_groups_options);
  22. foreach ($featured_groups as $group) {
  23. $body .= elgg_view_entity($group, array("full_view" => false));
  24. }
  25. elgg_pop_context();
  26. if (!empty($body)) {
  27. echo elgg_view_module("aside", elgg_echo("groups:featured"), $body);
  28. }