on-demand release 4.5dev+
[moodle.git] / course / format / templates / local / content / section / content.mustache
blobc8c77b14bad4d45ed3d663bf4c773f3f15fae84b
1 {{!
2     This file is part of Moodle - http://moodle.org/
4     Moodle is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
9     Moodle is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
14     You should have received a copy of the GNU General Public License
15     along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
17 {{!
18     @template core_courseformat/local/content/section/content
20     The internal content of a section.
22     Example context (json):
23     {
24         "num": 3,
25         "id": 35,
26         "controlmenu": "[tools menu]",
27         "header": {
28             "name": "Section title",
29             "title": "<a href=\"http://moodle/course/view.php?id=5#section-0\">Section title</a>",
30             "url": "#",
31             "ishidden": true,
32             "headinglevel": 3
33         },
34         "cmlist": {
35             "cms": [
36                 {
37                     "cmitem": {
38                         "cmformat": {
39                             "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Forum example</span></a>",
40                             "hasname": "true"
41                         },
42                         "id": 3,
43                         "cmid": 3,
44                         "module": "forum",
45                         "anchor": "activity-3",
46                         "extraclasses": "newmessages"
47                     }
48                 },
49                 {
50                     "cmitem": {
51                         "cmformat": {
52                             "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Assign example</span></a>",
53                             "hasname": "true"
54                         },
55                         "id": 4,
56                         "cmid": 4,
57                         "anchor": "activity-4",
58                         "module": "assign",
59                         "extraclasses": ""
60                     }
61                 }
62             ],
63             "hascms": true
64         },
65         "ishidden": false,
66         "iscurrent": true,
67         "currentlink": "<span class=\"accesshide\">This topic</span>",
68         "availability": {
69             "info": "<span class=\"badge bg-info\">Hidden from students</span>",
70             "hasavailability": true
71         },
72         "summary": {
73             "summarytext": "Summary text!"
74         },
75         "controlmenu": {
76             "menu": "<a href=\"#\" class=\"d-inline-block dropdown-toggle icon-no-margin\">Edit<b class=\"caret\"></b></a>",
77             "hasmenu": true
78         },
79         "cmcontrols": "[Add an activity or resource]",
80         "iscoursedisplaymultipage": true,
81         "sectionreturnnum": 0,
82         "contentcollapsed": false,
83         "insertafter": true,
84         "numsections": 42,
85         "sitehome": false,
86         "highlightedlabel" : "Highlighted"
87     }
89 <div class="course-section-header d-flex"
90      data-for="section_title"
91      data-id="{{id}}"
92      data-number="{{num}}"
94     {{#singleheader}}
95         {{$ core_courseformat/local/content/section/header }}
96             {{> core_courseformat/local/content/section/header }}
97         {{/ core_courseformat/local/content/section/header }}
98     {{/singleheader}}
99     {{#header}}
100         {{$ core_courseformat/local/content/section/header }}
101             {{> core_courseformat/local/content/section/header }}
102         {{/ core_courseformat/local/content/section/header }}
103     {{/header}}
104     {{^singleheader}}
105         {{#restrictionlock}}
106             <div class="align-self-center ms-2">
107                 {{#pix}}t/unlock, core{{/pix}}
108             </div>
109         {{/restrictionlock}}
110     {{/singleheader}}
111     <div data-region="sectionbadges" class="sectionbadges d-flex align-items-center">
112         {{$ core_courseformat/local/content/section/badges }}
113             {{> core_courseformat/local/content/section/badges }}
114         {{/ core_courseformat/local/content/section/badges }}
115     </div>
116     {{#collapsemenu}}
117         {{^displayonesection}}
118             <div class="flex-fill d-flex justify-content-end me-2 align-self-start mt-2">
119                 <a id="collapsesections"
120                    class="section-collapsemenu"
121                    href="#"
122                    aria-expanded="true"
123                    role="button"
124                    data-toggle="toggleall"
125                 >
126                     <span class="collapseall text-nowrap">{{#str}}collapseall{{/str}}</span>
127                     <span class="expandall text-nowrap">{{#str}}expandall{{/str}}</span>
128                 </a>
129             </div>
130         {{/displayonesection}}
131     {{/collapsemenu}}
132     {{#controlmenu}}
133         {{^displayonesection}}
134             {{$ core_courseformat/local/content/section/controlmenu }}
135                 {{> core_courseformat/local/content/section/controlmenu }}
136             {{/ core_courseformat/local/content/section/controlmenu }}
137         {{/displayonesection}}
138     {{/controlmenu}}
139     {{#header}}
140         {{#headerdisplaymultipage}}
141             {{^displayonesection}}
142                 {{^controlmenu}}
143                     <div class="section_goto bulk-hidden ms-auto" data-sectionid="{{id}}">
144                         <a href="{{{url}}}"
145                            class="btn btn-icon d-flex align-items-center justify-content-center icon-no-margin"
146                            title="{{#str}}gotosection, course, {{name}}{{/str}}">
147                             <span class="dir-rtl-hide">
148                                 {{#pix}}t/right, moodle{{/pix}}
149                             </span>
150                             <span class="dir-ltr-hide">
151                                 {{#pix}}t/left, moodle, {{#str}}gotosection, course, {{name}}{{/str}}{{/pix}}
152                             </span>
153                             <span class="sr-only">
154                                 {{#str}}gotosection, course, {{name}}{{/str}}
155                             </span>
156                         </a>
157                     </div>
158                 {{/controlmenu}}
159             {{/displayonesection}}
160         {{/headerdisplaymultipage}}
161     {{/header}}
162 </div>
163 <div id="coursecontentcollapse{{num}}"
164      class="content {{^iscoursedisplaymultipage}}{{^sitehome}}{{^displayonesection}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/displayonesection}}{{/sitehome}}{{/iscoursedisplaymultipage}}">
165     <div class="{{#hasavailability}}description{{/hasavailability}} my-3" data-for="sectioninfo">
166         {{#summary}}
167             {{$ core_courseformat/local/content/section/summary }}
168                 {{> core_courseformat/local/content/section/summary }}
169             {{/ core_courseformat/local/content/section/summary }}
170         {{/summary}}
171         {{#availability}}
172             {{$ core_courseformat/local/content/section/availability }}
173                 {{> core_courseformat/local/content/section/availability }}
174             {{/ core_courseformat/local/content/section/availability }}
175         {{/availability}}
176     </div>
177     {{#cmsummary}}
178         {{$ core_courseformat/local/content/section/cmsummary }}
179             {{> core_courseformat/local/content/section/cmsummary }}
180         {{/ core_courseformat/local/content/section/cmsummary }}
181     {{/cmsummary}}
182     {{#cmlist}}
183         {{$ core_courseformat/local/content/section/cmlist }}
184             {{> core_courseformat/local/content/section/cmlist }}
185         {{/ core_courseformat/local/content/section/cmlist }}
186     {{/cmlist}}
187     {{{cmcontrols}}}
188 </div>