Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 402] [Versions 400 and 403]

Class for user_competency persistence.

Copyright: 2015 Serge Gauthier
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 556 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: user_competency  - X-Ref

Class for loading/storing user_competency from the DB.

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

return: array

can_comment()   X-Ref
Whether the current user can comment on this user competency.

return: bool

can_read()   X-Ref
Whether the current user can read this user competency.

return: bool

can_read_comments()   X-Ref
Whether the current user can read comments on this user competency.

return: bool

can_request_review()   X-Ref
Can the current user send the user competency for review?

return: bool

can_review()   X-Ref
Can the current user review the user competency?

return: bool

get_status_name($status)   X-Ref
Human readable status name.

return: lang_string
param: int $status The status code.

get_status_list()   X-Ref
Get list of competency status.

return: array

get_comment_object()   X-Ref
Get the comment object.

return: comment

get_competency()   X-Ref
Return the competency Object.

return: competency Competency Object

get_context()   X-Ref
Get the context.

return: context The context.

get_plans()   X-Ref
Find the plans for the user and this competency.

Note that this:
- does not perform any capability check.
- may return completed plans.
- may return an empty array.

return: plans[]

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

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

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

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

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

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

validate_reviewerid($value)   X-Ref
Validate the reviewer ID.

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

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

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

can_comment_user($userid)   X-Ref
Can the current user comment on a user's competency?

return: bool
param: int $userid The user ID the competency belongs to.

can_grade_user($userid)   X-Ref
Can the current user grade a user's user competency?

return: bool
param: int $userid The user ID the competency belongs to.

can_grade_user_in_course($userid, $courseid)   X-Ref
Can the current user grade a user's user competency in a course?

return: bool
param: int $userid The user ID the competency belongs to.
param: int $courseid The course ID.

can_read_comments_user($userid)   X-Ref
Can the current user read the comments on a user's competency?

return: bool
param: int $userid The user ID the competency belongs to.

can_read_user_in_course($userid, $courseid)   X-Ref
Can the current user read the user competencies of a user in a course?

return: bool
param: int $userid The user ID the competency belongs to.
param: int $courseid The course ID.

can_read_user($userid)   X-Ref
Can the current user read a user's competency?

return: bool
param: int $userid The user ID the competency belongs to.

can_request_review_user($userid)   X-Ref
Can the current user send a user's competency for review?

Note that the status 'review' is not meant to be used for student to self-assess
themselves, then to ask the teacher to review their assessment. It is more intended
for a student to provide evidence of prior learning and request their review.

return: bool
param: int $userid The user ID the competency belongs to.

can_review_user($userid)   X-Ref
Can the current user review the user competency?

return: bool
param: int $userid The user ID the competency belongs to.

create_relation($userid, $competencyid)   X-Ref
Create a new user_competency 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.

return: \core_competency\user_competency
param: int $userid The user ID.
param: int $competencyid The competency ID.

get_competency_by_usercompetencyid($id)   X-Ref
Fetch a competency by user competency ID.

This is a convenience method to attempt to efficiently fetch a competency when
the only information we have is the user_competency ID, in evidence for instance.

return: competency
param: int $id The user competency ID.

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

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

has_records_for_competency($competencyid)   X-Ref
Checks if a competency has user competency records.

return: boolean
param: int $competencyid The competency ID

has_records_for_framework($frameworkid)   X-Ref
Checks if any of the competencies of a framework has a user competency record.

return: boolean
param: int $frameworkid The competency framework ID.

has_records_for_competencies($competencyids)   X-Ref
Check if user competency has records for competencies.

return: boolean Return true if the delete was successfull.
param: array $competencyids The competencies ids.