{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template core_courseformat/local/content/section/header

    Displays a course section header.

    Example context (json):
    {
        "id": 123,
        "name": "Section title",
        "title": "<a href=\"http://moodle/course/view.php?id=5#section-0\">Section title</a>",
        "url": "#",
        "headerdisplaymultipage": true,
        "editing": 0
    }
}}
{{^ismoodle41minus}}
    {{#sectionbulk}}
        {{$ core_courseformat/local/content/section/bulkselect }}
            {{> core_courseformat/local/content/section/bulkselect }}
        {{/ core_courseformat/local/content/section/bulkselect }}
    {{/sectionbulk}}
{{/ismoodle41minus}}
{{#sitehome}}
        <h2 id="sectionid-{{id}}-title" class="sectionname">
        {{{title}}}
    </h2>
{{/sitehome}}
{{^sitehome}}
    <div class="course-section-header d-flex" data-for="section_title" data-id="{{id}}" data-number="{{num}}">
        <div class="d-flex align-items-start position-relative">
            <a role="button"
                data-toggle="collapse"
                data-for="sectiontoggler"
           href="#coursecontentcollapse{{num}}"
           id="collapssesection{{num}}"
           aria-expanded="{{^contentcollapsed}}true{{/contentcollapsed}}{{#contentcollapsed}}false{{/contentcollapsed}}"
                class="btn btn-icon me-1 icons-collapse-expand justify-content-center
               {{^editing}} stretched-link {{/editing}}
               {{#contentcollapsed}} collapsed {{/contentcollapsed}}"
                aria-label="{{name}}">
        <span class="expanded-icon icon-no-margin p-2" title="{{#str}} collapse, core {{/str}}">
            {{#pix}} t/expandedchevron, core {{/pix}}
        </span>
            <span class="collapsed-icon icon-no-margin p-2" title="{{#str}} expand, core {{/str}}">
            <span class="dir-rtl-hide">{{#pix}} t/collapsedchevron, core {{/pix}}</span>
            <span class="dir-ltr-hide">{{#pix}} t/collapsedchevron_rtl, core {{/pix}}</span>
        </span>
        </a>
            <h3 class="sectionname course-content-item d-flex align-self-stretch align-items-center mb-0"
                id="sectionid-{{id}}-title" data-for="section_title" data-id="{{id}}" data-number="{{num}}">
                {{^issectionzero}}
                    {{>format_tiles/local/content/section-tiles-image}}
                {{/issectionzero}}
                <span>{{{title}}}</span>
        </h3>
    </div>
    <div data-region="sectionbadges" class="sectionbadges d-flex align-items-center">
        {{$ core_courseformat/local/content/section/badges }}
            {{> core_courseformat/local/content/section/badges }}
        {{/ core_courseformat/local/content/section/badges }}
        {{#restrictionlock}}<i class="icon fa fa-lock fa-fw " aria-hidden="true"></i>{{/restrictionlock}}
    </div>
        {{#collapsemenu}}
            <div class="flex-fill d-flex justify-content-end me-2 align-self-start mt-2">
                <a
                        id="collapsesections"
                        class="section-collapsemenu"
                        href="#"
                        aria-expanded="true"
                        role="button"
                        data-toggle="toggleall"
                >
                    <span class="collapseall text-nowrap">{{#str}}collapseall{{/str}}</span>
                    <span class="expandall text-nowrap">{{#str}}expandall{{/str}}</span>
                </a>
            </div>
        {{/collapsemenu}}
        {{#controlmenu}}
            {{$ core_courseformat/local/content/section/controlmenu }}
                {{> core_courseformat/local/content/section/controlmenu }}
            {{/ core_courseformat/local/content/section/controlmenu }}
        {{/controlmenu}}
</div>
{{/sitehome}}
