thewire.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * View a wire post
  4. *
  5. * @uses $vars['entity']
  6. */
  7. elgg_load_js('elgg.thewire');
  8. $full = elgg_extract('full_view', $vars, FALSE);
  9. $post = elgg_extract('entity', $vars, FALSE);
  10. if (!$post) {
  11. return true;
  12. }
  13. // make compatible with posts created with original Curverider plugin
  14. $thread_id = $post->wire_thread;
  15. if (!$thread_id) {
  16. $post->wire_thread = $post->guid;
  17. }
  18. $owner = $post->getOwnerEntity();
  19. $owner_icon = elgg_view_entity_icon($owner, 'tiny');
  20. $owner_link = elgg_view('output/url', array(
  21. 'href' => "thewire/owner/$owner->username",
  22. 'text' => $owner->name,
  23. 'is_trusted' => true,
  24. ));
  25. $author_text = elgg_echo('byline', array($owner_link));
  26. $date = elgg_view_friendly_time($post->time_created);
  27. $metadata = elgg_view_menu('entity', array(
  28. 'entity' => $post,
  29. 'handler' => 'thewire',
  30. 'sort_by' => 'priority',
  31. 'class' => 'elgg-menu-hz',
  32. ));
  33. $subtitle = "$author_text $date";
  34. // do not show the metadata and controls in widget view
  35. if (elgg_in_context('widgets')) {
  36. $metadata = '';
  37. }
  38. $params = array(
  39. 'entity' => $post,
  40. 'metadata' => $metadata,
  41. 'subtitle' => $subtitle,
  42. 'content' => thewire_filter($post->description),
  43. 'tags' => false,
  44. );
  45. $params = $params + $vars;
  46. $list_body = elgg_view('object/elements/summary', $params);
  47. echo elgg_view_image_block($owner_icon, $list_body);
  48. if ($post->reply) {
  49. echo "<div class=\"thewire-parent hidden\" id=\"thewire-previous-{$post->guid}\">";
  50. echo "</div>";
  51. }