/** * Return a small object with summary information about what a * user has done with a given particular instance of this module * Used for user activity reports. * $return->time = the time they did it * $return->info = a short text description * * @global object $DB * @param object $course * @param object $user * @param object $mod * @param object $hotpot * @return stdclass|null */ function hotpot_user_outline($course, $user, $mod, $hotpot) { global $CFG, $DB; require_once $CFG->dirroot . '/mod/hotpot/locallib.php'; $conditions = array('hotpotid' => $hotpot->id, 'userid' => $user->id); if (!($attempts = $DB->get_records('hotpot_attempts', $conditions, "timestart ASC", 'id,score,timestart'))) { return null; } $time = 0; $info = null; $scores = array(); foreach ($attempts as $attempt) { if ($time == 0) { $time = $attempt->timestart; } $scores[] = hotpot::format_score($attempt); } if (count($scores)) { $info = get_string('score', 'hotpot') . ': ' . implode(', ', $scores); } else { $info = get_string('noactivity', 'hotpot'); } return (object) array('time' => $time, 'info' => $info); }