archive.php 953 B

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