item.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Embeddable content list item view
  4. *
  5. * @uses $vars["entity"] ElggEntity object
  6. */
  7. $entity = $vars["entity"];
  8. $title = $entity->title;
  9. if (!$title) {
  10. $title = $entity->name;
  11. }
  12. // don"t let it be too long
  13. $title = elgg_get_excerpt($title);
  14. $owner = $entity->getOwnerEntity();
  15. $subtitle = "";
  16. if ($owner) {
  17. $author_text = elgg_echo("byline", array($owner->name));
  18. $date = elgg_view_friendly_time($entity->time_created);
  19. $group_text = "";
  20. $container = $entity->getContainerEntity();
  21. if (elgg_instanceof($container, "group")) {
  22. $group_text = elgg_echo("river:ingroup", array($container->name));
  23. }
  24. $subtitle = "$author_text $group_text $date";
  25. }
  26. if (elgg_instanceof($entity, "object", "file") && $entity->simpletype == "image") {
  27. $title .= elgg_view_entity_icon($entity, "large", array("img_class" => "embed-insert", "link_class" => "hidden"));
  28. } else {
  29. $title = elgg_view("output/url", array("text" => $title, "href" => $entity->getURL(), "class" => "embed-insert"));
  30. }
  31. $image = elgg_view_entity_icon($entity, "small");
  32. $params = array(
  33. "title" => $title,
  34. "entity" => $entity,
  35. "subtitle" => $subtitle,
  36. "tags" => FALSE,
  37. );
  38. $body = elgg_view("object/elements/summary", $params);
  39. echo elgg_view_image_block($image, $body);