membershiprequests.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * A group"s member requests
  4. *
  5. * @uses $vars["entity"] ElggGroup
  6. * @uses $vars["requests"] Array of ElggUsers who requested membership
  7. * @uses $vars["invitations"] Array of ElggUsers who where invited
  8. */
  9. $group = elgg_extract("entity", $vars);
  10. $requests = elgg_extract("requests", $vars);
  11. if (!empty($requests) && is_array($requests)) {
  12. elgg_load_js('lightbox');
  13. elgg_load_css('lightbox');
  14. $content = "<ul class='elgg-list'>";
  15. foreach ($requests as $user) {
  16. $icon = elgg_view_entity_icon($user, "tiny", array("use_hover" => "true"));
  17. $user_title = elgg_view("output/url", array(
  18. "href" => $user->getURL(),
  19. "text" => $user->name,
  20. "is_trusted" => true,
  21. ));
  22. $url = "action/groups/addtogroup?user_guid=" . $user->getGUID() . "&group_guid=" . $group->getGUID();
  23. $accept_button = elgg_view("output/url", array(
  24. "href" => $url,
  25. "text" => elgg_echo("accept"),
  26. "class" => "elgg-button elgg-button-submit group-tools-accept-request",
  27. "rel" => $user->getGUID(),
  28. "is_action" => true
  29. ));
  30. $form_vars = array(
  31. 'id' => "group-kill-request-{$user->getGUID()}",
  32. 'data-guid' => $user->getGUID(),
  33. );
  34. $body_vars = array(
  35. 'group' => $group,
  36. 'user' => $user,
  37. );
  38. $decline_form = elgg_view_form('groups/killrequest', $form_vars, $body_vars);
  39. $delete_button = elgg_format_element('div', array('class' => 'hidden'), $decline_form);
  40. $delete_button .= elgg_view("output/url", array(
  41. "href" => false,
  42. "text" => elgg_echo("decline"),
  43. "class" => "elgg-button elgg-button-delete mlm elgg-lightbox",
  44. "rel" => $user->getGUID(),
  45. "data-colorbox-opts" => json_encode(array(
  46. 'inline' => true,
  47. 'href' => "#group-kill-request-{$user->getGUID()}",
  48. 'width' => '600px',
  49. 'closeButton' => false
  50. )),
  51. ));
  52. $body = "<h4>$user_title</h4>";
  53. $alt = $accept_button . $delete_button;
  54. // build output
  55. $user_listing = elgg_view_image_block($icon, $body, array("image_alt" => $alt));
  56. $attr = array(
  57. 'class' => 'elgg-item',
  58. 'data-guid' => $user->getGUID(),
  59. );
  60. $content .= elgg_format_element('li', $attr, $user_listing);
  61. }
  62. $content .= "</ul>";
  63. // pagination
  64. $content .= elgg_view("navigation/pagination", $vars);
  65. } else {
  66. $content = elgg_view("output/longtext", array("value" => elgg_echo("groups:requests:none")));
  67. }
  68. echo $content;