Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable hide hidden courses #83

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
));
}
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

$plugin->component = 'mod_subcourse';
$plugin->release = 2023122200;
$plugin->version = 2023122200;
$plugin->version = 2024061400;
$plugin->maturity = MATURITY_STABLE;
$plugin->requires = 2024041200; // Requires 4.4
$plugin->supported = [404, 404];
Loading