{{!
    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 format_tiles/multi_section_page

    Multi section page template.

    The purpose of this template is to render the course landing page
    i.e. all of the tiles representing all of the sections in the course

    Either this or single_section_page will be the first template called
    when the user launches a page from PHP

    Classes required for JS:
    * none

    Data attributes required for JS:
    * none

    Context variables required for this template:
        * from_ajax - is this called from AJAX?
        * completionenabled - is completion enabled?
        * section_zero - info for section_zero template,
        * tiles - info for multi_section_tile and multi_section_tilebar templates
        * all_tiles_expanded - are we expanding all tiles?
        * activity_clipboard - moodle activity clipboard (not tiles),
        * course_activity_clipboard: moodle course activity clipboard (not tiles)

    Example context (json):
    {
        "from_ajax": 1,
        "completionenabled": 1,
        "section_zero": [],
        "tiles": [],
        "all_tiles_expanded": 0,
        "activity_clipboard": "",
        "course_activity_clipboard": ""
    }
}}
{{#showinitialpageloadingicon}}
    <a id="page-loading-icon" href="{{config.wwwroot}}/course/view.php?id={{courseid}}&skipcheck=1">
    <div class="text-center mt-5">
        {{> format_tiles/loading}}
        <div class="text-center" style="text-decoration: none;"><small>{{#str}}clickiffailstoload, format_tiles{{/str}}</small></div>
    </div>
    </a>
{{/showinitialpageloadingicon}}
<div id="format-tiles-multi-section-page" class="m-auto {{outerextraclasses}}">
    {{#jsnavuserenabled}}
        <noscript>
            {{^jsSessionDisabled}}
                <div id="jswarning" class="alert alert-secondary">{{#str}}nojswarning, format_tiles{{/str}}
                    {{#showJScancelLink}}
                        <a href="{{{config.wwwroot}}}/course/view.php?id={{courseid}}&format-tiles-action=toggleanimatednav&sesskey={{config.sesskey}}">{{#str}}refresh{{/str}}</a>
                    {{/showJScancelLink}}
                    <button type="button" class="btn-close" data-dismiss="alert">
                        <span aria-hidden="true">&times;</span>
                        <span class="sr-only">{{#str}}dismissnotification, core{{/str}}</span>
                    </button>
                </div>
            {{/jsSessionDisabled}}
        </noscript>
    {{/jsnavuserenabled}}

    {{^from_ajax}}
        {{> format_tiles/above_tiles}}
    {{/from_ajax}}

    <ul class="tiles" id="multi_section_tiles">
        {{#tiles}}
            {{^editing}}
                {{> format_tiles/multi_section_tile}}
            {{/editing}}
            {{#editing}}
                {{> format_tiles/multi_section_tilebar}}
            {{/editing}}
        {{/tiles}}

        {{^editing}}
        {{!empty tiles at end to ensure correct flex spacing of last row}}
            <li class="tile spacer" aria-hidden="true"></li>
            <li class="tile spacer" aria-hidden="true"></li>
            <li class="tile spacer" aria-hidden="true"></li>
            <li class="tile spacer" aria-hidden="true"></li>
            <li class="tile spacer" aria-hidden="true"></li>
            <li class="tile spacer" aria-hidden="true"></li>
            <li class="tile spacer" aria-hidden="true" id="lasttile"></li>

            {{!moveable sections for JS to add content to and move around (one relating to each tile)}}
            {{#tiles}}
                <li class="section course-section main moveablesection" style="display: none;" id="section-{{tileid}}"
                    data-section="{{tileid}}" data-sectionid="{{secid}}"></li>
            {{/tiles}}
        {{/editing}}
    </ul>

    {{#editing}}
        {{^from_ajax}}
            {{activity_clipboard}}
        {{/from_ajax}}
        {{{course_activity_clipboard}}}
    {{/editing}}
    <div id="format_tiles_overlay" style="position: fixed; top: 0; left: 0; background-color:rgba(0,0,0,0.5); width: 100vw; height: 100vh; display: none;"></div>
</div>

