{{!
    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_onetopic/local/content

    Displays the complete course format.

    Example context (json):
    {
        "initialsection": {
            "num": 0,
            "id": 34,
            "cmlist": {
                "cms": [
                    {
                        "cmitem": {
                            "cmformat": {
                                "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Forum example</span></a>",
                                "hasname": "true"
                            },
                            "cmid": 3,
                            "id": 3,
                            "anchor": "module-3",
                            "module": "forum",
                            "extraclasses": "newmessages"
                        }
                    }
                ],
                "hascms": true
            },
            "iscurrent": true,
            "summary": {
                "summarytext": "Summary text!"
            }
        },
        "format": "onetopic",
        "title": "Course title example",
            "hasnavigation": true,
            "sectionnavigation": {
            "hasprevious": true,
            "previousurl": "#",
            "larrow": "&#x25C4;",
            "previousname": "Section 3",
            "hasnext": true,
            "rarrow": "&#x25BA;",
            "nexturl": "#",
            "nextname": "Section 5"
        },
        "sectionselector": {
            "hasprevious": true,
            "previousurl": "#",
            "larrow": "&#x25C4;",
            "previousname": "Section 3",
            "hasnext": true,
            "rarrow": "&#x25BA;",
            "nexturl": "#",
            "nextname": "Section 5",
            "selector": "<select><option>Section 4</option></select>"
        },
        "sectionreturn": 1,
        "singlesection": {
            "num": 1,
            "id": 35,
            "header": {
                "name": "Single Section Example",
                "url": "#"
            },
            "cmlist": {
                "cms": [
                    {
                        "cmitem": {
                            "cmformat": {
                                "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Assign example</span></a>",
                                "hasname": "true"
                            },
                            "cmid": 4,
                            "id": 4,
                            "anchor": "module-4",
                            "module": "assign",
                            "extraclasses": ""
                        }
                    }
                ],
                "hascms": true
            },
            "iscurrent": true,
            "summary": {
                "summarytext": "Summary text!"
            }
        },
        "csstabstyles": ""
    }
}}
<div id="{{uniqid}}-course-format">
    <h2 class="accesshide">{{{title}}}</h2>
    {{{completionhelp}}}

    {{#hasformatmsgs}}
        {{#formatmsgs}}
            {{>core/notification_info}}
        {{/formatmsgs}}
    {{/hasformatmsgs}}

    {{#initialsection}}
    <div class="single-section general-section">
        <ul class="{{format}}">
            {{$ format_onetopic/local/content/section }}
                {{> format_onetopic/local/content/section }}
            {{/ format_onetopic/local/content/section }}
        </ul>
    </div>
    {{/initialsection}}

    <div id="tabs-tree-start" class="{{tabsviewclass}} {{#hastopictabs}}hastopictabs{{/hastopictabs}} {{#hassecondrow}}hassecondrow{{/hassecondrow}}">
        {{#hastopictabs}}
            <div class="tabs-wrapper">
                {{>format_onetopic/courseformat/tabtree}}
            </div>

            <div class="onetopic-tab-body">

            {{#hassecondrow}}
                {{#secondrow}}
                    {{>format_onetopic/courseformat/tabtree}}
                {{/secondrow}}
            {{/hassecondrow}}

        {{/hastopictabs}}

        <div class="single-section {{sectionclasses}}">
            {{availability}}
            {{#sectionnavigation}}
                {{$ core_courseformat/local/content/sectionnavigation }}
                    {{> core_courseformat/local/content/sectionnavigation }}
                {{/ core_courseformat/local/content/sectionnavigation }}
            {{/sectionnavigation}}
            <ul class="{{format}}">
            {{#singlesection}}
                {{$ format_onetopic/local/content/section }}
                    {{> format_onetopic/local/content/section }}
                {{/ format_onetopic/local/content/section }}
            {{/singlesection}}
            </ul>
            {{#sectionselector}}
                {{$ core_courseformat/local/content/sectionselector }}
                    {{> core_courseformat/local/content/sectionselector }}
                {{/ core_courseformat/local/content/sectionselector }}
            {{/sectionselector}}
        </div>
        {{#hastopictabs}}
            {{! End of onetopic-tab-body box. }}
            </div>
        {{/hastopictabs}}
    </div>

    {{#numsections}}
        {{$ core_courseformat/local/content/addsection}}
            {{> core_courseformat/local/content/addsection}}
        {{/ core_courseformat/local/content/addsection}}
    {{/numsections}}
</div>
{{#csstabstyles}}
<style>
    {{{csstabstyles}}}
</style>
{{/csstabstyles}}

{{#js}}
require(['core_courseformat/local/content'], function(component) {
    component.init('{{uniqid}}-course-format', {}, {{sectionreturn}});
});
{{/js}}
