diff --git a/admin/configvars.php b/admin/configvars.php index 1433bbf3b5f..478d91e547b 100644 --- a/admin/configvars.php +++ b/admin/configvars.php @@ -578,7 +578,9 @@ class configvarrss extends configvar { $stats['statsruntimestart'] = new configvar (get_string('configstatsruntimestart','admin'), print_time_selector("statsruntimestarthour","statsruntimestartminute",make_timestamp(2000,1,1,$config->statsruntimestarthour,$config->statsruntimestartminute),5,true) ); - + $stats['statsuserthreshold'] = new configvar (get_string('configstatsuserthreshold','admin'), + ''); + //////////////////////////////////////////////////////////////////// diff --git a/lang/en/admin.php b/lang/en/admin.php index 77ca9369241..5654777a21c 100755 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -105,6 +105,7 @@ $string['configsmtpuser'] = 'If you have specified an SMTP server above, and the $string['configstatsfirstrun'] = 'This specifies how far back the logs should be processed the first time the cronjob wants to process statistics. If you have a lot of traffic and are on shared hosting, it\'s probably not a good idea to go too far back, as it could take a long time to run and be quite resource intensive. (Note that for this setting, 1 month = 28 days. In the graphs and reports generated, 1 month = 1 calendar month.)'; $string['configstatsmaxruntime'] = 'Stats processing can be quite intensive, so use a combination of this field and the next one to specify when it will run and how long for.'; $string['configstatsruntimestart'] = 'What time should the cronjob that does the stats processing start?'; +$string['configstatsuserthreshold'] = 'If you enter a non-zero, non numeric value here, for ranking courses, courses with less than this number of enrolled users (students + teachers) will be ignored'; $string['configteacherassignteachers'] = 'Should ordinary teachers be allowed to assign other teachers within courses they teach? If \'No\', then only course creators and admins can assign teachers.'; $string['configthemelist'] = 'Leave this blank to allow any valid theme to be used. If you want to shorten the theme menu, you can specify a comma-separated list of names here (Don\'t use spaces!). For example: standard,orangewhite.'; diff --git a/lib/statslib.php b/lib/statslib.php index a5f45a07b9c..52c1fdecb47 100644 --- a/lib/statslib.php +++ b/lib/statslib.php @@ -583,6 +583,9 @@ function stats_get_parameters($time,$report,$courseid,$mode) { $param->fields = 'max(students+teachers) as line1,max(activestudents+activeteachers) AS line2,' .'max(activestudents+activeteachers)'.$real.'/max(students+teachers)'.$real.' AS line3'; $param->extras = 'HAVING max(students+teachers) != 0'; + if (!empty($CFG->statsuserthreshold) && is_numeric($CFG->statsuserthreshold)) { + $param->extras .= ' AND max(students+teachers) > '.$CFG->statsuserthreshold; + } $param->orderby = 'line3 DESC'; $param->line1 = get_string('users'); $param->line2 = get_string('activeusers');