site_notification.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Site notification view
  4. */
  5. $entity = $vars['entity'];
  6. $text = $entity->description;
  7. $actor = $entity->getActor();
  8. if ($actor) {
  9. $icon = elgg_view_entity_icon($actor, 'tiny');
  10. }
  11. $url = $entity->getURL();
  12. if ($url) {
  13. $text = elgg_view('output/url', array(
  14. 'text' => $text,
  15. 'href' => $url,
  16. 'is_trusted' => true,
  17. 'class' => 'site-notifications-link',
  18. 'id' => 'site-notifications-link-' . $entity->guid,
  19. ));
  20. }
  21. elgg_register_menu_item('site_notifications', array(
  22. 'name' => 'time',
  23. 'href' => false,
  24. 'text' => elgg_view_friendly_time($entity->getTimeCreated()),
  25. ));
  26. elgg_register_menu_item('site_notifications', array(
  27. 'name' => 'delete',
  28. 'href' => 'action/site_notifications/delete?guid=' . $entity->guid,
  29. 'text' => elgg_view_icon('delete'),
  30. 'is_action' => true,
  31. 'link_class' => 'site-notifications-delete',
  32. 'id' => 'site-notifications-delete-' . $entity->guid,
  33. ));
  34. $menu = elgg_view_menu('site_notifications', array(
  35. 'class' => 'elgg-menu-hz elgg-menu-entity',
  36. ));
  37. $checkbox = elgg_view('input/checkbox', array(
  38. 'name' => 'notification_id[]',
  39. 'value' => $entity->getGUID(),
  40. 'default' => false
  41. ));
  42. $list_body = elgg_view_image_block($icon, $text, array(
  43. 'image_alt' => $menu,
  44. 'class' => 'pvn'
  45. ));
  46. echo elgg_view_image_block($checkbox, $list_body);