/** * Reads data for an event. * @param [String => Mixed] $opts * @return [String => Mixed] * @override ModuleViewed */ public function read(array $opts) { $scoreRaw = (double) ($opts['grade']->grade ?: 0); $scoreMin = (double) ($opts['grade_items']->grademin ?: 0); $scoreMax = (double) ($opts['grade_items']->grademax ?: 0); $scorePass = (double) ($opts['grade_items']->gradepass ?: null); $success = false; //if there is no passing score then success is unknown. if ($scorePass == null) { $success = null; } elseif ($scoreRaw >= $scorePass) { $success = true; } //Calculate scaled score as the distance from zero towards the max (or min for negative scores). $scoreScaled; if ($scoreRaw >= 0) { $scoreScaled = $scoreRaw / $scoreMax; } else { $scoreScaled = $scoreRaw / $scoreMin; } return [array_merge(parent::read($opts)[0], ['recipe' => 'assignment_graded', 'graded_user_id' => $opts['graded_user']->id, 'graded_user_url' => $opts['graded_user']->url, 'graded_user_name' => $opts['graded_user']->fullname, 'grade_score_raw' => $scoreRaw, 'grade_score_min' => $scoreMin, 'grade_score_max' => $scoreMax, 'grade_score_scaled' => $scoreScaled, 'grade_success' => $success, 'grade_completed' => true, 'grade_comment' => strip_tags($opts['grade_comment'])])]; }
/** * Reads data for an event. * @param [String => Mixed] $opts * @return [String => Mixed] * @override ModuleViewed */ public function read(array $opts) { return array_merge(parent::read($opts), ['recipe' => 'assignment_graded', 'graded_user_id' => $opts['graded_user']->id, 'graded_user_url' => $opts['graded_user']->url, 'graded_user_name' => $opts['graded_user']->username, 'grade_result' => $opts['grade']->grade]); }
/** * Reads data for an event. * @param [String => Mixed] $opts * @return [String => Mixed] * @override ModuleViewed */ public function read(array $opts) { return [array_merge(parent::read($opts)[0], ['recipe' => 'assignment_submitted'])]; }
/** * Reads data for an event. * @param [String => Mixed] $opts * @return [String => Mixed] * @override ModuleViewed */ public function read(array $opts) { return [array_merge(parent::read($opts)[0], ['recipe' => 'attempt_started', 'attempt_url' => $opts['attempt']->url, 'attempt_type' => static::$xapi_type . $opts['attempt']->type, 'attempt_ext' => $opts['attempt'], 'attempt_ext_key' => 'http://lrs.learninglocker.net/define/extensions/moodle_attempt', 'attempt_name' => $opts['attempt']->name])]; }
/** * Reads data for an event. * @param [String => Mixed] $opts * @return [String => Mixed] * @override ModuleViewed */ public function read(array $opts) { return [array_merge(parent::read($opts)[0], ['recipe' => 'scorm_launched'])]; }
/** * Reads data for an event. * @param [String => Mixed] $opts * @return [String => Mixed] * @override ModuleViewed */ public function read(array $opts) { return [array_merge(parent::read($opts)[0], ['recipe' => 'discussion_viewed', 'discussion_url' => $opts['discussion']->url, 'discussion_name' => $opts['discussion']->name, 'discussion_description' => 'A Moodle discussion.', 'discussion_type' => static::$xapi_type . $opts['discussion']->type, 'discussion_ext' => $opts['discussion'], 'discussion_ext_key' => 'http://lrs.learninglocker.net/define/extensions/moodle_discussion'])]; }
/** * Reads data for an event. * @param [String => Mixed] $opts * @return [String => Mixed] * @override ModuleViewed */ public function read(array $opts) { $sessionName = 'Session ' . $opts['session']->id . ' of ' . $opts['module']->name; return [array_merge(parent::read($opts)[0], ['recipe' => 'training_session_enrol', 'session_url' => $opts['session']->url, 'session_name' => $sessionName, 'session_description' => $sessionName, 'session_type' => 'http://activitystrea.ms/schema/1.0/event'])]; }
/** * Reads data for an event. * @param [String => Mixed] $opts * @return [String => Mixed] * @override AttemtStarted */ public function read(array $opts) { $feedback = $this->parseFeedback($opts); return [array_merge(parent::read($opts)[0], ['recipe' => 'attempt_completed', 'attempt_url' => $opts['attempt']->url, 'attempt_type' => static::$xapi_type . $opts['attempt']->type, 'attempt_ext' => $opts['attempt'], 'attempt_ext_key' => 'http://lrs.learninglocker.net/define/extensions/moodle_feedback_attempt', 'attempt_name' => $opts['attempt']->name, 'attempt_score_raw' => $feedback->score->raw, 'attempt_score_min' => $feedback->score->min, 'attempt_score_max' => $feedback->score->max, 'attempt_score_scaled' => $feedback->score->scaled, 'attempt_success' => null, 'attempt_completed' => true, 'attempt_duration' => null, 'time' => date('c', $opts['attempt']->timemodified)])]; }