discussion_reply.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Forum reply entity view
  4. *
  5. * @package ElggGroups
  6. */
  7. $reply = elgg_extract('entity', $vars, FALSE);
  8. if (!$reply) {
  9. return true;
  10. }
  11. $poster = $reply->getOwnerEntity();
  12. $poster_icon = elgg_view_entity_icon($poster, 'tiny');
  13. $poster_link = elgg_view('output/url', array(
  14. 'href' => $poster->getURL(),
  15. 'text' => $poster->name,
  16. 'is_trusted' => true,
  17. ));
  18. $poster_text = elgg_echo('byline', array($poster->name));
  19. $date = elgg_view_friendly_time($reply->time_created);
  20. // Do not show the metadata and controls in widget view
  21. if (elgg_in_context('widgets')) {
  22. $metadata = '';
  23. } else {
  24. $metadata = elgg_view_menu('entity', array(
  25. 'entity' => $vars['entity'],
  26. 'handler' => 'discussion_reply',
  27. 'sort_by' => 'priority',
  28. 'class' => 'elgg-menu-hz',
  29. ));
  30. }
  31. $subtitle = "$poster_text $date";
  32. if (elgg_in_context('activity')) {
  33. $content = '<div class="elgg-output elgg-inner" data-role="comment-text">';
  34. $content .= elgg_view('output/text', array(
  35. 'value' => elgg_get_excerpt($reply->description)
  36. ));
  37. $content .= '</div>';
  38. } else {
  39. $content = elgg_view('output/longtext', array(
  40. 'value' => $reply->description,
  41. 'class' => 'elgg-inner',
  42. 'data-role' => 'discussion-reply-text',
  43. ));
  44. }
  45. $params = array(
  46. 'entity' => $reply,
  47. 'metadata' => $metadata,
  48. 'subtitle' => $subtitle,
  49. 'content' => $content,
  50. );
  51. $params = $params + $vars;
  52. $list_body = elgg_view('object/elements/summary', $params);
  53. echo elgg_view_image_block($poster_icon, $list_body);