From 30deca0149d3af932aa5b4b062d9345d6b4d6164 Mon Sep 17 00:00:00 2001 From: LT&C Date: Mon, 13 Apr 2026 15:07:53 +0200 Subject: [PATCH 1/4] Update version.php version bump --- version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.php b/version.php index b81595d..2ce6b30 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 202501150100; +$plugin->version = 202504130100; $plugin->maturity = MATURITY_BETA; $plugin->requires = 2024100700.00; // 4.5 (Build: 20241007). phpcs:ignore Squiz.PHP.CommentedOutCode.Found $plugin->supported = [405, 405]; From 35acfa16f3c925e7dea6c38dc9397f6e7a6dfb31 Mon Sep 17 00:00:00 2001 From: LT&C Date: Mon, 13 Apr 2026 15:45:24 +0200 Subject: [PATCH 2/4] LS-3517 LS-3517 | Fix course section 0 not visible when no summary information --- Changes.md | 5 +++++ Readme.md | 2 ++ lib.php | 32 ++++++++++++++++++++++++++++++++ version.php | 4 ++-- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Changes.md b/Changes.md index 3c05e28..679c3f5 100644 --- a/Changes.md +++ b/Changes.md @@ -1,6 +1,11 @@ Version Information =================== +Version 4.5.0.3 +----------------------------- +1. Section 0 (General) is now automatically hidden when it has no summary content and no visible modules. + Based on the approach used by format_topcoll (Collapsed Topics). See LS-3490. + Version 4.5.0.2 ----------------------------- 1. Sub-section support. diff --git a/Readme.md b/Readme.md index 82d13c0..b524988 100644 --- a/Readme.md +++ b/Readme.md @@ -40,6 +40,8 @@ Notes section (section 0), as to prevent accidental deletion of the 'news' forum upon which the format relies. If it is deleted, then a page refresh will recreate the forum but all previous posts will be lost. 2. Any title and summary that has been previously set for the general section will not be shown. +3. Section 0 (General) is automatically hidden when it has no summary content and no visible modules. + This is consistent with the approach used by format_topcoll (Collapsed Topics). Additional classes Section name = 'vsf-sectionname'. diff --git a/lib.php b/lib.php index c3ca51b..a464235 100644 --- a/lib.php +++ b/lib.php @@ -215,6 +215,38 @@ public function extend_course_navigation($navigation, navigation_node $node) { } } + /** + * Determines whether a section is visible. + * + * Section 0 is hidden when it has no summary content and no visible modules, + * consistent with the approach used by format_topcoll. + * + * @param \section_info $section The section to check. + * @return bool True if the section should be displayed. + */ + public function is_section_visible(\section_info $section): bool { + $shown = parent::is_section_visible($section); + if ($shown && $section->sectionnum == 0) { + // Show section 0 only if summary has content (text or images). + if (empty(strip_tags($section->summary, ['img']))) { + // No summary — check if there are visible modules. + $modshown = false; + $modinfo = get_fast_modinfo($this->course); + if (!empty($modinfo->sections[$section->section])) { + foreach ($modinfo->sections[$section->section] as $modnumber) { + $mod = $modinfo->cms[$modnumber]; + if ($mod->is_visible_on_course_page()) { + $modshown = true; + break; + } + } + } + $shown = $modshown; + } + } + return $shown; + } + /** * Custom action after section has been moved in AJAX mode * diff --git a/version.php b/version.php index 2ce6b30..29bdba0 100644 --- a/version.php +++ b/version.php @@ -25,9 +25,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 202504130100; +$plugin->version = 2026041300; $plugin->maturity = MATURITY_BETA; $plugin->requires = 2024100700.00; // 4.5 (Build: 20241007). phpcs:ignore Squiz.PHP.CommentedOutCode.Found $plugin->supported = [405, 405]; $plugin->component = 'format_vsf'; -$plugin->release = '4.5.0.2'; +$plugin->release = '4.5.0.3'; From 48f8ff931245dcb17b59235e8b401e4894307b77 Mon Sep 17 00:00:00 2001 From: LT&C Date: Mon, 13 Apr 2026 15:46:49 +0200 Subject: [PATCH 3/4] LS-3517-versionphp LS-3517-versionphp bump --- version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.php b/version.php index 29bdba0..5509f53 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2026041300; +$plugin->version = 2026041301; $plugin->maturity = MATURITY_BETA; $plugin->requires = 2024100700.00; // 4.5 (Build: 20241007). phpcs:ignore Squiz.PHP.CommentedOutCode.Found $plugin->supported = [405, 405]; From 84cbbdbe419e7da583e09ede7da066bdc8cc4782 Mon Sep 17 00:00:00 2001 From: LT&C Date: Mon, 13 Apr 2026 15:48:56 +0200 Subject: [PATCH 4/4] LS-3517 LS-3517 version bump --- version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.php b/version.php index 5509f53..79ec22a 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2026041301; +$plugin->version = 202604130100; $plugin->maturity = MATURITY_BETA; $plugin->requires = 2024100700.00; // 4.5 (Build: 20241007). phpcs:ignore Squiz.PHP.CommentedOutCode.Found $plugin->supported = [405, 405];