Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Class for user_competency_course persistence.

Copyright: 2016 Jun Pataleta
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 293 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: user_competency_course  - X-Ref

Class for loading/storing user_competency_course from the DB.

define_properties()   X-Ref
Return the definition of the properties of this model.

return: array

get_competency()   X-Ref
Return the competency Object.

return: competency Competency Object

get_context()   X-Ref
Get the context.

return: context The context.

create_relation($userid, $competencyid, $courseid)   X-Ref
Create a new user_competency_course object.

Note, this is intended to be used to create a blank relation, for instance when
the record was not found in the database. This does not save the model.

param: int $userid The user ID.
param: int $competencyid The competency ID.
param: int $courseid The course ID.
return: \core_competency\user_competency_course

validate_userid($value)   X-Ref
Validate the user ID.

param: int $value The value.
return: true|lang_string

validate_competencyid($value)   X-Ref
Validate the competency ID.

param: int $value The value.
return: true|lang_string

validate_courseid($value)   X-Ref
Validate course ID.

param: int $value The course ID.
return: true|lang_string

validate_proficiency($value)   X-Ref
Validate the proficiency.

param: int $value The value.
return: true|lang_string

validate_grade($value)   X-Ref
Validate the grade.

param: int $value The value.
return: true|lang_string

get_multiple($userid, $courseid, array $competenciesorids = null)   X-Ref
Get multiple user_competency_course for a user.

param: int $userid
param: int $courseid
param: array  $competenciesorids Limit search to those competencies, or competency IDs.
return: \core_competency\user_competency_course[]

count_proficient_competencies($courseid, $userid)   X-Ref
Count the proficient competencies in this course for one user.

param: int $courseid The course id
param: int $userid The user id
return: int

get_least_proficient_competencies_for_course($courseid, $skip = 0, $limit = 0)   X-Ref
Get the list of competencies that were completed the least times in a course.

param: int $courseid
param: int $skip The number of competencies to skip
param: int $limit The max number of competencies to return
return: competency[]