$numcourses = optional_param('numcourses', 20, PARAM_INT);
$course = get_site();
- stats_check_uptodate($course->id);
-
+ $statsstatus = stats_check_uptodate($course->id);
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
echo '<form action="report/courseoverview/index.php" method="post">'."\n";
print_table($table);
echo '</form>';
+ if ($statsstatus !== NULL) {
+ notify ($statsstatus);
+ }
+
}
?>
echo '<p style="text-align:center;">';
echo '<a href="'.$CFG->wwwroot.'/admin/report/stats/index.php?course='.$course->id.'">'.get_string('stats').'</a>';
echo '</p>';
+ $statsstatus = stats_check_uptodate($course->id);
+ if ($statsstatus !== NULL) {
+ notify ($statsstatus);
+ }
}
?>
\ No newline at end of file
require_once($CFG->dirroot.'/lib/statslib.php');
- stats_check_uptodate($course->id);
+ $statsstatus = stats_check_uptodate($course->id);
+ if ($statsstatus !== NULL) {
+ notify ($statsstatus);
+ }
$earliestday = get_field_sql('SELECT timeend FROM '.$CFG->prefix.'stats_user_daily ORDER BY timeend LIMIT 1');
$earliestweek = get_field_sql('SELECT timeend FROM '.$CFG->prefix.'stats_user_weekly ORDER BY timeend LIMIT 1');
$latestday = stats_get_start_from('daily');
if ((time() - 60*60*24*2) < $latestday) { // we're ok
- return true;
+ return NULL;
}
+ $a = new object();
$a->daysdone = get_field_sql("SELECT count(distinct(timeend)) from {$CFG->prefix}stats_daily");
// how many days between the last day and now?
$a->dayspending = ceil((stats_get_base_daily() - $latestday)/(60*60*24));
if ($a->dayspending == 0 && $a->daysdone != 0) {
- return true; // we've only just started...
+ return NULL; // we've only just started...
}
- error(get_string('statscatchupmode','error',$a),$CFG->wwwroot.'/course/view.php?id='.$courseid);
+
+ //return error as string
+ return get_string('statscatchupmode','error',$a);
}