Skip to content

Commit

Permalink
enable hide hidden courses
Browse files Browse the repository at this point in the history
  • Loading branch information
EsdrasCaleb authored and danmarsden committed Jun 18, 2024
1 parent 3a8998e commit 4b00cbe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lang/en/subcourse.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
$string['refcoursenull'] = 'No referenced course configured';
$string['settings:coursepageprintgrade'] = 'Grade on course page';
$string['settings:coursepageprintgrade_desc'] = 'Display grade from referenced course on course page.';
$string['settings:displayhiddencourses'] = 'Display hidden courses';
$string['settings:displayhiddencourses_desc'] = 'Allow hidden courses to be selected when editing a subcourse.';
$string['settings:coursepageprintprogress'] = 'Progress on course page';
$string['settings:coursepageprintprogress_desc'] = 'Display progress from referenced course on course page.';
$string['subcourse:addinstance'] = 'Add a new subcourse';
Expand Down
9 changes: 6 additions & 3 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,13 @@ 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;
}
}

Expand Down
7 changes: 7 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,12 @@
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
));
}
}
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'mod_subcourse';
$plugin->release = 2023103000;
$plugin->version = 2023103000;
$plugin->release = 2023103001;
$plugin->version = 2023103001;
$plugin->maturity = MATURITY_STABLE;
$plugin->requires = 2022112800; // Requires 4.1
$plugin->supported = [401, 401];

0 comments on commit 4b00cbe

Please sign in to comment.