mail.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Mail group members
  4. */
  5. gatekeeper();
  6. $group_guid = (int) get_input("group_guid", 0);
  7. $group = get_entity($group_guid);
  8. if (!empty($group) && ($group instanceof ElggGroup) && $group->canEdit()) {
  9. elgg_require_js("group_tools/mail");
  10. // set page owner
  11. elgg_set_page_owner_guid($group->getGUID());
  12. elgg_set_context("groups");
  13. // set breadcrumb
  14. elgg_push_breadcrumb(elgg_echo("groups"), "groups/all");
  15. elgg_push_breadcrumb($group->name, $group->getURL());
  16. elgg_push_breadcrumb(elgg_echo("group_tools:menu:mail"));
  17. // get members
  18. $members = $group->getMembers(array(
  19. "limit" => false
  20. ));
  21. // build page elements
  22. $title_text = elgg_echo("group_tools:mail:title");
  23. $title = elgg_view_title($title_text);
  24. $form_vars = array(
  25. "id" => "group_tools_mail_form",
  26. "class" => "elgg-form-alt"
  27. );
  28. $body_vars = array(
  29. "entity" => $group,
  30. "members" => $members
  31. );
  32. $form = elgg_view_form("group_tools/mail", $form_vars, $body_vars);
  33. $body = elgg_view_layout("content", array(
  34. "entity" => $group,
  35. "title" => $title_text,
  36. "content" => $form,
  37. "filter" => false
  38. ));
  39. echo elgg_view_page($title_text, $body);
  40. } else {
  41. forward(REFERER);
  42. }