Skip to content

Commit

Permalink
Add control to check if settings are defined to avoid errors
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviervalentin committed Apr 8, 2024
1 parent 5d52880 commit 706886e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions lang/en/report_coursemanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
$string['table_enrolled_teachers'] = 'Teachers';
$string['table_recommendation'] = 'Reports';
$string['table_actions'] = 'Actions';
$string['empty_settings'] = 'Some settings are missing for this plugin ; please contact your Moodle admin';

// Actions.
$string['menudeletecourse'] = 'Delete course';
Expand Down
1 change: 1 addition & 0 deletions lang/fr/report_coursemanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
$string['table_enrolled_teachers'] = 'Enseignants';
$string['table_recommendation'] = 'Recommandations';
$string['table_actions'] = 'Actions';
$string['empty_settings'] = 'Certains paramètres du plugin sont manquants ; contactez l\'administrateur Moodle';

// Actions.
$string['menudeletecourse'] = 'Mettre à la corbeille';
Expand Down
10 changes: 10 additions & 0 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@
// Empty action message variable.
unset($done);

if (!get_config('report_coursemanager', 'last_access_student') ||
!get_config('report_coursemanager', 'last_access_teacher') ||
!get_config('report_coursemanager', 'total_filesize_threshold') ||
!get_config('report_coursemanager', 'unique_filesize_threshold')
) {
echo html_writer::div(get_string('empty_settings', 'report_coursemanager'), 'alert alert-primary');
echo $OUTPUT->footer();
exit();
}

// Buttons to filter lines.
print('
<h3>'.get_string('title', 'report_coursemanager').'</h3>
Expand Down

0 comments on commit 706886e

Please sign in to comment.