Skip to content

Commit

Permalink
Improvement: add setting to hide duration for selflearning courses
Browse files Browse the repository at this point in the history
  • Loading branch information
georgmaisser committed Dec 20, 2024
1 parent 91fdffa commit 23247e4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion classes/output/col_coursestarttime.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ public function __construct($optionid, $booking = null, $cmid = null, $collapsed

// For self-learning courses, we do not show any optiondates (sessions).
if (!empty($settings->selflearningcourse)) {

$this->selflearningcourse = true;

if (!empty($settings->duration)) {
if (get_config('booking', 'selflearningcoursehideduration')) {
$this->selflearningcourseshowdurationinfo = null;
} else if (!empty($settings->duration)) {
// We do not show duration info if it is set to 0.
$this->selflearningcourseshowdurationinfo = true;

Expand Down
1 change: 1 addition & 0 deletions lang/de/booking.php
Original file line number Diff line number Diff line change
Expand Up @@ -1949,6 +1949,7 @@
$string['selflearningcoursecoursestarttime_help'] = 'Dieses Datum wird ausschließlich für die Sortierung verwendet, da Buchungsoptionen vom Typ "{$a}" kein fixes Startdatum haben.';
$string['selflearningcoursecoursestarttimealert'] = 'Da Sie unter "Moodle-Kurs" die Option "{$a}" gewählt haben, können Sie hier keine Termine angeben, sondern nur ein Sortierdatum.';
$string['selflearningcoursedurationinfo'] = 'Dieser Kurs dauert {$a}.';
$string['selflearningcoursehideduration'] = 'Dauer für Selbstlernkurse ausblenden';
$string['selflearningcourselabel'] = 'Bezeichnung für Buchungsoptionen mit fixer Dauer';
$string['selflearningcourselabeldesc'] = 'Buchungsoptionen mit fixer Dauer, aber ohne Termine, haben die Standardbezeichnung "Selbstlernkurs". Sie können hier einen beliebigen anderen Namen für diesen Typ von Buchungsoptionen vergeben.';
$string['selflearningcoursesettingsheader'] = 'Buchungsoptionen mit fixer Dauer ' . '<span class="badge bg-success text-light"><i class="fa fa-cogs" aria-hidden="true"></i> PRO</span>';
Expand Down
1 change: 1 addition & 0 deletions lang/en/booking.php
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,7 @@
$string['selflearningcoursecoursestarttime_help'] = 'This date will be used for sorting because booking options of type "{$a}" do not have a fixed start date.';
$string['selflearningcoursecoursestarttimealert'] = 'As you have activated the "{$a}" checkbox under the "Moodle course" settings you cannot add dates here but only provide a sorting date.';
$string['selflearningcoursedurationinfo'] = 'This course has a duration of {$a}.';
$string['selflearningcoursehideduration'] = 'Hide duration for self-learning courses';
$string['selflearningcourselabel'] = 'Name for booking options with fixed duration';
$string['selflearningcourselabeldesc'] = 'Booking options with a fixed duration but without dates are usually called "self-learning course". If you want to use another name for this type of booking options you can enter it here.';
$string['selflearningcoursesettingsheader'] = 'Booking options with fixed duration ' . '&nbsp;<span class="badge bg-success text-light"><i class="fa fa-cogs" aria-hidden="true"></i> PRO</span>';
Expand Down
8 changes: 8 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,14 @@
0
)
);
$settings->add(
new admin_setting_configcheckbox(
'booking/selflearningcoursehideduration',
get_string('selflearningcoursehideduration', 'mod_booking'),
'',
0
)
);
$settings->add(
new admin_setting_configtext(
'booking/selflearningcourselabel',
Expand Down

0 comments on commit 23247e4

Please sign in to comment.