@@ -107,6 +107,7 @@ public function get_topcoll_section_name($course, $section, $additional) {
107107 }
108108 $ o = '' ;
109109 $ tcsettings = $ this ->get_settings ();
110+ $ tcsectionsettings = $ this ->get_format_options ($ thesection ->section );
110111 $ coursecontext = context_course::instance ($ course ->id );
111112
112113 // We can't add a node without any text.
@@ -118,15 +119,17 @@ public function get_topcoll_section_name($course, $section, $additional) {
118119 if ($ additional == true ) { // Break 'br' tags break backups!
119120 $ o .= html_writer::empty_tag ('br ' );
120121 }
121- $ o .= $ this ->get_section_dates ($ section , $ course , $ tcsettings );
122+ if (empty ($ tcsectionsettings ['donotshowdate ' ])) {
123+ $ o .= $ this ->get_section_dates ($ section , $ course , $ tcsettings );
124+ }
122125 }
123126 } else if ($ thesection ->section == 0 ) {
124127 $ o = get_string ('section0name ' , 'format_topcoll ' );
125128 } else {
126129 if (($ tcsettings ['layoutstructure ' ] == 1 ) || ($ tcsettings ['layoutstructure ' ] == 4 )) {
127130 $ o = get_string ('sectionname ' , 'format_topcoll ' ) . ' ' . $ thesection ->section ;
128131 } else {
129- $ o = $ this ->get_section_dates ($ thesection , $ course , $ tcsettings );
132+ $ o . = $ this ->get_section_dates ($ section , $ course , $ tcsettings );
130133 }
131134 }
132135
@@ -275,6 +278,38 @@ public function get_default_blocks() {
275278 );
276279 }
277280
281+ public function section_format_options ($ foreditform = false ) {
282+ static $ sectionformatoptions = false ;
283+
284+ if ($ sectionformatoptions === false ) {
285+ $ sectionformatoptions = array (
286+ 'donotshowdate ' => array (
287+ 'default ' => 0 ,
288+ 'type ' => PARAM_INT
289+ )
290+ );
291+ }
292+ if ($ foreditform && !isset ($ sectionformatoptions ['donotshowdate ' ]['label ' ])) {
293+ $ sectionformatoptionsedit = array (
294+ 'donotshowdate ' => array (
295+ 'label ' => new lang_string ('donotshowdate ' , 'format_topcoll ' ),
296+ 'help ' => 'donotshowdate ' ,
297+ 'help_component ' => 'format_topcoll ' ,
298+ 'element_type ' => 'checkbox '
299+ )
300+ );
301+ $ sectionformatoptions = array_merge_recursive ($ sectionformatoptions , $ sectionformatoptionsedit );
302+ }
303+
304+ $ tcsettings = $ this ->get_settings ();
305+ if (($ tcsettings ['layoutstructure ' ] == 2 ) || ($ tcsettings ['layoutstructure ' ] == 3 ) ||
306+ ($ tcsettings ['layoutstructure ' ] == 5 )) {
307+ // Weekly layout.
308+ return $ sectionformatoptions ;
309+ } else {
310+ return array ();
311+ }
312+ }
278313 /**
279314 * Definitions of the additional options that this course format uses for course
280315 *
0 commit comments