default.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Elgg user display
  4. *
  5. * @uses $vars['entity'] ElggUser entity
  6. * @uses $vars['size'] Size of the icon
  7. * @uses $vars['title'] Optional override for the title
  8. */
  9. $entity = $vars['entity'];
  10. $size = elgg_extract('size', $vars, 'tiny');
  11. $icon = elgg_view_entity_icon($entity, $size, $vars);
  12. $title = elgg_extract('title', $vars);
  13. if (!$title) {
  14. $link_params = array(
  15. 'href' => $entity->getUrl(),
  16. 'text' => $entity->name,
  17. );
  18. // Simple XFN, see http://gmpg.org/xfn/
  19. if (elgg_get_logged_in_user_guid() == $entity->guid) {
  20. $link_params['rel'] = 'me';
  21. } elseif (check_entity_relationship(elgg_get_logged_in_user_guid(), 'friend', $entity->guid)) {
  22. $link_params['rel'] = 'friend';
  23. }
  24. $title = elgg_view('output/url', $link_params);
  25. }
  26. $metadata = elgg_view_menu('entity', array(
  27. 'entity' => $entity,
  28. 'sort_by' => 'priority',
  29. 'class' => 'elgg-menu-hz',
  30. ));
  31. if (elgg_in_context('owner_block') || elgg_in_context('widgets')) {
  32. $metadata = '';
  33. }
  34. if (elgg_get_context() == 'gallery') {
  35. echo $icon;
  36. } else {
  37. if ($entity->isBanned()) {
  38. $banned = elgg_echo('banned');
  39. $params = array(
  40. 'entity' => $entity,
  41. 'title' => $title,
  42. 'metadata' => $metadata,
  43. );
  44. } else {
  45. $params = array(
  46. 'entity' => $entity,
  47. 'title' => $title,
  48. 'metadata' => $metadata,
  49. 'subtitle' => $entity->briefdescription,
  50. 'content' => elgg_view('user/status', array('entity' => $entity)),
  51. );
  52. }
  53. $list_body = elgg_view('user/elements/summary', $params);
  54. echo elgg_view_image_block($icon, $list_body, $vars);
  55. }