@@ -77,7 +77,7 @@ public function specialization() {
7777 public function applicable_formats () {
7878 return [
7979 'site-index ' => true ,
80- 'course-view-* ' => true
80+ 'course-view-* ' => true ,
8181 ];
8282 }
8383
@@ -132,18 +132,7 @@ public function get_content() {
132132 return $ this ->content ;
133133 }
134134
135- if (($ format instanceof format_digidagotabs) || ($ format instanceof format_horizontaltabs)) {
136- // Don't show the menu in a tab.
137- if ($ intab ) {
138- return $ this ->content ;
139- }
140- // Only show the block inside activities of courses.
141- if ($ this ->page ->pagelayout == 'incourse ' ) {
142- $ sections = $ format ->tabs_get_sections ();
143- }
144- } else {
145- $ sections = $ format ->get_sections ();
146- }
135+ $ sections = $ format ->get_sections ();
147136
148137 if (empty ($ sections )) {
149138 return $ this ->content ;
@@ -163,7 +152,7 @@ public function get_content() {
163152
164153 $ completionok = [
165154 COMPLETION_COMPLETE ,
166- COMPLETION_COMPLETE_PASS
155+ COMPLETION_COMPLETE_PASS ,
167156 ];
168157
169158 $ thiscontext = context::instance_by_id ($ this ->page ->context ->id );
@@ -185,56 +174,6 @@ public function get_content() {
185174 }
186175 }
187176
188- if ($ format instanceof format_digidagotabs || $ format instanceof format_horizontaltabs) {
189- $ coursesections = $ DB ->get_records (
190- 'course_sections ' ,
191- [ 'course ' => $ course ->id ],
192- );
193- $ mysection = 0 ;
194- foreach ($ coursesections as $ cs ) {
195- $ csmodules = explode (
196- ', ' ,
197- $ cs ->sequence ,
198- );
199- if (in_array (
200- $ myactivityid ,
201- $ csmodules ,
202- )) {
203- $ mysection = $ cs ->id ;
204- }
205- }
206-
207- if ($ mysection ) {
208- $ formatcourse = course_get_format ($ course ->id );
209- if ($ formatcourse == 'horizontaltabs ' ) {
210- if (($ DB ->get_records (
211- 'format_horizontaltabs_tabs ' ,
212- [
213- 'courseid ' => $ course ->id ,
214- 'sectionid ' => $ mysection
215- ],
216- ))) {
217- // This is a module inside a tab of the Dynamic tabs course format.
218- // Prevent showing of this menu.
219- return $ this ->content ;
220- }
221- }
222- if ($ formatcourse == 'digidagotabs ' ) {
223- if (($ DB ->get_records (
224- 'format_digidagotabs_tabs ' ,
225- [
226- 'courseid ' => $ course ->id ,
227- 'sectionid ' => $ mysection
228- ],
229- ))) {
230- // This is a module inside a tab of the Dynamic tabs course format.
231- // Prevent showing of this menu.
232- return $ this ->content ;
233- }
234- }
235- }
236- }
237-
238177 $ template ->inactivity = $ inactivity ;
239178
240179 if (count ($ sections ) > 1 ) {
@@ -283,7 +222,7 @@ public function get_content() {
283222 $ section ->summaryformat ,
284223 [
285224 'para ' => false ,
286- 'context ' => $ context
225+ 'context ' => $ context,
287226 ],
288227 );
289228 $ title = $ format ->get_section_name ($ section );
@@ -308,9 +247,9 @@ public function get_content() {
308247 'toggletitles ' ,
309248 );
310249
311- $ thissection ->collapse = ($ toggleclickontitle == 2 ); // Display the menu if true, else go to link
250+ $ thissection ->collapse = ($ toggleclickontitle == 2 ); // Display the menu if true, else go to link.
312251 $ thissection ->selected = ($ togglecollapse == 2 );
313- $ thissection ->onlytitles = ($ toggletitles == 2 ); // Show only titles if true, else show titles and contents
252+ $ thissection ->onlytitles = ($ toggletitles == 2 ); // Show only titles if true, else show titles and contents.
314253
315254 if ($ i == $ selected && !$ inactivity ) {
316255 $ thissection ->selected = true ;
@@ -339,7 +278,6 @@ public function get_content() {
339278 $ thissection ,
340279 );
341280 }
342-
343281 $ thissection ->modules [] = $ thismod ;
344282 } else {
345283 $ thissection ->modules [] = $ this ->checkmodule (
@@ -355,7 +293,8 @@ public function get_content() {
355293 }
356294
357295 $ thissection ->hasmodules = (count ($ thissection ->modules ) > 0 );
358- if ($ thissection ->hasmodules && $ thissection ->uservisible ) {
296+ // We prevent case of section (mod_subsection) are added at the end ...
297+ if ($ thissection ->hasmodules && $ thissection ->uservisible && $ section ->component !== "mod_subsection " ) {
359298 $ template ->sections [] = $ thissection ;
360299 }
361300 }
@@ -371,7 +310,7 @@ public function get_content() {
371310 '/course/view.php ' ,
372311 [
373312 'id ' => $ course ->id ,
374- 'section ' => $ i
313+ 'section ' => $ i,
375314 ],
376315 );
377316 $ template ->courseurl = $ courseurl ->out ();
@@ -387,7 +326,7 @@ public function get_content() {
387326 '/course/view.php ' ,
388327 [
389328 'id ' => $ course ->id ,
390- 'section ' => $ pn ->prev
329+ 'section ' => $ pn ->prev ,
391330 ],
392331 );
393332 $ template ->prevurl = $ prevurl ->out (false );
@@ -396,7 +335,7 @@ public function get_content() {
396335 '/course/view.php ' ,
397336 [
398337 'id ' => $ course ->id ,
399- 'section ' => $ thissection ->number
338+ 'section ' => $ thissection ->number ,
400339 ],
401340 );
402341 $ template ->currurl = $ currurl ->out (false );
@@ -405,7 +344,7 @@ public function get_content() {
405344 '/course/view.php ' ,
406345 [
407346 'id ' => $ course ->id ,
408- 'section ' => $ pn ->next
347+ 'section ' => $ pn ->next ,
409348 ],
410349 );
411350 $ template ->nexturl = $ nexturl ->out (false );
0 commit comments