news_list.php 1.0 KB

123456789101112131415161718192021222324252627282930
  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">'.
  9. Display::return_icon('edit.png', get_lang('EditSystemAnnouncement'), array(), 32).'</a>';
  10. }
  11. if (api_is_anonymous()) {
  12. $visibility = SystemAnnouncementManager::VISIBLE_GUEST;
  13. } else {
  14. $visibility = api_is_allowed_to_create_course() ? SystemAnnouncementManager::VISIBLE_TEACHER : SystemAnnouncementManager::VISIBLE_STUDENT;
  15. }
  16. if (!isset($_GET['id']) || empty($_GET['id'])) {
  17. $content = SystemAnnouncementManager::display_announcements_slider($visibility, $_GET['id']);
  18. } else {
  19. $content = SystemAnnouncementManager::displayAnnouncement($_GET['id'], $visibility);
  20. }
  21. $tpl = new Template($tool_name);
  22. $tpl->assign('actions', $actions);
  23. //$tpl->assign('message', $message);
  24. $tpl->assign('content', $content);
  25. $tpl->display_one_col_template();