favourites.php 1.1 KB

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