default.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * ElggObject default view.
  4. *
  5. * @warning This view may be used for other ElggEntity objects
  6. *
  7. * @package Elgg
  8. * @subpackage Core
  9. */
  10. $icon = elgg_view_entity_icon($vars['entity'], 'small');
  11. $title = $vars['entity']->title;
  12. if (!$title) {
  13. $title = $vars['entity']->name;
  14. }
  15. if (!$title) {
  16. $title = get_class($vars['entity']);
  17. }
  18. if (elgg_instanceof($vars['entity'], 'object')) {
  19. $metadata = elgg_view('navigation/menu/metadata', $vars);
  20. }
  21. $owner_link = '';
  22. $owner = $vars['entity']->getOwnerEntity();
  23. if ($owner) {
  24. $owner_link = elgg_view('output/url', array(
  25. 'href' => $owner->getURL(),
  26. 'text' => $owner->name,
  27. 'is_trusted' => true,
  28. ));
  29. }
  30. $date = elgg_view_friendly_time($vars['entity']->getTimeCreated());
  31. $subtitle = "$owner_link $date";
  32. $params = array(
  33. 'entity' => $vars['entity'],
  34. 'title' => $title,
  35. 'metadata' => $metadata,
  36. 'subtitle' => $subtitle,
  37. );
  38. $params = $params + $vars;
  39. $body = elgg_view('object/elements/summary', $params);
  40. echo elgg_view_image_block($icon, $body, $vars);