invitations.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * List all group invitations
  4. */
  5. gatekeeper();
  6. $user = elgg_get_page_owner_entity();
  7. if (empty($user) || !elgg_instanceof($user, "user") || !$user->canEdit()) {
  8. forward();
  9. }
  10. // build breadcrumb
  11. elgg_push_breadcrumb(elgg_echo("groups"), "groups/all");
  12. $title = elgg_echo("groups:invitations");
  13. elgg_push_breadcrumb($title);
  14. // @todo temporary workaround for exts #287.
  15. $invitations = groups_get_invited_groups($user->getGUID());
  16. // get membership requests
  17. $request_options = array(
  18. "type" => "group",
  19. "relationship" => "membership_request",
  20. "relationship_guid" => $user->getGUID(),
  21. "limit" => false,
  22. "full_view" => false,
  23. "pagination" => false
  24. );
  25. $requests = elgg_get_entities_from_relationship($request_options);
  26. // invite by email allowed
  27. $invite_email = false;
  28. $email_invitations = false;
  29. if (elgg_get_plugin_setting("invite_email", "group_tools") == "yes") {
  30. $invite_email = true;
  31. $email_invitations = group_tools_get_invited_groups_by_email($user->email);
  32. }
  33. $content = elgg_view("groups/invitationrequests", array(
  34. "user" => $user,
  35. "invitations" => $invitations,
  36. "requests" => $requests,
  37. "invite_email" => $invite_email,
  38. "email_invitations" => $email_invitations
  39. ));
  40. // build page content
  41. $params = array(
  42. "content" => $content,
  43. "title" => $title,
  44. "filter" => "",
  45. );
  46. $body = elgg_view_layout("content", $params);
  47. // draw page
  48. echo elgg_view_page($title, $body);