Esempio n. 1
0
 /**
  * Output the html for a multiple section page
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections (argument not used)
  * @param array $mods (argument not used)
  * @param array $modnames (argument not used)
  * @param array $modnamesused (argument not used)
  */
 public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)
 {
     global $PAGE;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     $context = context_course::instance($course->id);
     // Title with completion help icon.
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->output->heading($this->page_title(), 2, 'accesshide');
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, 0);
     // Now the list of sections..
     echo $this->start_section_list();
     foreach ($modinfo->get_section_info_all() as $section => $thissection) {
         if ($section == 0) {
             // 0-section is displayed a little different then the others
             if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
                 echo $this->section_header($thissection, $course, false, 0);
                 print_section($course, $thissection, null, null, true, "100%", false, 0);
                 if ($PAGE->user_is_editing()) {
                     print_section_add_menus($course, 0, null, false, false, 0);
                 }
                 echo $this->section_footer();
             }
             continue;
         }
         if ($section > $course->numsections) {
             // activities inside this section are 'orphaned', this section will be printed as 'stealth' below
             continue;
         }
         // Show the section if the user is permitted to access it, OR if it's not available
         // but showavailability is turned on
         $showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && $thissection->showavailability;
         if (!$showsection) {
             // Hidden section message is overridden by 'unavailable' control
             // (showavailability option).
             if (!$course->hiddensections && $thissection->available) {
                 if ($course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
                     echo $this->section_summary($thissection, $course, $mods);
                 } else {
                     echo $this->section_hidden($section);
                 }
             }
             continue;
         }
         if (!$PAGE->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
             // Display section summary only.
             echo $this->section_summary($thissection, $course, null);
         } else {
             echo $this->section_header($thissection, $course, false, 0);
             if ($thissection->uservisible) {
                 print_section($course, $thissection, null, null, true, "100%", false, 0);
                 if ($PAGE->user_is_editing()) {
                     print_section_add_menus($course, $section, null, false, false, 0);
                 }
             }
             echo $this->section_footer();
         }
     }
     if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
         // Print stealth sections if present.
         foreach ($modinfo->get_section_info_all() as $section => $thissection) {
             if ($section <= $course->numsections or empty($modinfo->sections[$section])) {
                 // this is not stealth section or it is empty
                 continue;
             }
             echo $this->stealth_section_header($section);
             print_section($course, $thissection, null, null, true, "100%", false, 0);
             echo $this->stealth_section_footer();
         }
         echo $this->end_section_list();
         echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
         // Increase number of sections.
         $straddsection = get_string('increasesections', 'moodle');
         $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
         $icon = $this->output->pix_icon('t/switch_plus', $straddsection);
         echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
         if ($course->numsections > 0) {
             // Reduce number of sections sections.
             $strremovesection = get_string('reducesections', 'moodle');
             $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
             $icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
             echo html_writer::link($url, $icon . get_accesshide($strremovesection), array('class' => 'reduce-sections'));
         }
         echo html_writer::end_tag('div');
     } else {
         echo $this->end_section_list();
     }
 }
Esempio n. 2
0
 /**
  * Output the html for a multiple section page
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections (argument not used)
  * @param array $mods (argument not used)
  * @param array $modnames (argument not used)
  * @param array $modnamesused (argument not used)
  */
 public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)
 {
     $modinfo = get_fast_modinfo($course);
     $course = $this->courseformat->get_course();
     if (empty($this->tcsettings)) {
         $this->tcsettings = $this->courseformat->get_settings();
     }
     $context = context_course::instance($course->id);
     // Title with completion help icon.
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->output->heading($this->page_title(), 2, 'accesshide');
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, 0);
     // Now the list of sections..
     $this->tccolumnwidth = 100;
     // Reset to default.
     echo $this->start_section_list();
     $sections = $modinfo->get_section_info_all();
     // General section if non-empty.
     $thissection = $sections[0];
     unset($sections[0]);
     if ($thissection->summary or !empty($modinfo->sections[0]) or $this->userisediting) {
         echo $this->section_header($thissection, $course, false, 0);
         echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
         echo $this->courserenderer->course_section_add_cm_control($course, $thissection->section, 0, 0);
         echo $this->section_footer();
     }
     if ($course->numsections > 0) {
         if ($course->numsections > 1) {
             if ($this->userisediting || $course->coursedisplay != COURSE_DISPLAY_MULTIPAGE) {
                 // Collapsed Topics all toggles.
                 echo $this->toggle_all();
                 if ($this->tcsettings['displayinstructions'] == 2) {
                     // Collapsed Topics instructions.
                     echo $this->display_instructions();
                 }
             }
         }
         $currentsectionfirst = false;
         if ($this->tcsettings['layoutstructure'] == 4) {
             $currentsectionfirst = true;
         }
         if ($this->tcsettings['layoutstructure'] != 3 || $this->userisediting) {
             $section = 1;
         } else {
             $timenow = time();
             $weekofseconds = 604800;
             $course->enddate = $course->startdate + $weekofseconds * $course->numsections;
             $section = $course->numsections;
             $weekdate = $course->enddate;
             // This should be 0:00 Monday of that week.
             $weekdate -= 7200;
             // Subtract two hours to avoid possible DST problems.
         }
         $numsections = $course->numsections;
         // Because we want to manipulate this for column breakpoints.
         if ($this->tcsettings['layoutstructure'] == 3 && $this->userisediting == false) {
             $loopsection = 1;
             $numsections = 0;
             while ($loopsection <= $course->numsections) {
                 $nextweekdate = $weekdate - $weekofseconds;
                 if ((($thissection->uservisible || $thissection->visible && !$thissection->available && !empty($thissection->availableinfo)) && $nextweekdate <= $timenow) == true) {
                     $numsections++;
                     // Section not shown so do not count in columns calculation.
                 }
                 $weekdate = $nextweekdate;
                 $section--;
                 $loopsection++;
             }
             // Reset.
             $section = $course->numsections;
             $weekdate = $course->enddate;
             // This should be 0:00 Monday of that week.
             $weekdate -= 7200;
             // Subtract two hours to avoid possible DST problems.
         }
         if ($numsections < $this->tcsettings['layoutcolumns']) {
             $this->tcsettings['layoutcolumns'] = $numsections;
             // Help to ensure a reasonable display.
         }
         if ($this->tcsettings['layoutcolumns'] > 1 && $this->mobiletheme === false) {
             if ($this->tcsettings['layoutcolumns'] > 4) {
                 // Default in config.php (and reset in database) or database has been changed incorrectly.
                 $this->tcsettings['layoutcolumns'] = 4;
                 // Update....
                 $this->courseformat->update_topcoll_columns_setting($this->tcsettings['layoutcolumns']);
             }
             if ($this->tablettheme === true && $this->tcsettings['layoutcolumns'] > 2) {
                 // Use a maximum of 2 for tablets.
                 $this->tcsettings['layoutcolumns'] = 2;
             }
             $this->tccolumnwidth = 100 / $this->tcsettings['layoutcolumns'];
             if ($this->tcsettings['layoutcolumnorientation'] == 2) {
                 // Horizontal column layout.
                 $this->tccolumnwidth -= 1;
             } else {
                 $this->tccolumnwidth -= 0.2;
             }
             $this->tccolumnpadding = 0;
             // In 'px'.
         } else {
             if ($this->tcsettings['layoutcolumns'] < 1) {
                 // Distributed default in plugin settings (and reset in database) or database has been changed incorrectly.
                 $this->tcsettings['layoutcolumns'] = 1;
                 // Update....
                 $this->courseformat->update_topcoll_columns_setting($this->tcsettings['layoutcolumns']);
             }
         }
         echo $this->end_section_list();
         echo $this->start_toggle_section_list();
         $loopsection = 1;
         $canbreak = false;
         // Once the first section is shown we can decide if we break on another column.
         $columncount = 1;
         $columnbreakpoint = 0;
         $shownsectioncount = 0;
         if ($this->userpreference != null) {
             $this->isoldtogglepreference = $this->togglelib->is_old_preference($this->userpreference);
             if ($this->isoldtogglepreference == true) {
                 $ts1 = base_convert(substr($this->userpreference, 0, 6), 36, 2);
                 $ts2 = base_convert(substr($this->userpreference, 6, 12), 36, 2);
                 $thesparezeros = "00000000000000000000000000";
                 if (strlen($ts1) < 26) {
                     // Need to PAD.
                     $ts1 = substr($thesparezeros, 0, 26 - strlen($ts1)) . $ts1;
                 }
                 if (strlen($ts2) < 27) {
                     // Need to PAD.
                     $ts2 = substr($thesparezeros, 0, 27 - strlen($ts2)) . $ts2;
                 }
                 $tb = $ts1 . $ts2;
             } else {
                 // Check we have enough digits for the number of toggles in case this has increased.
                 $numdigits = $this->togglelib->get_required_digits($course->numsections);
                 if ($numdigits > strlen($this->userpreference)) {
                     if ($this->defaultuserpreference == 0) {
                         $dchar = $this->togglelib->get_min_digit();
                     } else {
                         $dchar = $this->togglelib->get_max_digit();
                     }
                     for ($i = strlen($this->userpreference); $i < $numdigits; $i++) {
                         $this->userpreference .= $dchar;
                     }
                 }
                 $this->togglelib->set_toggles($this->userpreference);
             }
         } else {
             $numdigits = $this->togglelib->get_required_digits($course->numsections);
             if ($this->defaultuserpreference == 0) {
                 $dchar = $this->togglelib->get_min_digit();
             } else {
                 $dchar = $this->togglelib->get_max_digit();
             }
             $this->userpreference = '';
             for ($i = 0; $i < $numdigits; $i++) {
                 $this->userpreference .= $dchar;
             }
             $this->togglelib->set_toggles($this->userpreference);
         }
         while ($loopsection <= $course->numsections) {
             if ($this->tcsettings['layoutstructure'] == 3 && $this->userisediting == false) {
                 $nextweekdate = $weekdate - $weekofseconds;
             }
             $thissection = $modinfo->get_section_info($section);
             /* Show the section if the user is permitted to access it, OR if it's not available
                but there is some available info text which explains the reason & should display. */
             if ($this->tcsettings['layoutstructure'] != 3 || $this->userisediting) {
                 $showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && !empty($thissection->availableinfo);
             } else {
                 $showsection = ($thissection->uservisible || $thissection->visible && !$thissection->available && !empty($thissection->availableinfo)) && $nextweekdate <= $timenow;
             }
             if ($currentsectionfirst == true && $showsection == true) {
                 // Show  the section if we were meant to and it is the current section:....
                 $showsection = $course->marker == $section;
             } else {
                 if ($this->tcsettings['layoutstructure'] == 4 && $course->marker == $section) {
                     $showsection = false;
                     // Do not reshow current section.
                 }
             }
             if (!$showsection) {
                 // Hidden section message is overridden by 'unavailable' control.
                 if ($this->tcsettings['layoutstructure'] != 4) {
                     if ($this->tcsettings['layoutstructure'] != 3 || $this->userisediting) {
                         if (!$course->hiddensections && $thissection->available) {
                             $shownsectioncount++;
                             echo $this->section_hidden($thissection);
                         }
                     }
                 }
             } else {
                 $shownsectioncount++;
                 if (!$this->userisediting && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
                     // Display section summary only.
                     echo $this->section_summary($thissection, $course, null);
                 } else {
                     if ($this->isoldtogglepreference == true) {
                         $togglestate = substr($tb, $section, 1);
                         if ($togglestate == '1') {
                             $thissection->toggle = true;
                         } else {
                             $thissection->toggle = false;
                         }
                     } else {
                         $thissection->toggle = $this->togglelib->get_toggle_state($thissection->section);
                     }
                     echo $this->section_header($thissection, $course, false, 0);
                     if ($thissection->uservisible) {
                         echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
                         echo $this->courserenderer->course_section_add_cm_control($course, $thissection->section, 0);
                     }
                     echo html_writer::end_tag('div');
                     echo $this->section_footer();
                 }
             }
             if ($currentsectionfirst == false) {
                 /* Only need to do this on the iteration when $currentsectionfirst is not true as this iteration will always
                    happen.  Otherwise you get duplicate entries in course_sections in the DB. */
                 unset($sections[$section]);
             }
             if ($this->tcsettings['layoutstructure'] != 3 || $this->userisediting) {
                 $section++;
             } else {
                 $section--;
                 if ($this->tcsettings['layoutstructure'] == 3 && $this->userisediting == false) {
                     $weekdate = $nextweekdate;
                 }
             }
             if ($this->mobiletheme === false) {
                 // Only break in non-mobile themes.
                 if ($this->tcsettings['layoutcolumnorientation'] == 1) {
                     // Only break columns in vertical mode.
                     if ($canbreak == false && $currentsectionfirst == false && $showsection == true) {
                         $canbreak = true;
                         $columnbreakpoint = $shownsectioncount + $numsections / $this->tcsettings['layoutcolumns'] - 1;
                         if ($this->tcsettings['layoutstructure'] == 4) {
                             $columnbreakpoint -= 1;
                         }
                     }
                     if ($currentsectionfirst == false && $canbreak == true && $shownsectioncount >= $columnbreakpoint && $columncount < $this->tcsettings['layoutcolumns']) {
                         echo $this->end_section_list();
                         echo $this->start_toggle_section_list();
                         $columncount++;
                         // Next breakpoint is...
                         $columnbreakpoint += $numsections / $this->tcsettings['layoutcolumns'];
                     }
                 }
             }
             $loopsection++;
             if ($currentsectionfirst == true && $loopsection > $course->numsections) {
                 // Now show the rest.
                 $currentsectionfirst = false;
                 $loopsection = 1;
                 $section = 1;
             }
             if ($section > $course->numsections) {
                 // Activities inside this section are 'orphaned', this section will be printed as 'stealth' below.
                 break;
             }
         }
     }
     if ($this->userisediting and has_capability('moodle/course:update', $context)) {
         // Print stealth sections if present.
         foreach ($modinfo->get_section_info_all() as $section => $thissection) {
             if ($section <= $course->numsections or empty($modinfo->sections[$section])) {
                 // This is not stealth section or it is empty.
                 continue;
             }
             echo $this->stealth_section_header($section);
             echo $this->courserenderer->course_section_cm_list($course, $thissection->section, 0);
             echo $this->stealth_section_footer();
         }
         echo $this->end_section_list();
         echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
         // Increase number of sections.
         $straddsection = get_string('increasesections', 'moodle');
         $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
         $icon = $this->output->pix_icon('t/switch_plus', $straddsection);
         echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
         if ($course->numsections > 0) {
             // Reduce number of sections sections.
             $strremovesection = get_string('reducesections', 'moodle');
             $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
             $icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
             echo html_writer::link($url, $icon . get_accesshide($strremovesection), array('class' => 'reduce-sections'));
         }
         echo html_writer::end_tag('div');
     } else {
         echo $this->end_section_list();
     }
 }
 protected function print_single_section_page_content($course, $sections, $mods, $modnames, $modnamesused, $displaysection, $showsectionzero = 1)
 {
     global $PAGE;
     $modinfo = \get_fast_modinfo($course);
     $course = \course_get_format($course)->get_course();
     // Can we view the section in question?
     if (!($sectioninfo = $modinfo->get_section_info($displaysection))) {
         // This section doesn't exist.
         print_error('unknowncoursesection', 'error', null, $course->fullname);
         return false;
     }
     if (!$sectioninfo->uservisible) {
         if (!$course->hiddensections) {
             echo $this->start_section_list();
             echo $this->section_hidden($displaysection);
             echo $this->end_section_list();
         }
         // Can't view this section.
         return false;
     }
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, $displaysection);
     if ($showsectionzero) {
         $thissection = $modinfo->get_section_info(0);
         if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
             echo $this->start_section_list();
             echo $this->section_header($thissection, $course, true, $displaysection);
             echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
             echo $this->courserenderer->course_section_add_cm_control($course, 0, $displaysection);
             echo $this->section_footer();
             echo $this->end_section_list();
         }
     }
     // Start single-section div.
     echo \html_writer::start_tag('div', array('class' => 'single-section'));
     // The requested section page.
     $thissection = $modinfo->get_section_info($displaysection);
     // Title with section navigation links.
     $sectionnavlinks = $this->get_nav_links($course, $modinfo->get_section_info_all(), $displaysection);
     // Construct navigation links.
     $sectionnav = \html_writer::start_tag('nav', array('class' => 'section-navigation'));
     $sectionnav .= $sectionnavlinks['previous'];
     $sectionnav .= $sectionnavlinks['next'];
     $sectionnav .= \html_writer::empty_tag('br', array('style' => 'clear:both'));
     $sectionnav .= \html_writer::end_tag('nav');
     $sectionnav .= \html_writer::tag('div', '', array('class' => 'bor'));
     // Output Section Navigation.
     echo $sectionnav;
     // Define the Section Title.
     $sectiontitle = '';
     $sectiontitle .= \html_writer::start_tag('div', array('class' => 'section-title'));
     // Title attributes.
     $titleattr = 'title';
     if (!$thissection->visible) {
         $titleattr .= ' dimmed_text';
     }
     $sectiontitle .= \html_writer::start_tag('h3', array('class' => $titleattr));
     $sectiontitle .= \get_section_name($course, $displaysection);
     $sectiontitle .= \html_writer::end_tag('h3');
     $sectiontitle .= \html_writer::end_tag('div');
     // Output the Section Title.
     echo $sectiontitle;
     // Now the list of sections.
     echo $this->start_section_list();
     echo $this->section_header($thissection, $course, true, $displaysection);
     // Show completion help icon.
     $completioninfo = new \completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
     echo $this->courserenderer->course_section_add_cm_control($course, $displaysection, $displaysection);
     echo $this->section_footer();
     echo $this->end_section_list();
     // Close single-section div.
     echo \html_writer::end_tag('div');
 }
Esempio n. 4
0
 /**
  * Output the html for a multiple section page
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections (argument not used)
  * @param array $mods (argument not used)
  * @param array $modnames (argument not used)
  * @param array $modnamesused (argument not used)
  */
 public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)
 {
     global $PAGE;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     $context = context_course::instance($course->id);
     // Title with completion help icon.
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->output->heading($this->page_title(), 2, 'accesshide');
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, 0);
     //We want to save the last section, for adding a new one
     $lastsection = 0;
     // Now the list of sections..
     echo $this->start_section_list();
     foreach ($modinfo->get_section_info_all() as $section => $thissection) {
         if ($section == 0) {
             // 0-section is displayed a little different then the others
             if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
                 echo $this->section_header($thissection, $course, false, 0);
                 echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
                 echo $this->courserenderer->course_section_add_cm_control($course, 0, 0);
                 echo $this->section_footer();
             }
             continue;
         }
         // Show the section if the user is permitted to access it, OR if it's not available
         // but showavailability is turned on (and there is some available info text).
         $showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && $thissection->showavailability && !empty($thissection->availableinfo);
         if (!$showsection) {
             // Hidden section message is overridden by 'unavailable' control
             // (showavailability option).
             if (!$course->hiddensections && $thissection->available) {
                 echo $this->section_hidden($section);
             }
             continue;
         }
         if (!$PAGE->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
             // Display section summary only.
             echo $this->section_summary($thissection, $course, null);
         } else {
             echo $this->section_header($thissection, $course, false, 0);
             if ($thissection->uservisible) {
                 echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
                 echo $this->courserenderer->course_section_add_cm_control($course, $section, 0);
             }
             echo $this->section_footer();
         }
         $lastsection = $section;
     }
     if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
         // Print stealth sections if present.
         foreach ($modinfo->get_section_info_all() as $section => $thissection) {
             if ($section <= $course->numsections or empty($modinfo->sections[$section])) {
                 // this is not stealth section or it is empty
                 continue;
             }
             echo $this->stealth_section_header($section);
             echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
             echo $this->stealth_section_footer();
         }
         echo $this->end_section_list();
         echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
         // Increase number of sections.
         $straddsection = 'Ajouter une section';
         $icon = $this->output->pix_icon('t/switch_plus', $straddsection);
         $url = new moodle_url('changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey(), 'sectionid' => $lastsection + 1));
         echo html_writer::span($straddsection . " ");
         echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
         echo '<br/>';
         // Add an activity (section with name activity, not visible)
         /*$url = new moodle_url('changenumsections.php',
               array('courseid' => $course->id,
                     'increase' => true,
                     'sesskey' => sesskey(),
                     'sectionid' => $lastsection+1,
                     'activity' => true ));
           $straddactivity = 'Ajouter une &eacute;valuation';
           $icon = $this->output->pix_icon('t/switch_plus', $straddactivity);
           echo html_writer::span($straddactivity." ");
           echo html_writer::link($url, $icon.get_accesshide($straddactivity), array('class' => 'increase-sections'));
           */
         echo html_writer::end_tag('div');
     } else {
         echo $this->end_section_list();
     }
 }
Esempio n. 5
0
 /**
  * Output the html for a multiple section page
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections (argument not used)
  * @param array $mods (argument not used)
  * @param array $modnames (argument not used)
  * @param array $modnamesused (argument not used)
  */
 public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)
 {
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     $context = context_course::instance($course->id);
     // Title with completion help icon.
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->output->heading($this->page_title(), 2, 'accesshide');
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, 0);
     $sections = $modinfo->get_section_info_all();
     // Remove general section.
     unset($sections[0]);
     // Now the list of sections..
     echo $this->start_section_list();
     $sections = $modinfo->get_section_info_all();
     $thissection = $sections[0];
     unset($sections[0]);
     if ($this->userisediting) {
         echo $this->start_section_list();
         // General section when editing or YUI D&D gets confused!
         echo $this->section_header($thissection, $course, false, 0);
         echo $this->section_footer();
     }
     // Tabs.
     if (!$this->userisediting) {
         echo html_writer::start_tag('ul', array('class' => 'nav nav-pills nav-wizard', 'role' => 'tablist'));
         foreach ($sections as $section => $thissection) {
             $first = false;
             $last = false;
             if ($section > $course->numsections) {
                 // Activities inside this section are 'orphaned', this section will be printed as 'stealth' below.
                 continue;
             }
             if ($section == $course->numsections) {
                 $last = true;
             }
             if ($section == 1) {
                 $first = true;
             }
             /* Show the section if the user is permitted to access it, OR if it's not available
                but there is some available info text which explains the reason & should display. */
             $showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && !empty($thissection->availableinfo);
             if (!$showsection) {
                 continue;
             }
             $tabattributes = array('role' => 'presentation', 'id' => 'navtab' . $section, 'class' => 'tabbednavtab');
             if (!$this->activesection) {
                 $this->activesection = $thissection->section;
                 $tabattributes['class'] = 'tabbednavtab active';
             }
             echo html_writer::start_tag('li', $tabattributes);
             if (!$first) {
                 echo html_writer::tag('div', '', array('class' => 'nav-wedge'));
             }
             echo html_writer::tag('a', $this->courseformat->get_section_name($thissection), array('href' => '#section-' . $thissection->section, 'data-toggle' => 'tab', 'role' => 'tab', 'aria-controls' => 'section-' . $thissection->section));
             if (!$last) {
                 echo html_writer::tag('div', '', array('class' => 'nav-arrow'));
             }
             echo html_writer::end_tag('li');
         }
         echo html_writer::end_tag('ul');
         echo html_writer::start_tag('div', array('id' => 'tabbedcontent', 'class' => 'tab-content'));
     }
     // Tabbed.
     foreach ($sections as $section => $thissection) {
         if ($section > $course->numsections) {
             // Activities inside this section are 'orphaned', this section will be printed as 'stealth' below.
             continue;
         }
         /* Show the section if the user is permitted to access it, OR if it's not available
            but there is some available info text which explains the reason & should display. */
         $showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && !empty($thissection->availableinfo);
         if (!$showsection) {
             /* If the hiddensections option is set to 'show hidden sections in collapsed
                form', then display the hidden section message - UNLESS the section is
                hidden by the availability system, which is set to hide the reason. */
             if (!$course->hiddensections && $thissection->available) {
                 echo $this->section_hidden($section, $course->id);
             }
             continue;
         }
         echo $this->section_header($thissection, $course, false, 0);
         if ($thissection->uservisible) {
             echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
             echo $this->courserenderer->course_section_add_cm_control($course, $section, 0);
             $sectionnavlinks = $this->get_nav_links($course, $modinfo->get_section_info_all(), $section);
             $navlinks = html_writer::start_tag('div', array('class' => 'section-navigation navigationtitle'));
             $navlinks .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'pull-left'));
             $navlinks .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'pull-right'));
             $navlinks .= html_writer::end_tag('div');
             echo $navlinks;
         }
         echo $this->section_footer();
     }
     if ($this->userisediting and has_capability('moodle/course:update', $context)) {
         // Print stealth sections if present.
         foreach ($modinfo->get_section_info_all() as $section => $thissection) {
             if ($section <= $course->numsections or empty($modinfo->sections[$section])) {
                 // This is not stealth section or it is empty.
                 continue;
             }
             echo $this->stealth_section_header($section);
             echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
             echo $this->stealth_section_footer();
         }
         echo $this->end_section_list();
         echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
         // Increase number of sections.
         $straddsection = get_string('increasesections', 'moodle');
         $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
         $icon = $this->output->pix_icon('t/switch_plus', $straddsection);
         echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
         if ($course->numsections > 0) {
             // Reduce number of sections sections.
             $strremovesection = get_string('reducesections', 'moodle');
             $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
             $icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
             echo html_writer::link($url, $icon . get_accesshide($strremovesection), array('class' => 'reduce-sections'));
         }
         echo html_writer::end_tag('div');
     } else {
         if ($this->userisediting) {
             echo $this->end_section_list();
         } else {
             echo html_writer::end_tag('div');
         }
     }
 }
Esempio n. 6
0
 /**
  * Output the html for a multiple section page
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections (argument not used)
  * @param array $mods (argument not used)
  * @param array $modnames (argument not used)
  * @param array $modnamesused (argument not used)
  */
 public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)
 {
     global $PAGE, $SESSION, $DB, $USER;
     $updateposition = get_string('updateposition', 'format_gps');
     $loadinggps = html_writer::div(get_string('loadinggps', 'format_gps'), 'loadinggps');
     echo $loadinggps;
     $modaldiv = html_writer::div($updateposition, 'updateposition hide', array('id' => 'updatepositionclick'));
     echo $modaldiv;
     // Module form with map.
     $viewcourse = new moodle_url('/course/view.php', array('id' => $course->id));
     $link = html_writer::link($viewcourse, get_string('update'), array('class' => 'gps-continue'));
     $innerdiv = html_writer::div($link, 'innerdiv', array('id' => 'innerdiv'));
     $updatecourseviewlink = html_writer::div($innerdiv, 'buttonbubble', array('id' => 'outerdiv'));
     $map = html_writer::div('', 'googlemap', array('id' => 'map'));
     $mapcontainer = html_writer::div($map . $updatecourseviewlink, 'mapcontainer', array('id' => 'mapcontainer'));
     $modalform = html_writer::div($mapcontainer, 'popupgeo', array('id' => 'popupgeo'));
     echo $modalform;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     $context = context_course::instance($course->id);
     // Title with completion help icon.
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->output->heading($this->page_title(), 2, 'accesshide');
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, 0);
     // Now the list of sections..
     echo $this->start_section_list();
     $location = $this->gps_get_user_location($USER->id);
     foreach ($modinfo->get_section_info_all() as $section => $thissection) {
         if ($section == 0) {
             // 0-section is displayed a little different then the others.
             if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
                 echo $this->section_header($thissection, $course, false, 0);
                 $courserenderer = $PAGE->get_renderer('core', 'course');
                 echo $courserenderer->course_section_cm_list($course, $thissection, 0);
                 if ($PAGE->user_is_editing()) {
                     echo $courserenderer->course_section_add_cm_control($course, 0, 0);
                 }
                 echo $this->section_footer();
             }
             continue;
         }
         if ($section > $course->numsections) {
             // Activities inside this section are 'orphaned', this section will be printed as 'stealth' below.
             continue;
         }
         // Show the section if the user is permitted to access it, OR if it's not available.
         // but showavailability is turned on (and there is some available info text).
         $proximity = new stdClass();
         if ($thissection->format_gps_restricted == FORMAT_GPS_RESTRICTED) {
             if ($location) {
                 $proximity = format_gps_check_proximity($thissection, $location);
             } else {
                 $proximity->status = 'notallowed';
             }
         } else {
             $proximity->status = 'ok';
         }
         $showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && $thissection->showavailability && !empty($thissection->availableinfo);
         if (!$showsection || $proximity->status == 'toofar' || $proximity->status == 'notallowed') {
             if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) {
                 // Do nothing.
             } else {
                 $thissection->visible = false;
                 // Hidden section message is overridden by 'unavailable' control
                 // (showavailability option).
                 if ($proximity->status == 'toofar') {
                     if (!$course->hiddensections && $thissection->available) {
                         echo $this->gps_section_hidden($section);
                     }
                 } else {
                     if ($proximity->status == 'notallowed') {
                         if (!$course->hiddensections && $thissection->available) {
                             echo $this->gps_section_notallowed($section);
                         }
                     } else {
                         if (!$course->hiddensections && $thissection->available) {
                             echo $this->section_hidden($section);
                         }
                     }
                 }
                 continue;
             }
         }
         if (!$PAGE->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
             // Display section summary only.
             echo $this->section_summary($thissection, $course, null);
         } else {
             echo $this->section_header($thissection, $course, false, 0);
             if ($thissection->uservisible) {
                 $courserenderer = $PAGE->get_renderer('core', 'course');
                 echo $courserenderer->course_section_cm_list($course, $thissection, 0);
                 if ($PAGE->user_is_editing()) {
                     echo $courserenderer->course_section_add_cm_control($course, $section, 0);
                 }
             }
             echo $this->section_footer();
         }
     }
     if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
         // Print stealth sections if present.
         foreach ($modinfo->get_section_info_all() as $section => $thissection) {
             if ($section <= $course->numsections or empty($modinfo->sections[$section])) {
                 // This is not stealth section or it is empty.
                 continue;
             }
             echo $this->stealth_section_header($section);
             $courserenderer = $PAGE->get_renderer('core', 'course');
             echo $courserenderer->course_section_cm_list($course, $thissection, 0);
             echo $this->stealth_section_footer();
         }
         echo $this->end_section_list();
         echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
         // Increase number of sections.
         $straddsection = get_string('increasesections', 'moodle');
         $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
         $icon = $this->output->pix_icon('t/switch_plus', $straddsection);
         echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
         if ($course->numsections > 0) {
             // Reduce number of sections sections.
             $strremovesection = get_string('reducesections', 'moodle');
             $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
             $icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
             echo html_writer::link($url, $icon . get_accesshide($strremovesection), array('class' => 'reduce-sections'));
         }
         echo html_writer::end_tag('div');
     } else {
         echo $this->end_section_list();
     }
 }
Esempio n. 7
0
 $strshowalltopics = get_string('showalltopics', 'format_bootstraptabs');
 $strtopic = get_string('topic');
 $strgroups = get_string('groups');
 $strgroupmy = get_string('groupmy');
 $editing = $PAGE->user_is_editing();
 if ($editing) {
     $strtopichide = get_string('hidetopicfromothers');
     $strtopicshow = get_string('showtopicfromothers');
     $strmarkthistopic = get_string('markthistopic');
     $strmarkedthistopic = get_string('markedthistopic');
     $strmoveup = get_string('moveup');
     $strmovedown = get_string('movedown');
 }
 // Print the Your progress icon if the track completion is enabled
 $completioninfo = new completion_info($course);
 echo $completioninfo->display_help_icon();
 /// If currently moving a file then show the current clipboard
 //not too sure what this does
 if (ismoving($course->id)) {
     // Note, an ordered list would confuse - "1" could be the clipboard or summary.
     echo "<ul class='topicstabs'>\n";
     $stractivityclipboard = strip_tags(get_string('activityclipboard', '', $USER->activitycopyname));
     $strcancel = get_string('cancel');
     echo '<li class="clipboard">';
     echo $stractivityclipboard . '&nbsp;&nbsp;(<a href="mod.php?cancelcopy=true&amp;sesskey=' . sesskey() . '">' . $strcancel . '</a>)';
     echo "</li>\n";
     echo '</ul>';
 }
 //Insert the section 0
 $section = 0;
 $thissection = $sections[$section];
Esempio n. 8
0
 /**
  * Output the html for a multiple section page
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections (argument not used)
  * @param array $mods (argument not used)
  * @param array $modnames (argument not used)
  * @param array $modnamesused (argument not used)
  */
 public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)
 {
     global $PAGE;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     $context = context_course::instance($course->id);
     // Title with completion help icon.
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->output->heading($this->page_title(), 2, 'accesshide');
     echo "<style>\n            .left {display:none;} \n            h3 {line-height:none;} \n            .right {float:right;}\n            .section-modchooser {\n                width: 20px;\n                height: 20px;\n                background-color: red;\n                border-radius: 50%;\n                text-align: center;\n                float: right;\n                }\n            .section-modchooser-link img.smallicon {\n                padding-bottom: 3px;\n            }\n            .block, #page #page-content #region-main, #page #page-content div[role=\"main\"], .pagelayout-redirect #page-content #region-main, .pagelayout-redirect #page-content div[role=\"main\"] {\n                border: none;\n                border-radius: none;\n                padding: 0px;\n            }\n            .coursetitle {text-transform: uppercase; padding-bottom: 5px;}\n            .bor {display:none;}\n            </style>";
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, 0);
     echo html_writer::start_div("tabbable tabs-left");
     echo html_writer::start_tag("ul", array("class" => "nav nav-tabs", "role" => "tablist"));
     // Show navigation tabs (bootstrap like)
     $tabshtml = "";
     $section0html = "";
     $currentfound = false;
     foreach ($modinfo->get_section_info_all() as $section => $thissection) {
         $a = html_writer::tag("a", get_section_name($course, $thissection), array("href" => "#section-" . $section, "aria-controls" => "profile", "role" => "tab", "data-toggle" => "tab"));
         $style = "";
         if (course_get_format($course)->is_section_current($section)) {
             $style = "active";
             $currentfound = true;
         }
         if ($section == 0) {
             $section0html = $a;
         } else {
             $tabshtml .= html_writer::tag("li", $a, array("role" => "presentation", "class" => $style));
         }
     }
     $style = $currentfound ? "" : "active";
     echo html_writer::tag("li", $section0html, array("role" => "presentation", "class" => $style)) . $tabshtml;
     echo html_writer::end_tag("ul");
     // Now the list of sections..
     echo $this->start_section_list();
     $cmlist = "";
     $firstsection = "";
     $firstsectionhead = "";
     $firstsectionheadactive = "";
     $currentfound = false;
     foreach ($modinfo->get_section_info_all() as $section => $thissection) {
         if (course_get_format($course)->is_section_current($section)) {
             $currentfound = true;
         }
         if ($section == 0) {
             // 0-section is displayed a little different then the others
             if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
                 $firstsectionhead = $this->section_header($thissection, $course, false, 0, false);
                 $firstsectionheadactive = $this->section_header($thissection, $course, false, 0, true);
                 $firstsection .= $this->courserenderer->course_section_cm_list($course, $thissection, 0);
                 $firstsection .= $this->courserenderer->course_section_add_cm_control($course, 0, 0);
                 $firstsection .= $this->section_footer();
             }
             continue;
         }
         if ($section > $course->numsections) {
             // activities inside this section are 'orphaned', this section will be printed as 'stealth' below
             continue;
         }
         // Show the section if the user is permitted to access it, OR if it's not available
         // but there is some available info text which explains the reason & should display.
         $showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && !empty($thissection->availableinfo);
         if (!$showsection) {
             // If the hiddensections option is set to 'show hidden sections in collapsed
             // form', then display the hidden section message - UNLESS the section is
             // hidden by the availability system, which is set to hide the reason.
             if (!$course->hiddensections && $thissection->available) {
                 $cmlist .= $this->section_hidden($section, $course->id);
             }
             continue;
         }
         if (!$PAGE->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
             // Display section summary only.
             $cmlist .= $this->section_summary($thissection, $course, null);
         } else {
             $cmlist .= $this->section_header($thissection, $course, false, 0);
             if ($thissection->uservisible) {
                 $cmlist .= $this->courserenderer->course_section_cm_list($course, $thissection, 0);
                 $cmlist .= $this->courserenderer->course_section_add_cm_control($course, $section, 0);
             }
             $cmlist .= $this->section_footer();
         }
     }
     if (!$currentfound) {
         $firstsection = $firstsectionheadactive . $firstsection;
     } else {
         $firstsection = $firstsectionhead . $firstsection;
     }
     echo $firstsection . $cmlist;
     if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
         // Print stealth sections if present.
         foreach ($modinfo->get_section_info_all() as $section => $thissection) {
             if ($section <= $course->numsections or empty($modinfo->sections[$section])) {
                 // this is not stealth section or it is empty
                 continue;
             }
             echo $this->stealth_section_header($section);
             echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
             echo $this->stealth_section_footer();
         }
         echo $this->end_section_list();
         echo html_writer::end_div();
         echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
         // Increase number of sections.
         $straddsection = get_string('increasesections', 'moodle');
         $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
         $icon = $this->output->pix_icon('t/switch_plus', $straddsection);
         echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
         if ($course->numsections > 0) {
             // Reduce number of sections sections.
             $strremovesection = get_string('reducesections', 'moodle');
             $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
             $icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
             echo html_writer::link($url, $icon . get_accesshide($strremovesection), array('class' => 'reduce-sections'));
         }
         echo html_writer::end_tag('div');
     } else {
         echo $this->end_section_list();
     }
 }
Esempio n. 9
0
 /**
  * Output the html for a multiple section page
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections The course_sections entries from the DB
  * @param array $mods used for print_section()
  * @param array $modnames used for print_section()
  * @param array $modnamesused used for print_section()
  */
 public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)
 {
     global $PAGE;
     $context = context_course::instance($course->id);
     // Title with completion help icon.
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->output->heading($this->page_title(), 2, 'accesshide');
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course);
     // Now the list of sections..
     echo $this->start_section_list();
     // General section if non-empty.
     $thissection = $sections[0];
     unset($sections[0]);
     if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
         echo $this->section_header($thissection, $course, true);
         print_section($course, $thissection, $mods, $modnamesused, true);
         if ($PAGE->user_is_editing()) {
             print_section_add_menus($course, 0, $modnames);
         }
         echo $this->section_footer();
     }
     $canviewhidden = has_capability('moodle/course:viewhiddensections', $context);
     for ($section = 1; $section <= $course->numsections; $section++) {
         if (!empty($sections[$section])) {
             $thissection = $sections[$section];
         } else {
             // This will create a course section if it doesn't exist..
             $thissection = get_course_section($section, $course->id);
             // The returned section is only a bare database object rather than
             // a section_info object - we will need at least the uservisible
             // field in it.
             $thissection->uservisible = true;
             $thissection->availableinfo = null;
             $thissection->showavailability = 0;
         }
         // Show the section if the user is permitted to access it, OR if it's not available
         // but showavailability is turned on
         $showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && $thissection->showavailability;
         if (!$showsection) {
             // Hidden section message is overridden by 'unavailable' control
             // (showavailability option).
             if (!$course->hiddensections && $thissection->available) {
                 echo $this->section_hidden($section);
             }
             unset($sections[$section]);
             continue;
         }
         if (!$PAGE->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
             // Display section summary only.
             echo $this->section_summary($thissection, $course);
         } else {
             echo $this->section_header($thissection, $course, false);
             if ($thissection->uservisible) {
                 print_section($course, $thissection, $mods, $modnamesused);
                 if ($PAGE->user_is_editing()) {
                     print_section_add_menus($course, $section, $modnames);
                 }
             }
             echo $this->section_footer();
         }
         unset($sections[$section]);
     }
     if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
         // Print stealth sections if present.
         $modinfo = get_fast_modinfo($course);
         foreach ($sections as $section => $thissection) {
             if (empty($modinfo->sections[$section])) {
                 continue;
             }
             echo $this->stealth_section_header($section);
             print_section($course, $thissection, $mods, $modnamesused);
             echo $this->stealth_section_footer();
         }
         echo $this->end_section_list();
         echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
         // Increase number of sections.
         $straddsection = get_string('increasesections', 'moodle');
         $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
         $icon = $this->output->pix_icon('t/switch_plus', $straddsection);
         echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
         if ($course->numsections > 0) {
             // Reduce number of sections sections.
             $strremovesection = get_string('reducesections', 'moodle');
             $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
             $icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
             echo html_writer::link($url, $icon . get_accesshide($strremovesection), array('class' => 'reduce-sections'));
         }
         echo html_writer::end_tag('div');
     } else {
         echo $this->end_section_list();
     }
 }
 public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection)
 {
     global $PAGE;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     // Can we view the section in question?
     if (!($sectioninfo = $modinfo->get_section_info($displaysection))) {
         // This section doesn't exist
         print_error('unknowncoursesection', 'error', null, $course->fullname);
         return;
     }
     if (!$sectioninfo->uservisible) {
         if (!$course->hiddensections) {
             echo $this->start_section_list();
             echo $this->section_hidden($displaysection);
             echo $this->end_section_list();
         }
         // Can't view this section.
         return;
     }
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, $displaysection);
     $thissection = $modinfo->get_section_info(0);
     if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
         echo $this->start_section_list();
         echo $this->section_header($thissection, $course, true, $displaysection);
         echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
         echo $this->courserenderer->course_section_add_cm_control($course, 0, $displaysection);
         echo $this->section_footer();
         echo $this->end_section_list();
     }
     // Start single-section div
     echo html_writer::start_tag('div', array('class' => 'single-section'));
     // The requested section page.
     $thissection = $modinfo->get_section_info($displaysection);
     // Title with section navigation links.
     $sectionnavlinks = $this->get_nav_links($course, $modinfo->get_section_info_all(), $displaysection);
     $sectiontitle = '';
     $sectiontitle .= html_writer::start_tag('div', array('class' => 'section-navigation header headingblock'));
     // Title attributes
     $titleattr = 'title';
     if (!$thissection->visible) {
         $titleattr .= ' dimmed_text';
     }
     $sectiontitle .= html_writer::tag('div', get_section_name($course, $displaysection), array('class' => $titleattr));
     $sectiontitle .= html_writer::end_tag('div');
     echo $sectiontitle;
     // Now the list of sections..
     echo $this->start_section_list();
     echo $this->section_header($thissection, $course, true, $displaysection);
     // Show completion help icon.
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
     echo $this->courserenderer->course_section_add_cm_control($course, $displaysection, $displaysection);
     echo $this->section_footer();
     echo $this->end_section_list();
     // Display section bottom navigation.
     $sectionbottomnav = '';
     $sectionbottomnav .= html_writer::start_tag('nav', array('id' => 'section_footer', 'class' => 'clearfix'));
     $sectionbottomnav .= $sectionnavlinks['previous'];
     $sectionbottomnav .= $sectionnavlinks['next'];
     // $sectionbottomnav .= html_writer::tag('div', $this->section_nav_selection($course, $sections, $displaysection), array('class' => 'mdl-align'));
     $sectionbottomnav .= html_writer::end_tag('nav');
     echo $sectionbottomnav;
     // Close single-section div.
     echo html_writer::end_tag('div');
 }
Esempio n. 11
0
 /**
  * Output the html for a single section page .
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections The course_sections entries from the DB
  * @param array $mods used for print_section()
  * @param array $modnames used for print_section()
  * @param array $modnamesused used for print_section()
  * @param int $displaysection The section number in the course which is being displayed
  */
 public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection)
 {
     global $PAGE, $OUTPUT;
     $real_course_display = $course->realcoursedisplay;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     $course->realcoursedisplay = $real_course_display;
     $sections = $modinfo->get_section_info_all();
     // Can we view the section in question?
     $context = context_course::instance($course->id);
     $canviewhidden = has_capability('moodle/course:viewhiddensections', $context);
     if (!isset($sections[$displaysection])) {
         // This section doesn't exist
         print_error('unknowncoursesection', 'error', null, $course->fullname);
         return;
     }
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, $displaysection);
     // General section if non-empty and course_display is multiple.
     if ($course->realcoursedisplay == COURSE_DISPLAY_MULTIPAGE) {
         $thissection = $sections[0];
         if (($thissection->visible && $thissection->available || $canviewhidden) && ($thissection->summary || $thissection->sequence || $PAGE->user_is_editing())) {
             echo $this->start_section_list();
             echo $this->section_header($thissection, $course, true);
             echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
             echo $this->courserenderer->course_section_add_cm_control($course, 0, $displaysection);
             echo $this->section_footer();
             echo $this->end_section_list();
         }
     }
     // Start single-section div
     echo html_writer::start_tag('div', array('class' => 'single-section onetopic'));
     //Move controls
     $can_move = false;
     if ($PAGE->user_is_editing() && has_capability('moodle/course:movesections', $context) && $displaysection > 0) {
         $can_move = true;
     }
     $move_list_html = '';
     $count_move_sections = 0;
     //Init custom tabs
     $section = 0;
     $sectionmenu = array();
     $tabs = array();
     $inactive_tabs = array();
     $default_topic = -1;
     while ($section <= $course->numsections) {
         if ($course->realcoursedisplay == COURSE_DISPLAY_MULTIPAGE && $section == 0) {
             $section++;
             continue;
         }
         $thissection = $sections[$section];
         $showsection = true;
         if (!$thissection->visible || !$thissection->available) {
             $showsection = false;
         } else {
             if ($section == 0 && !($thissection->summary || $thissection->sequence || $PAGE->user_is_editing())) {
                 $showsection = false;
             }
         }
         if (!$showsection) {
             $showsection = $canviewhidden || !$course->hiddensections;
         }
         if (isset($displaysection)) {
             if ($showsection) {
                 if ($default_topic < 0) {
                     $default_topic = $section;
                     if ($displaysection == 0) {
                         $displaysection = $default_topic;
                     }
                 }
                 $format_options = course_get_format($course)->get_format_options($thissection);
                 $sectionname = get_section_name($course, $thissection);
                 if ($displaysection != $section) {
                     $sectionmenu[$section] = $sectionname;
                 }
                 $custom_styles = '';
                 $level = 0;
                 if (is_array($format_options)) {
                     if (!empty($format_options['fontcolor'])) {
                         $custom_styles .= 'color: ' . $format_options['fontcolor'] . ';';
                     }
                     if (!empty($format_options['bgcolor'])) {
                         $custom_styles .= 'background-color: ' . $format_options['bgcolor'] . ';';
                     }
                     if (!empty($format_options['cssstyles'])) {
                         $custom_styles .= $format_options['cssstyles'] . ';';
                     }
                     if (isset($format_options['level'])) {
                         $level = $format_options['level'];
                     }
                 }
                 if ($section == 0) {
                     $url = new moodle_url('/course/view.php', array('id' => $course->id, 'section' => 0));
                 } else {
                     $url = course_get_url($course, $section);
                 }
                 $special_style = 'tab_position_' . $section . ' tab_level_' . $level;
                 if ($course->marker == $section) {
                     $special_style = ' marker ';
                 }
                 if (!$thissection->visible || !$thissection->available) {
                     $special_style .= ' dimmed ';
                     if (!$canviewhidden) {
                         $inactive_tabs[] = "tab_topic_" . $section;
                     }
                 }
                 $new_tab = new tabobject("tab_topic_" . $section, $url, '<div style="' . $custom_styles . '" class="tab_content ' . $special_style . '">' . s($sectionname) . "</div>", s($sectionname));
                 if (is_array($format_options) && isset($format_options['level'])) {
                     if ($format_options['level'] == 0 || count($tabs) == 0) {
                         $tabs[] = $new_tab;
                         $new_tab->level = 1;
                     } else {
                         $parent_index = count($tabs) - 1;
                         if (!is_array($tabs[$parent_index]->subtree)) {
                             $tabs[$parent_index]->subtree = array();
                         } else {
                             if (count($tabs[$parent_index]->subtree) == 0) {
                                 $tabs[$parent_index]->subtree[0] = clone $tabs[$parent_index];
                                 $tabs[$parent_index]->subtree[0]->id .= '_index';
                                 $parent_section = $sections[$section - 1];
                                 $parentformat_options = course_get_format($course)->get_format_options($parent_section);
                                 if ($parentformat_options['firsttabtext']) {
                                     $firsttab_text = $parentformat_options['firsttabtext'];
                                 } else {
                                     $firsttab_text = get_string('index', 'format_onetopic');
                                 }
                                 $tabs[$parent_index]->subtree[0]->text = '<div class="tab_content tab_initial">' . $firsttab_text . "</div>";
                                 $tabs[$parent_index]->subtree[0]->level = 2;
                                 if ($displaysection == $section - 1) {
                                     $tabs[$parent_index]->subtree[0]->selected = true;
                                 }
                             }
                         }
                         $new_tab->level = 2;
                         $tabs[$parent_index]->subtree[] = $new_tab;
                     }
                 } else {
                     $tabs[] = $new_tab;
                 }
                 //Init move section list***************************************************************************
                 if ($can_move) {
                     if ($section > 0) {
                         // Move section
                         $baseurl = course_get_url($course, $displaysection);
                         $baseurl->param('sesskey', sesskey());
                         $url = clone $baseurl;
                         $url->param('move', $section - $displaysection);
                         //ToDo: For new feature: subtabs. It is not implemented yet
                         /*
                         $strsubtopictoright = get_string('subtopictoright', 'format_onetopic');
                         $url = new moodle_url('/course/view.php', array('id' => $course->id, 'subtopicmove' => 'right', 'subtopic' => $section));
                         $icon = $this->output->pix_icon('t/right', $strsubtopictoright);
                         $subtopic_move = html_writer::link($url, $icon.get_accesshide($strsubtopictoright), array('class' => 'subtopic-increase-sections'));
                         
                         
                         if ($displaysection != $section) {
                             $move_list_html .= html_writer::tag('li', $subtopic_move . html_writer::link($url, $sectionname));
                            }
                         else {
                             $move_list_html .= html_writer::tag('li', $subtopic_move . $sectionname);
                         }
                         */
                         //Define class from sublevels in order to move a margen in the left. Not apply if it is the first element (condition !empty($move_list_html)) because the first element can't be a sublevel
                         $li_class = '';
                         if (is_array($format_options) && isset($format_options['level']) && $format_options['level'] > 0 && !empty($move_list_html)) {
                             $li_class = 'sublevel';
                         }
                         if ($displaysection != $section) {
                             $move_list_html .= html_writer::tag('li', html_writer::link($url, $sectionname), array('class' => $li_class));
                         } else {
                             $move_list_html .= html_writer::tag('li', $sectionname, array('class' => $li_class));
                         }
                     }
                 }
                 //End move section list***************************************************************************
             }
         }
         $section++;
     }
     // Title with section navigation links.
     $sectionnavlinks = $this->get_nav_links($course, $sections, $displaysection);
     $sectiontitle = '';
     if (!$course->hidetabsbar && count($tabs[0]) > 0) {
         if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) {
             // Increase number of sections.
             $straddsection = get_string('increasesections', 'moodle');
             $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
             $icon = $this->output->pix_icon('t/switch_plus', $straddsection);
             $tabs[] = new tabobject("tab_topic_add", $url, $icon, s($straddsection));
             if ($course->numsections > 0) {
                 // Reduce number of sections.
                 $strremovesection = get_string('reducesections', 'moodle');
                 $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
                 $icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
                 $tabs[] = new tabobject("tab_topic_remove", $url, $icon, s($strremovesection));
             }
         }
         $sectiontitle .= $OUTPUT->tabtree($tabs, "tab_topic_" . $displaysection, $inactive_tabs);
         //print_tabs($tabs, "tab_topic_" . $displaysection, $inactive_tabs, $active_tabs, true);
     }
     echo $sectiontitle;
     if (!$sections[$displaysection]->uservisible && !$canviewhidden) {
         if (!$course->hiddensections) {
             //Not used more, is controled in /course/view.php
         }
         // Can't view this section.
     } else {
         if ($course->realcoursedisplay != COURSE_DISPLAY_MULTIPAGE || $displaysection !== 0) {
             // Now the list of sections..
             echo $this->start_section_list();
             // The requested section page.
             $thissection = $sections[$displaysection];
             echo $this->section_header($thissection, $course, true);
             // Show completion help icon.
             $completioninfo = new completion_info($course);
             echo $completioninfo->display_help_icon();
             echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
             echo $this->courserenderer->course_section_add_cm_control($course, $displaysection, $displaysection);
             echo $this->section_footer();
             echo $this->end_section_list();
         }
     }
     // Display section bottom navigation.
     $sectionbottomnav = '';
     $sectionbottomnav .= html_writer::start_tag('div', array('class' => 'section-navigation mdl-bottom'));
     $sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left'));
     $sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right'));
     $sectionbottomnav .= html_writer::end_tag('div');
     echo $sectionbottomnav;
     // close single-section div.
     echo html_writer::end_tag('div');
     if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) {
         echo '<br class="utilities-separator" />';
         print_collapsible_region_start('move-list-box clearfix collapsible mform', 'course_format_onetopic_config_movesection', get_string('utilities', 'format_onetopic'), '', true);
         //Move controls
         if ($can_move && !empty($move_list_html)) {
             echo html_writer::start_div("form-item clearfix");
             echo html_writer::start_div("form-label");
             echo html_writer::tag('label', get_string('movesectionto', 'format_onetopic'));
             echo html_writer::end_div();
             echo html_writer::start_div("form-setting");
             echo html_writer::tag('ul', $move_list_html, array('class' => 'move-list'));
             echo html_writer::end_div();
             echo html_writer::start_div("form-description");
             echo html_writer::tag('p', get_string('movesectionto_help', 'format_onetopic'));
             echo html_writer::end_div();
             echo html_writer::end_div();
         }
         $baseurl = course_get_url($course, $displaysection);
         $baseurl->param('sesskey', sesskey());
         $url = clone $baseurl;
         global $USER, $OUTPUT;
         if (isset($USER->onetopic_da[$course->id]) && $USER->onetopic_da[$course->id]) {
             $url->param('onetopic_da', 0);
             $text_button_disableajax = get_string('enable', 'format_onetopic');
         } else {
             $url->param('onetopic_da', 1);
             $text_button_disableajax = get_string('disable', 'format_onetopic');
         }
         echo html_writer::start_div("form-item clearfix");
         echo html_writer::start_div("form-label");
         echo html_writer::tag('label', get_string('disableajax', 'format_onetopic'));
         echo html_writer::end_div();
         echo html_writer::start_div("form-setting");
         echo html_writer::link($url, $text_button_disableajax);
         echo html_writer::end_div();
         echo html_writer::start_div("form-description");
         echo html_writer::tag('p', get_string('disableajax_help', 'format_onetopic'));
         echo html_writer::end_div();
         echo html_writer::end_div();
         //Duplicate current section option
         if (has_capability('moodle/course:manageactivities', $context)) {
             $url_duplicate = new moodle_url('/course/format/onetopic/duplicate.php', array('courseid' => $course->id, 'section' => $displaysection, 'sesskey' => sesskey()));
             $link = new action_link($url_duplicate, get_string('duplicate', 'format_onetopic'));
             $link->add_action(new confirm_action(get_string('duplicate_confirm', 'format_onetopic'), null, get_string('duplicate', 'format_onetopic')));
             echo html_writer::start_div("form-item clearfix");
             echo html_writer::start_div("form-label");
             echo html_writer::tag('label', get_string('duplicatesection', 'format_onetopic'));
             echo html_writer::end_div();
             echo html_writer::start_div("form-setting");
             echo $this->render($link);
             echo html_writer::end_div();
             echo html_writer::start_div("form-description");
             echo html_writer::tag('p', get_string('duplicatesection_help', 'format_onetopic'));
             echo html_writer::end_div();
             echo html_writer::end_div();
         }
         print_collapsible_region_end();
     }
 }
Esempio n. 12
0
 /**
  * Output the html for a single section page .
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections The course_sections entries from the DB
  * @param array $mods used for print_section()
  * @param array $modnames used for print_section()
  * @param array $modnamesused used for print_section()
  * @param int $displaysection The section number in the course which is being displayed
  */
 public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection)
 {
     global $PAGE;
     $real_course_display = $course->realcoursedisplay;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     $course->realcoursedisplay = $real_course_display;
     $sections = $modinfo->get_section_info_all();
     // Can we view the section in question?
     $context = context_course::instance($course->id);
     $canviewhidden = has_capability('moodle/course:viewhiddensections', $context);
     if (!isset($sections[$displaysection])) {
         // This section doesn't exist
         print_error('unknowncoursesection', 'error', null, $course->fullname);
         return;
     }
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, $displaysection);
     // General section if non-empty and course_display is multiple.
     if ($course->realcoursedisplay == COURSE_DISPLAY_MULTIPAGE) {
         $thissection = $sections[0];
         if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
             echo $this->start_section_list();
             echo $this->section_header($thissection, $course, true);
             //print_section($course, $thissection, $mods, $modnamesused, true, '100%', false, $displaysection);
             $displayoptions = array('hidecompletion' => false);
             $courserenderer = $PAGE->get_renderer('core', 'course');
             echo $courserenderer->course_section_cm_list($course, $thissection, null, $displayoptions);
             if ($PAGE->user_is_editing()) {
                 //print_section_add_menus($course, 0, $modnames, false, false, $displaysection);
                 $courserenderer = $PAGE->get_renderer('core', 'course');
                 echo $courserenderer->course_section_add_cm_control($course, 0, $displaysection, array('inblock' => false));
             }
             echo $this->section_footer();
             echo $this->end_section_list();
         }
     }
     // Start single-section div
     echo html_writer::start_tag('div', array('class' => 'single-section'));
     //Init custom tabs
     $section = 0;
     $sectionmenu = array();
     $tabs = array();
     $default_topic = -1;
     while ($section <= $course->numsections) {
         if ($course->realcoursedisplay == COURSE_DISPLAY_MULTIPAGE && $section == 0) {
             $section++;
             continue;
         }
         $thissection = $sections[$section];
         $showsection = true;
         if (!$thissection->visible) {
             $showsection = false;
         } else {
             if ($section == 0 && !($thissection->summary or $thissection->sequence or $PAGE->user_is_editing())) {
                 $showsection = false;
             }
         }
         if (!$showsection) {
             $showsection = (has_capability('moodle/course:viewhiddensections', $context) or !$course->hiddensections);
         }
         if (isset($displaysection)) {
             if ($showsection) {
                 if ($default_topic < 0) {
                     $default_topic = $section;
                     if ($displaysection == 0) {
                         $displaysection = $default_topic;
                     }
                 }
                 $sectionname = get_section_name($course, $thissection);
                 $sectionname = htmlspecialchars_decode($sectionname);
                 // CTL addition to remove ampersand from title &amp;
                 if ($displaysection != $section) {
                     $sectionmenu[$section] = $sectionname;
                 }
                 if ($section == 0) {
                     $url = new moodle_url('/course/view.php', array('id' => $course->id, 'section' => 0));
                 } else {
                     $url = course_get_url($course, $section);
                 }
                 $tabs[] = new tabobject("tab_topic_" . $section, $url, '<font style="white-space:nowrap">' . s($sectionname) . "</font>", s($sectionname));
             }
         }
         $section++;
     }
     // Title with section navigation links.
     $sectionnavlinks = $this->get_nav_links($course, $sections, $displaysection);
     $sectiontitle = '';
     if (!$course->hidetabsbar && count($tabs) > 0) {
         $sectiontitle .= print_tabs(array($tabs), "tab_topic_" . $displaysection, NULL, NULL, true);
     }
     echo $sectiontitle;
     if (!$sections[$displaysection]->visible && !$canviewhidden) {
         if (!$course->hiddensections) {
             echo $this->start_section_list();
             echo $this->section_hidden($displaysection);
             echo $this->end_section_list();
         }
         // Can't view this section.
     } else {
         // Now the list of sections..
         echo $this->start_section_list();
         // The requested section page.
         $thissection = $sections[$displaysection];
         echo $this->section_header($thissection, $course, true);
         // Show completion help icon.
         $completioninfo = new completion_info($course);
         echo $completioninfo->display_help_icon();
         //print_section($course, $thissection, $mods, $modnamesused, true, '100%', false, $displaysection);
         $displayoptions = array('hidecompletion' => false);
         $courserenderer = $PAGE->get_renderer('core', 'course');
         echo $courserenderer->course_section_cm_list($course, $thissection, null, $displayoptions);
         if ($PAGE->user_is_editing()) {
             //print_section_add_menus($course, $displaysection, $modnames, false, false, $displaysection);
             $courserenderer = $PAGE->get_renderer('core', 'course');
             echo $courserenderer->course_section_add_cm_control($course, $displaysection, $displaysection, array('inblock' => false));
         }
         echo $this->section_footer();
         echo $this->end_section_list();
     }
     // Display section bottom navigation.
     $sectionbottomnav = '';
     $sectionbottomnav .= html_writer::start_tag('div', array('class' => 'section-navigation mdl-bottom'));
     $sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left'));
     $sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right'));
     $sectionbottomnav .= html_writer::end_tag('div');
     echo $sectionbottomnav;
     // close single-section div.
     echo html_writer::end_tag('div');
 }
 /**
  * Print out the course page
  * 
  * @param object $course
  * @param completion_info $completioninfo
  */
 public function print_page($course, $completioninfo)
 {
     $this->commentsformshow = optional_param('commentsformshow', 0, PARAM_ALPHANUMEXT);
     $posts = \format_socialwall\local\posts::instance($course->id);
     $postdata = $posts->get_timeline_posts($course);
     $postform = $posts->get_post_form($postdata);
     $course = course_get_format($course)->get_course();
     // Title with completion help icon.
     echo $completioninfo->display_help_icon();
     echo $this->output->heading($this->page_title(), 2, 'accesshide');
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, 0);
     // Now the list of sections..
     echo $this->start_section_list();
     $modinfo = get_fast_modinfo($course);
     $sectioninfo = $modinfo->get_section_info_all();
     // ...Section 0.
     $this->print_first_section($course, $sectioninfo);
     // ...Section 2.
     $postid = $postdata->filteroptions->postid;
     $this->print_postform_section($course, $sectioninfo, $postform, $postid);
     // ...Section 1.
     $this->print_timeline_section($course, $postdata, $completioninfo);
     echo $this->end_section_list();
     $args = array('courseid' => $course->id, 'poststotal' => $postdata->poststotal, 'postsloaded' => $postdata->postsloaded, 'userallowedediting' => $this->page->user_allowed_editing());
     $this->page->requires->strings_for_js(array('counttotalpost', 'like', 'likenomore', 'countlikes', 'countcomments', 'textrequired', 'confirmdeletecomment'), 'format_socialwall');
     $this->page->requires->yui_module('moodle-format_socialwall-postform', 'M.format_socialwall.postforminit', array($args), null, true);
 }
Esempio n. 14
0
 /**
  * Output the html for a multiple section page
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections (argument not used)
  * @param array $mods (argument not used)
  * @param array $modnames (argument not used)
  * @param array $modnamesused (argument not used)
  */
 public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)
 {
     global $PAGE;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     $context = context_course::instance($course->id);
     // Title with completion help icon.
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->output->heading($this->page_title(), 2, 'accesshide');
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, 0);
     // Now the list of sections..
     echo $this->start_section_list();
     foreach ($modinfo->get_section_info_all() as $section => $thissection) {
         if ($section == 0) {
             // 0-section is displayed a little different then the others.
             if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
                 echo $this->section_header($thissection, $course, false, 0);
                 echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
                 echo $this->courserenderer->course_section_add_cm_control($course, 0, 0);
                 echo $this->section_footer();
             }
             continue;
         }
         if ($section > $course->numsections) {
             // Activities inside this section are 'orphaned', this section will be printed as 'stealth' below.
             continue;
         }
         // Do not display sections in the past/future that must be hidden by course settings.
         $displaymode = course_get_format($course)->get_section_display_mode($thissection);
         if (!has_capability('moodle/course:viewhiddenactivities', $context)) {
             if ($displaymode == FORMAT_PERIODS_NOTAVAILABLE) {
                 echo $this->section_hidden($section, $course->id);
                 continue;
             }
             if ($displaymode == FORMAT_PERIODS_NOTDISPLAYED || $displaymode == FORMAT_PERIODS_HIDDEN) {
                 continue;
             }
         }
         // Show the section if the user is permitted to access it, OR if it's not available
         // but there is some available info text which explains the reason & should display.
         $showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && !empty($thissection->availableinfo);
         if (!$showsection) {
             // If the hiddensections option is set to 'show hidden sections in collapsed
             // form', then display the hidden section message - UNLESS the section is
             // hidden by the availability system, which is set to hide the reason.
             if (!$course->hiddensections && $thissection->available) {
                 echo $this->section_hidden($section, $course->id);
             }
             continue;
         }
         if (!$PAGE->user_is_editing() && $displaymode == FORMAT_PERIODS_COLLAPSED) {
             // Display section summary only.
             echo $this->section_summary($thissection, $course, null);
         } else {
             echo $this->section_header($thissection, $course, false, 0);
             if ($thissection->uservisible) {
                 echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
                 echo $this->courserenderer->course_section_add_cm_control($course, $section, 0);
             }
             echo $this->section_footer();
         }
     }
     if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
         // Print stealth sections if present.
         foreach ($modinfo->get_section_info_all() as $section => $thissection) {
             if ($section <= $course->numsections or empty($modinfo->sections[$section])) {
                 // This is not stealth section or it is empty.
                 continue;
             }
             echo $this->stealth_section_header($section);
             echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
             echo $this->stealth_section_footer();
         }
         echo $this->end_section_list();
         echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
         // Increase number of sections.
         $straddsection = get_string('increasesections', 'moodle');
         $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
         $icon = $this->output->pix_icon('t/switch_plus', $straddsection);
         echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
         if ($course->numsections > 0) {
             // Reduce number of sections sections.
             $strremovesection = get_string('reducesections', 'moodle');
             $url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
             $icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
             echo html_writer::link($url, $icon . get_accesshide($strremovesection), array('class' => 'reduce-sections'));
         }
         echo html_writer::end_tag('div');
     } else {
         echo $this->end_section_list();
     }
 }
Esempio n. 15
0
 public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection)
 {
     global $PAGE;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     if (!($sectioninfo = $modinfo->get_section_info($displaysection))) {
         print_error('unknowncoursesection', 'error', null, $course->fullname);
         return;
     }
     if (!$sectioninfo->uservisible) {
         if (!$course->hiddensections) {
             echo $this->start_section_list();
             echo $this->section_hidden($displaysection);
             echo $this->end_section_list();
         }
         return;
     }
     echo $this->course_activity_clipboard($course, $displaysection);
     $thissection = $modinfo->get_section_info(0);
     if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
         echo $this->start_section_list();
         echo $this->section_header($thissection, $course, true, $displaysection);
         echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
         echo $this->courserenderer->course_section_add_cm_control($course, 0, $displaysection);
         echo $this->section_footer();
         echo $this->end_section_list();
     }
     echo html_writer::start_tag('div', array('class' => 'single-section'));
     $thissection = $modinfo->get_section_info($displaysection);
     $sectionnavlinks = $this->get_nav_links($course, $modinfo->get_section_info_all(), $displaysection);
     $sectiontitle = '';
     $sectiontitle .= html_writer::start_tag('div', array('class' => 'section-navigation header headingblock'));
     $titleattr = 'mdl-align title';
     if (!$thissection->visible) {
         $titleattr .= ' dimmed_text';
     }
     $sectiontitle .= html_writer::tag('div', get_section_name($course, $displaysection), array('class' => $titleattr));
     $sectiontitle .= html_writer::end_tag('div');
     echo $sectiontitle;
     echo $this->start_section_list();
     echo $this->section_header($thissection, $course, true, $displaysection);
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
     echo $this->courserenderer->course_section_add_cm_control($course, $displaysection, $displaysection);
     echo $this->section_footer();
     echo $this->end_section_list();
     $sectionbottomnav = '';
     $sectionbottomnav .= html_writer::start_tag('nav', array('id' => 'section_footer'));
     $sectionbottomnav .= $sectionnavlinks['previous'];
     $sectionbottomnav .= $sectionnavlinks['next'];
     $sectionbottomnav .= html_writer::empty_tag('br', array('style' => 'clear:both'));
     $sectionbottomnav .= html_writer::end_tag('nav');
     echo $sectionbottomnav;
     echo html_writer::end_tag('div');
 }