Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 402] [Versions 310 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.

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

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.

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_proficiency($value)   X-Ref
Validate the proficiency.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

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

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

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

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.

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

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.

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

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

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

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

param: int $competencyid The competency ID
return: boolean

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

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

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

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