From 312caf228c9960f7c7944b01531af1212f89ad68 Mon Sep 17 00:00:00 2001 From: Matthias Opitz Date: Mon, 27 Mar 2023 15:51:42 +0100 Subject: [PATCH] Show hint for any restriction of a module, not only date restrictions --- form.php | 24 +++++++++++------------- lang/en/report_editdates.php | 4 ++-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/form.php b/form.php index aa6a258..f460838 100644 --- a/form.php +++ b/form.php @@ -227,19 +227,17 @@ public function definition() { if ($coursehasavailability) { if ($cm->availability) { - // If there are retricted access date settings. - if (strpos($cm->availability, '"type":"date"') !== false) { - $timeline[$cm->id] = array_merge($timeline[$cm->id], array('restrict' => $cm->availability)); - $editsettingurl = new moodle_url('/course/modedit.php', array('update' => $cm->id)); - $editsettingurltext = html_writer::tag('a', - get_string('editrestrictedaccess', 'report_editdates'), - array('href' => $editsettingurl->out(false), - 'target' => '_blank', - 'class' => 'editdates_highlight')); - $mform->addElement('static', '', - get_string('hasrestrictedaccess', 'report_editdates', ($cm->name)), - $editsettingurltext); - } + // If there are any retricted access settings. + $timeline[$cm->id] = array_merge($timeline[$cm->id], array('restrict' => $cm->availability)); + $editsettingurl = new moodle_url('/course/modedit.php', array('update' => $cm->id)); + $editsettingurltext = html_writer::tag('a', + get_string('editrestrictedaccess', 'report_editdates'), + array('href' => $editsettingurl->out(false), + 'target' => '_blank', + 'class' => 'editdates_highlight')); + $mform->addElement('static', '', + get_string('hasrestrictedaccess', 'report_editdates', ($cm->name)), + $editsettingurltext); } else { $editsettingurl = new moodle_url('/course/modedit.php', array('update' => $cm->id)); $editsettingurltext = html_writer::tag('a', diff --git a/lang/en/report_editdates.php b/lang/en/report_editdates.php index 8970b88..5ba4294 100644 --- a/lang/en/report_editdates.php +++ b/lang/en/report_editdates.php @@ -50,8 +50,8 @@ $string['timelinemaxdesc'] = 'Maximum number of years shown on timeline.'; $string['timelinedonotshow'] = 'Do not show the timeline'; $string['toomuchtime'] = 'Timeline not created: Times were spread over {$a}+ years.'; -$string['hasrestrictedaccess'] = '{$a} has restricted date access settings'; -$string['norestrictedaccess'] = 'No restricted date access settings on {$a}'; +$string['hasrestrictedaccess'] = '{$a} has restricted access settings'; +$string['norestrictedaccess'] = 'No restricted access settings on {$a}'; $string['addrestrictedaccess'] = 'Add restricted access (opens a new window)'; $string['editrestrictedaccess'] = 'Edit restricted access (opens a new window)'; $string['event:reportviewed'] = 'Edit dates report viewed';