news_list.php 1.0 KB

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. // including necessary files
  4. require_once 'main/inc/global.inc.php';
  5. $tool_name = get_lang('SystemAnnouncements');
  6. $actions = '';
  7. if (api_is_platform_admin()) {
  8. $actions = '<a href="'.api_get_path(WEB_PATH).'main/admin/system_announcements.php">'.Display::return_icon('edit.png', get_lang('EditSystemAnnouncement'), array(), 32).'</a>';
  9. }
  10. if (api_is_anonymous()) {
  11. $visibility = SystemAnnouncementManager::VISIBLE_GUEST;
  12. } else {
  13. $visibility = api_is_allowed_to_create_course() ? SystemAnnouncementManager::VISIBLE_TEACHER : SystemAnnouncementManager::VISIBLE_STUDENT;
  14. }
  15. if (!isset($_GET['id']) || empty($_GET['id'])) {
  16. $content = SystemAnnouncementManager::display_announcements_slider($visibility, $_GET['id']);
  17. } else {
  18. $content = SystemAnnouncementManager::displayAnnouncement($_GET['id'], $visibility);
  19. }
  20. $tpl = new Template($tool_name);
  21. $tpl->assign('actions', $actions);
  22. //$tpl->assign('message', $message);
  23. $tpl->assign('content', $content);
  24. $tpl->display_one_col_template();