From 3412f107afc9001fbee2d63e3238a4f7f689efa1 Mon Sep 17 00:00:00 2001 From: Esdras Caleb Date: Thu, 13 Jun 2024 16:56:51 -0300 Subject: [PATCH] ommit coruses fix issue 42 --- lang/en/subcourse.php | 2 ++ mod_form.php | 10 +++++++--- settings.php | 6 ++++++ version.php | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lang/en/subcourse.php b/lang/en/subcourse.php index afbf486..20cc998 100644 --- a/lang/en/subcourse.php +++ b/lang/en/subcourse.php @@ -71,6 +71,8 @@ $string['settings:coursepageprintgrade_desc'] = 'Display grade from referenced course on course page.'; $string['settings:coursepageprintprogress'] = 'Progress on course page'; $string['settings:coursepageprintprogress_desc'] = 'Display progress from referenced course on course page.'; +$string['settings:displayhiddencourses'] = 'Display Hidden Courses'; +$string['settings:displayhiddencourses_desc'] = 'When selecting a subcourse from list hidden coruses will be displayed.'; $string['subcourse:addinstance'] = 'Add a new subcourse'; $string['subcourse:begraded'] = 'Receive grade from the referenced course'; $string['subcourse:fetchgrades'] = 'Fetch grades manually from the referenced course'; diff --git a/mod_form.php b/mod_form.php index 31edfce..2ea33bc 100644 --- a/mod_form.php +++ b/mod_form.php @@ -121,10 +121,14 @@ public function definition() { foreach ($mycourses as $mycourse) { $courselabel = $catlist[$mycourse->category] . ' / ' . $mycourse->fullname.' ('.$mycourse->shortname.')'; - $options[$mycourse->id] = $courselabel; if (empty($mycourse->visible)) { - $hiddenlabel = ' '.get_string('hiddencourse', 'subcourse'); - $options[$mycourse->id] .= $hiddenlabel; + if($config->displayhiddencourses || $mycourse->id == $currentrefcourseid){ + $hiddenlabel = ' '.get_string('hiddencourse', 'subcourse'); + $options[$mycourse->id] = $courselabel.$hiddenlabel; + } + } + else{ + $options[$mycourse->id] = $courselabel; } } diff --git a/settings.php b/settings.php index c92f748..a478a0f 100644 --- a/settings.php +++ b/settings.php @@ -46,5 +46,11 @@ get_string('settings:coursepageprintgrade_desc', 'mod_subcourse'), 1 )); + $settings->add(new admin_setting_configcheckbox( + 'mod_subcourse/displayhiddencourses', + get_string('settings:displayhiddencourses', 'mod_subcourse'), + get_string('settings:displayhiddencourses_desc', 'mod_subcourse'), + 1 + )); } } diff --git a/version.php b/version.php index 899cb49..bad4d25 100644 --- a/version.php +++ b/version.php @@ -26,7 +26,7 @@ $plugin->component = 'mod_subcourse'; $plugin->release = 2023103000; -$plugin->version = 2023103000; +$plugin->version = 2024061300; $plugin->maturity = MATURITY_STABLE; $plugin->requires = 2022112800; // Requires 4.1 $plugin->supported = [401, 401];