Пример #1
0
 /**
  * If section is not visible, display the message about that ('Not available
  * until...', that sort of thing). Otherwise, returns blank.
  *
  * For users with the ability to view hidden sections, it shows the
  * information even though you can view the section and also may include
  * slightly fuller information (so that teachers can tell when sections
  * are going to be unavailable etc). This logic is the same as for
  * activities.
  *
  * @param stdClass $section The course_section entry from DB
  * @param bool $canviewhidden True if user can view hidden sections
  * @return string HTML to output
  */
 protected function section_availability_message($section, $canviewhidden)
 {
     global $CFG;
     $o = '';
     if (!$section->uservisible) {
         // Note: We only get to this function if availableinfo is non-empty,
         // so there is definitely something to print.
         $formattedinfo = \core_availability\info::format_info($section->availableinfo, $section->course);
         $o .= html_writer::div($formattedinfo, 'availabilityinfo');
     } else {
         if ($canviewhidden && !empty($CFG->enableavailability) && $section->visible) {
             $ci = new \core_availability\info_section($section);
             $fullinfo = $ci->get_full_information();
             if ($fullinfo) {
                 $formattedinfo = \core_availability\info::format_info($fullinfo, $section->course);
                 $o .= html_writer::div($formattedinfo, 'availabilityinfo');
             }
         }
     }
     return $o;
 }