likes.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Elgg show the users who liked the object
  4. *
  5. * @uses $vars['annotation']
  6. */
  7. if (!isset($vars['annotation'])) {
  8. return true;
  9. }
  10. $like = $vars['annotation'];
  11. /* @var ElggAnnotation $like */
  12. $user = $like->getOwnerEntity();
  13. if (!$user) {
  14. return true;
  15. }
  16. $user_icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => false));
  17. $user_link = elgg_view('output/url', array(
  18. 'href' => $user->getURL(),
  19. 'text' => $user->name,
  20. 'is_trusted' => true,
  21. ));
  22. $likes_string = elgg_echo('likes:this');
  23. $friendlytime = elgg_view_friendly_time($like->time_created);
  24. $delete_button = '';
  25. if ($like->canEdit()) {
  26. $delete_button = elgg_view("output/url",array(
  27. 'href' => "action/likes/delete?id={$like->id}",
  28. 'text' => elgg_view_icon('delete', 'float-alt'),
  29. 'confirm' => elgg_echo('likes:delete:confirm'),
  30. 'encode_text' => false,
  31. ));
  32. }
  33. $body = <<<HTML
  34. <p class="mbn">
  35. $delete_button
  36. $user_link $likes_string
  37. <span class="elgg-subtext">
  38. $friendlytime
  39. </span>
  40. </p>
  41. HTML;
  42. echo elgg_view_image_block($user_icon, $body);