body.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Body of river item
  4. *
  5. * @uses $vars['item'] ElggRiverItem
  6. * @uses $vars['summary'] Alternate summary (the short text summary of action)
  7. * @uses $vars['message'] Optional message (usually excerpt of text)
  8. * @uses $vars['attachments'] Optional attachments (displaying icons or other non-text data)
  9. * @uses $vars['responses'] Alternate respones (comments, replies, etc.)
  10. */
  11. $item = $vars['item'];
  12. /* @var ElggRiverItem $item */
  13. $menu = elgg_view_menu('river', array(
  14. 'item' => $item,
  15. 'sort_by' => 'priority',
  16. 'class' => 'elgg-menu-hz',
  17. ));
  18. // river item header
  19. $timestamp = elgg_view_friendly_time($item->getTimePosted());
  20. $summary = elgg_extract('summary', $vars);
  21. if ($summary === null) {
  22. $summary = elgg_view('river/elements/summary', array(
  23. 'item' => $vars['item'],
  24. ));
  25. }
  26. if ($summary === false) {
  27. $subject = $item->getSubjectEntity();
  28. $summary = elgg_view('output/url', array(
  29. 'href' => $subject->getURL(),
  30. 'text' => $subject->name,
  31. 'class' => 'elgg-river-subject',
  32. 'is_trusted' => true,
  33. ));
  34. }
  35. $message = elgg_extract('message', $vars);
  36. if ($message !== null) {
  37. $message = "<div class=\"elgg-river-message\">$message</div>";
  38. }
  39. $attachments = elgg_extract('attachments', $vars);
  40. if ($attachments !== null) {
  41. $attachments = "<div class=\"elgg-river-attachments clearfix\">$attachments</div>";
  42. }
  43. $responses = elgg_view('river/elements/responses', $vars);
  44. if ($responses) {
  45. $responses = "<div class=\"elgg-river-responses\">$responses</div>";
  46. }
  47. $group_string = '';
  48. $object = $item->getObjectEntity();
  49. $container = $object->getContainerEntity();
  50. if ($container instanceof ElggGroup && $container->guid != elgg_get_page_owner_guid()) {
  51. $group_link = elgg_view('output/url', array(
  52. 'href' => $container->getURL(),
  53. 'text' => $container->name,
  54. 'is_trusted' => true,
  55. ));
  56. $group_string = elgg_echo('river:ingroup', array($group_link));
  57. }
  58. echo <<<RIVER
  59. $menu
  60. <div class="elgg-river-summary">$summary $group_string <span class="elgg-river-timestamp">$timestamp</span></div>
  61. $message
  62. $attachments
  63. $responses
  64. RIVER;