'select '.$course_id.' as course_id, "'.$course_code.'" as course_code', 'values_query_function' => 'reports_modules_course_val')); } function reports_modules_course_val($course, $key_id) { return array('type'=> 'sql', 'sql' => 'select '.$key_id.', user_id as uid, '. '-1 as session_id, -1 as attempt, null as score, '. 'NULL as progress, '. '(sum(logout_course_date) - sum(login_course_date)) as time, null as ts from '. Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS). ' where c_id = ' . $course['real_id'] . ' group by user_id'); }