Пример #1
0
 function return_announcements($show_slide = true)
 {
     //// Display System announcements
     $hideAnnouncements = api_get_setting('hide_global_announcements_when_not_connected');
     if ($hideAnnouncements == 'true' && empty($userId)) {
         return null;
     }
     $announcement = isset($_GET['announcement']) ? $_GET['announcement'] : null;
     $announcement = intval($announcement);
     if (!api_is_anonymous() && $this->user_id) {
         $visibility = api_is_allowed_to_create_course() ? SystemAnnouncementManager::VISIBLE_TEACHER : SystemAnnouncementManager::VISIBLE_STUDENT;
         if ($show_slide) {
             $announcements = SystemAnnouncementManager::display_announcements_slider($visibility, $announcement);
         } else {
             $announcements = SystemAnnouncementManager::display_all_announcements($visibility, $announcement);
         }
     } else {
         if ($show_slide) {
             $announcements = SystemAnnouncementManager::display_announcements_slider(SystemAnnouncementManager::VISIBLE_GUEST, $announcement);
         } else {
             $announcements = SystemAnnouncementManager::display_all_announcements(SystemAnnouncementManager::VISIBLE_GUEST, $announcement);
         }
     }
     return $announcements;
 }
Пример #2
0
 /**
  * Returns a list of announcements
  * @param int User ID
  * @param bool True: show the announcements as a slider. False: show them as a vertical list
  * @return string HTML list of announcements
  * @assert () != ''
  * @assert (1) != ''
  */
 public function return_announcements($user_id = null, $show_slide = true)
 {
     // Display System announcements
     $announcement = isset($_GET['announcement']) ? intval($_GET['announcement']) : null;
     if (!api_is_anonymous() && $user_id) {
         $visibility = api_is_allowed_to_create_course() ? SystemAnnouncementManager::VISIBLE_TEACHER : SystemAnnouncementManager::VISIBLE_STUDENT;
         if ($show_slide) {
             $announcements = SystemAnnouncementManager::display_announcements_slider($visibility, $announcement);
         } else {
             $announcements = SystemAnnouncementManager::display_all_announcements($visibility, $announcement);
         }
     } else {
         if ($show_slide) {
             $announcements = SystemAnnouncementManager::display_announcements_slider(SystemAnnouncementManager::VISIBLE_GUEST, $announcement);
         } else {
             $announcements = SystemAnnouncementManager::display_all_announcements(SystemAnnouncementManager::VISIBLE_GUEST, $announcement);
         }
     }
     return $announcements;
 }