Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page

@param stdClass $section The course_section entry from DB
@param stdClass $course The course entry from DB
@return string HTML to output.
555681
public function section_title($section, $course) {
        $title = get_section_name($course, $section);
        $url = course_get_url($course, $section->section, array('navigation' => true));
        if ($url) {
            $title = html_writer::link($url, $title);
        }
        return $title;
    }
666484
public function section($section, $position = null)
    {
        if (is_string($section)) {
            $section = new FormSection($section);
        }

        return null !== $position ? $this->insert($section, $position) : $this->push($section);
    }
1119226
public function info($section = null) {
        return $this->returnCommand(['INFO'], null, $section ? [$section] : null, ResponseParser::PARSE_INFO);
    }
1103688
public function getSection()
    {
        if (null === $this->_section) {
            $this->setSection(new Section($this->getUid(), array('page' => $this)));
        }

        return $this->_section;
    }
1356318
public function print_header_and_tabs($cm, $course, $quiz, $reportmode = 'overview') {
        global $PAGE;
        $this->renderer = $PAGE->get_renderer('quiz_grading');
        parent::print_header_and_tabs($cm, $course, $quiz, $reportmode);
    }
241844
function ajax_section_move() {
        $featurefunction = 'callback_'.$this->format.'_ajax_section_move';
        if (function_exists($featurefunction) && ($course = $this->get_course())) {
            return $featurefunction($course);
        } else {
            return parent::ajax_section_move();
        }
    }
428337
public function yieldPushContent($section, $default = '')
    {
        if (! isset($this->pushes[$section]) && ! isset($this->prepends[$section])) {
            return $default;
        }

        $output = '';

        if (isset($this->prepends[$section])) {
            $output .= implode(array_reverse($this->prepends[$section]));
        }

        if (isset($this->pushes[$section])) {
            $output .= implode($this->pushes[$section]);
        }

        return $output;
    }
418769
protected function getSection($sections, $section, $inheritance = false) {
		if (isset($sections[$section])) {
			return $sections[$section];
		}
		
		if ($inheritance) {
			foreach (array_keys($sections) as $part) {
				$colon = strpos($part, ':');

				if ($colon === false) {
					continue;
				}

				$successor = trim(substr($part, 0, $colon));
				$parent    = trim(substr($part, $colon + 1));
				
				if (! isset($successor[0], $parent[0])) {
					throw new InvalidIniSection('Invalid definition of the section "' . $part . '"');
				}

				if ($successor !== $section) {
					continue;
				}

				return array_replace(
					$this->getSection($sections, $parent, true),
					$sections[$part]
				);
			}
		}
		
		throw new InvalidIniSection('Section "' . $section . '" wasn\'t found');
	}
1238285
protected function section_edit_control_items($course, $section, $onsectionpage = false) {
        global $PAGE;

        if (!$PAGE->user_is_editing()) {
            return array();
        }

        $coursecontext = context_course::instance($course->id);

        if ($onsectionpage) {
            $url = course_get_url($course, $section->section);
        } else {
            $url = course_get_url($course);
        }
        $url->param('sesskey', sesskey());

        $controls = array();
        if ($section->section && has_capability('moodle/course:setcurrentsection', $coursecontext)) {
            if ($course->marker == $section->section) {  // Show the "light globe" on/off.
                $url->param('marker', 0);
                $highlightoff = get_string('highlightoff');
                $controls['highlight'] = array('url' => $url, "icon" => 'i/marked',
                                               'name' => $highlightoff,
                                               'pixattr' => array('class' => ''),
                                               'attr' => array('class' => 'editing_highlight',
                                                   'data-action' => 'removemarker'));
            } else {
                $url->param('marker', $section->section);
                $highlight = get_string('highlight');
                $controls['highlight'] = array('url' => $url, "icon" => 'i/marker',
                                               'name' => $highlight,
                                               'pixattr' => array('class' => ''),
                                               'attr' => array('class' => 'editing_highlight',
                                                   'data-action' => 'setmarker'));
            }
        }

        $parentcontrols = parent::section_edit_control_items($course, $section, $onsectionpage);

        // If the edit key exists, we are going to insert our controls after it.
        if (array_key_exists("edit", $parentcontrols)) {
            $merged = array();
            // We can't use splice because we are using associative arrays.
            // Step through the array and merge the arrays.
            foreach ($parentcontrols as $key => $action) {
                $merged[$key] = $action;
                if ($key == "edit") {
                    // If we have come to the edit key, merge these controls here.
                    $merged = array_merge($merged, $controls);
                }
            }

            return $merged;
        } else {
            return array_merge($controls, $parentcontrols);
        }
    }
360402
public function setSection($section)
    {
        $this->section = $section;
        if($section) {
        	$section->getSectionConfig()->setPage($this);
        }

        return $this;
    }
538280
public function SectionTitle()
    {
        $title = $this->menu_title();
        if ($title) {
            return $title;
        }

        foreach ($this->MainMenu() as $menuItem) {
            if ($menuItem->LinkingMode != 'link') {
                return $menuItem->Title;
            }
        }
        return null;
    }
258535
public static function course_section_created(\core\event\course_section_created $event) {
        if (class_exists('format_weeks', false)) {
            // If class format_weeks was never loaded, this is definitely not a course in 'weeks' format.
            // Course may still be in another format but format_weeks::update_end_date() will check it.
            format_weeks::update_end_date($event->courseid);
        }
    }
686479
public function renderSectionBody(array $section, DataCollection $collection, array $sections = [], string $sectionName = '') : void
    {
        if ($this->isSilent()) {
            return;
        }

        $division          = $collection->getDefaultProperties();
        $ua                = $division->getUserAgents()[0];
        $defaultproperties = $ua->getProperties();
        $properties        = array_merge(['Parent'], array_keys($defaultproperties));

        foreach ($defaultproperties as $propertyName => $propertyValue) {
            if (is_bool($propertyValue)) {
                $defaultproperties[$propertyName] = $propertyValue;
            } else {
                $defaultproperties[$propertyName] = $this->trimProperty->trimProperty((string) $propertyValue);
            }
        }

        foreach ($properties as $property) {
            if (!isset($section[$property])) {
                continue;
            }

            if (!isset($this->outputProperties[$property])) {
                $this->outputProperties[$property] = $this->filter->isOutputProperty($property, $this);
            }

            if (!$this->outputProperties[$property]) {
                continue;
            }

            if (isset($section['Parent']) && 'Parent' !== $property) {
                if ('DefaultProperties' === $section['Parent']
                    || !isset($sections[$section['Parent']])
                ) {
                    if (isset($defaultproperties[$property])
                        && $defaultproperties[$property] === $section[$property]
                    ) {
                        continue;
                    }
                } else {
                    $parentProperties = $sections[$section['Parent']];

                    if (isset($parentProperties[$property])
                        && $parentProperties[$property] === $section[$property]
                    ) {
                        continue;
                    }
                }
            }

            fwrite(
                $this->file,
                $this->formatter->formatPropertyName($property)
                . '=' . $this->formatter->formatPropertyValue($section[$property], $property) . PHP_EOL
            );
        }
    }
1178408
public function course_info_box(stdClass $course) {
        $content = '';
        $content .= $this->output->box_start('generalbox info');
        $chelper = new coursecat_helper();
        $chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_EXPANDED);
        $content .= $this->coursecat_coursebox($chelper, $course);
        $content .= $this->output->box_end();
        return $content;
    }
1014586
protected function generate_sections_and_activities(stdClass $course) {
        global $CFG;
        require_once($CFG->dirroot.'/course/lib.php');

        $modinfo = get_fast_modinfo($course);
        $sections = $modinfo->get_section_info_all();

        // For course formats using 'numsections' trim the sections list
        $courseformatoptions = course_get_format($course)->get_format_options();
        if (isset($courseformatoptions['numsections'])) {
            $sections = array_slice($sections, 0, $courseformatoptions['numsections']+1, true);
        }

        $activities = array();

        foreach ($sections as $key => $section) {
            // Clone and unset summary to prevent $SESSION bloat (MDL-31802).
            $sections[$key] = clone($section);
            unset($sections[$key]->summary);
            $sections[$key]->hasactivites = false;
            if (!array_key_exists($section->section, $modinfo->sections)) {
                continue;
            }
            foreach ($modinfo->sections[$section->section] as $cmid) {
                $cm = $modinfo->cms[$cmid];
                $activity = new stdClass;
                $activity->id = $cm->id;
                $activity->course = $course->id;
                $activity->section = $section->section;
                $activity->name = $cm->name;
                $activity->icon = $cm->icon;
                $activity->iconcomponent = $cm->iconcomponent;
                $activity->hidden = (!$cm->visible);
                $activity->modname = $cm->modname;
                $activity->nodetype = navigation_node::NODETYPE_LEAF;
                $activity->onclick = $cm->onclick;
                $url = $cm->url;
                if (!$url) {
                    $activity->url = null;
                    $activity->display = false;
                } else {
                    $activity->url = $url->out();
                    $activity->display = $cm->is_visible_on_course_page() ? true : false;
                    if (self::module_extends_navigation($cm->modname)) {
                        $activity->nodetype = navigation_node::NODETYPE_BRANCH;
                    }
                }
                $activities[$cmid] = $activity;
                if ($activity->display) {
                    $sections[$key]->hasactivites = true;
                }
            }
        }

        return array($sections, $activities);
    }
292768
public function addSection(PHPRtfLite_Container_Section $section = null)
    {
        if ($section === null) {
            $section = new PHPRtfLite_Container_Section($this);
        }

        $this->_sections[] = $section;

        return $section;
    }
323572
private function msection()
	{
		if ($this->__engine == 'blade') {
			$pattern = '/\@section\((.*?)\)(.*?)\@endsection/s';
		}
		else {
			$pattern = '/\{\% section\((.*?)\) \%\}(.*?)\{\% endsection \%\}/s';
		}

		$this->__cached = preg_replace_callback($pattern, function($match) {
			$name = str_replace("'", "", $match[1]);
			$name = str_replace('"', '', $name);

			$code = $match[2];

			$section = array('name' => $name, 'code' => $code);
			array_push(static::$sections, $section);
		}, $this->__cached);

		$this->__cached = preg_replace_callback($this->usingDirective('yield', true, true), function($match) {
			$name = str_replace("'", "", $match[1]);
			$name = str_replace('"', '', $name);

			foreach (static::$sections as $value) {
				if ($value['name'] == $name) {
					return $value['code'];
				}
			}

			return '';
		}, $this->__cached);

		static::$sections = [];
	}