summary.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Short summary of the action that occurred
  4. *
  5. * @vars['item'] ElggRiverItem
  6. */
  7. $item = $vars['item'];
  8. $subject = $item->getSubjectEntity();
  9. $object = $item->getObjectEntity();
  10. $subject_link = elgg_view('output/url', array(
  11. 'href' => $subject->getURL(),
  12. 'text' => $subject->name,
  13. 'class' => 'elgg-river-subject',
  14. 'is_trusted' => true,
  15. ));
  16. $object_text = $object->title ? $object->title : $object->name;
  17. $object_link = elgg_view('output/url', array(
  18. 'href' => $object->getURL(),
  19. 'text' => elgg_get_excerpt($object_text, 100),
  20. 'class' => 'elgg-river-object',
  21. 'is_trusted' => true,
  22. ));
  23. $action = $item->action_type;
  24. $type = $item->type;
  25. $subtype = $item->subtype ? $item->subtype : 'default';
  26. // check summary translation keys.
  27. // will use the $type:$subtype if that's defined, otherwise just uses $type:default
  28. $key = "river:$action:$type:$subtype";
  29. $summary = elgg_echo($key, array($subject_link, $object_link));
  30. if ($summary == $key) {
  31. $key = "river:$action:$type:default";
  32. $summary = elgg_echo($key, array($subject_link, $object_link));
  33. }
  34. echo $summary;