Esempio n. 1
0
 public function set_section_visibility($shortname, $sectionnumber, $visible)
 {
     global $OUTPUT;
     $course = $this->coursebyshortname($shortname);
     $context = \context_course::instance($course->id);
     require_capability('moodle/course:sectionvisibility', $context);
     // Note, we do not use the return value of set_section_visible (resourcestotoggle) as nested resource visibility
     // is handled via CSS.
     set_section_visible($course->id, $sectionnumber, $visible);
     $modinfo = get_fast_modinfo($course);
     $section = $modinfo->get_section_info($sectionnumber);
     $actionmodel = new \theme_snap\renderables\course_action_section_visibility($course, $section);
     $toc = new \theme_snap\renderables\course_toc($course);
     return ['actionmodel' => $actionmodel->export_for_template($OUTPUT), 'toc' => $toc->export_for_template($OUTPUT)];
 }
Esempio n. 2
0
 /**
  * @param string $shortname
  * @return object
  */
 public function course_toc_chapters($shortname)
 {
     $course = $this->coursebyshortname($shortname);
     $toc = new course_toc($course);
     return $toc->convert_object_for_export($toc->chapters);
 }