received.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. $entities = elgg_extract('entities', $vars);
  3. $content = '';
  4. if (!empty($entities)) {
  5. $lis = [];
  6. foreach ($entities as $entity) {
  7. $icon = elgg_view_entity_icon($entity, 'small');
  8. $info = elgg_view('output/url', [
  9. 'href' => $entity->getURL(),
  10. 'text' => $entity->name,
  11. 'is_trusted' => true,
  12. ]);
  13. $info .= '<br />';
  14. $info .= elgg_view('output/url', [
  15. 'href' => "action/friend_request/approve?guid={$entity->getGUID()}",
  16. 'text' => elgg_echo('friend_request:approve'),
  17. 'is_action' => true,
  18. ]);
  19. $info .= '&nbsp;|&nbsp;';
  20. $info .= elgg_view('output/url', [
  21. 'href' => "action/friend_request/decline?guid={$entity->getGUID()}",
  22. 'text' => elgg_echo('friend_request:decline'),
  23. 'is_action' => true,
  24. ]);
  25. $lis[] = elgg_format_element('li', ['class' => 'elgg-item elgg-item-user'], elgg_view_image_block($icon, $info));
  26. }
  27. $content = elgg_format_element('ul', ['class' => 'elgg-list elgg-list-entity'], implode('', $lis));
  28. } else {
  29. $content = elgg_echo('friend_request:received:none');
  30. }
  31. echo elgg_view_module('info', elgg_echo('friend_request:received:title'), $content, ['class' => 'mbm']);