Skip to content

Commit b4e035f

Browse files
committed
V2.7.3
1 parent a9856e7 commit b4e035f

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

Readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ can be really useful in visualising the issue along with any files you consider
243243

244244
Version Information
245245
===================
246+
9th January 2014 Version 2.7.3
247+
1. New 'Do not show date' feature gratefully funded by 'GAC Corporate Academy, GAC HQ, Dubai, UAE (http://www.gacacademy.com)'.
248+
246249
11th December 2014 Version 2.7.2
247250
1. New 'Show section summary when collapsed' feature gratefully funded by 'Te Rito Maioha Early Childhood New Zealand - https://ecnz.ac.nz'.
248251
2. Fix CONTRIB-5472.

lang/en/format_topcoll.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,10 @@
380380
$string['defaultshowsectionsummary'] = 'Show the section summary when collapsed';
381381
$string['defaultshowsectionsummary_desc'] = 'States if the section summary will always be shown regardless of toggle state.';
382382

383+
// Do not show date.
384+
$string['donotshowdate'] = 'Do not show the date';
385+
$string['donotshowdate_help'] = 'Do not show the date when using a weekly based structure and \'Use default section name\' has been un-ticked.';
386+
383387
// Capabilities.
384388
$string['topcoll:changelayout'] = 'Change or reset the layout';
385389
$string['topcoll:changecolour'] = 'Change or reset the colour';

lib.php

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)