editors.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * List all announcement editors
  4. */
  5. site_announcements_editor_gatekeeper();
  6. // breadcrumb
  7. elgg_push_breadcrumb(elgg_echo('site_annoucements'), 'announcements/all');
  8. elgg_push_breadcrumb(elgg_echo('site_annoucements:editors'));
  9. // add button
  10. elgg_register_title_button();
  11. // build page elements
  12. $title = elgg_echo('site_annoucements:editors:title');
  13. // get correct users
  14. $dbprefix = elgg_get_config('dbprefix');
  15. $editor_options = array(
  16. 'type' => 'user',
  17. 'plugin_id' => 'site_announcements',
  18. 'plugin_user_setting_name' => 'editor',
  19. 'limit' => false,
  20. 'callback' => false
  21. );
  22. $options = array(
  23. 'type' => 'user',
  24. 'joins' => array("JOIN {$dbprefix}users_entity ue ON e.guid = ue.guid"),
  25. 'wheres' => array('ue.admin = "yes"'),
  26. 'no_results' => elgg_echo('site_annoucements:editors:none')
  27. );
  28. $editors = elgg_get_entities_from_plugin_user_settings($editor_options);
  29. if (!empty($editors)) {
  30. $editor_guids = array();
  31. foreach ($editors as $row) {
  32. $editor_guids[] = (int) $row->guid;
  33. }
  34. $options['wheres'][0] .= ' OR e.guid IN (' . implode(',', $editor_guids) . ')';
  35. }
  36. $content = elgg_list_entities($options);
  37. // build page
  38. $page_data = elgg_view_layout('content', array(
  39. 'title' => $title,
  40. 'content' => $content
  41. ));
  42. // draw page
  43. echo elgg_view_page($title, $page_data);