Skip to content
Browse files

Participation report - check for course modules and print an error if…

… there are none.
  • Loading branch information...
1 parent ac7462f commit f3815a9547ee82d1f02a63ef7f32c34cade092b6 mjollnir_ committed Dec 20, 2005
Showing with 6 additions and 2 deletions.
  1. +5 −2 course/participation.php
  2. +1 −0 lang/en/error.php
View
7 course/participation.php
@@ -50,8 +50,11 @@
'journal','lesson','questionnaire','quiz','resource','scorm',
'survey','wiki','workshop'); // some don't make sense here - eg 'label'
- $modules = get_records_sql('SELECT DISTINCT module,name FROM '.$CFG->prefix.'course_modules cm JOIN '.
- $CFG->prefix.'modules m ON cm.module = m.id WHERE course = '.$course->id);
+ if (!$modules = get_records_sql('SELECT DISTINCT module,name FROM '.$CFG->prefix.'course_modules cm JOIN '.
+ $CFG->prefix.'modules m ON cm.module = m.id WHERE course = '.$course->id)) {
+ print_error('participationreportnocoursemodules',$CFG->wwwroot.'/course/view.php?id='.$course->id);
+ }
+
$modoptions = array();
foreach ($modules as $m) {
View
1 lang/en/error.php
@@ -29,6 +29,7 @@
$string['notavailable'] = 'That is not currently available';
$string['onlyeditown'] = 'You can only edit your own information';
$string['onlyeditingteachers'] = 'Only editing teachers can do that.';
+$string['participationreportnocoursemodules'] = 'Sorry, but you have no participatory course modules to report on.';
$string['processingstops'] = 'Processing stops here. Remaining records ignored.';
$string['restricteduser'] = 'Sorry, but your current account \"$a\" is restricted from doing that.';
$string['sessionerroruser'] = 'Your session has timed out. Please login again.';

0 comments on commit f3815a9

Please sign in to comment.
Something went wrong with that request. Please try again.