/** * List all the evidence for a user competency in a course. * * @param int $userid The user ID. * @param int $courseid The course ID. * @param int $competencyid The competency ID. * @param string $sort The field to sort the evidence by. * @param string $order The ordering of the sorting. * @param int $skip Number of records to skip. * @param int $limit Number of records to return. * @return \core_competency\evidence[] */ public static function list_evidence_in_course($userid = 0, $courseid = 0, $competencyid = 0, $sort = 'timecreated', $order = 'DESC', $skip = 0, $limit = 0) { static::require_enabled(); if (!user_competency::can_read_user_in_course($userid, $courseid)) { $context = context_user::instance($userid); throw new required_capability_exception($context, 'moodle/competency:usercompetencyview', 'nopermissions', ''); } $usercompetency = user_competency::get_record(array('userid' => $userid, 'competencyid' => $competencyid)); if (!$usercompetency) { return array(); } $context = context_course::instance($courseid); return evidence::get_records_for_usercompetency($usercompetency->get_id(), $context, $sort, $order, $skip, $limit); }