all.php 959 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * List all currently active announcements
  4. */
  5. // breadcrumb
  6. elgg_push_breadcrumb(elgg_echo('site_annoucements'));
  7. // add button
  8. if (site_announcements_is_editor()) {
  9. elgg_register_title_button();
  10. }
  11. // build page elements
  12. $title = elgg_echo('site_annoucements:all:title');
  13. $options = array(
  14. 'type' => 'object',
  15. 'subtype' => SITE_ANNOUNCEMENT_SUBTYPE,
  16. 'order_by_metadata' => array(
  17. 'name' => 'startdate',
  18. 'as' => 'integer',
  19. 'direction' => 'DESC'
  20. ),
  21. 'metadata_name_value_pairs' => array(
  22. array(
  23. 'name' => 'startdate',
  24. 'value' => time(),
  25. 'operand' => '<='
  26. ),
  27. array(
  28. 'name' => 'enddate',
  29. 'value' => time(),
  30. 'operand' => '>'
  31. )
  32. ),
  33. 'no_results' => elgg_echo('site_annoucements:all:none')
  34. );
  35. $content = elgg_list_entities_from_metadata($options);
  36. // build page
  37. $page_data = elgg_view_layout('content', array(
  38. 'title' => $title,
  39. 'content' => $content
  40. ));
  41. // draw page
  42. echo elgg_view_page($title, $page_data);