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.

Class for user_competency_plan persistence.

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

Defines 1 class


Class: user_competency_plan  - X-Ref

Class for loading/storing user_competency_plan 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.

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

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

validate_planid($value)   X-Ref
Validate the plan ID.

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

create_relation($userid, $competencyid, $planid)   X-Ref
Create a new user_competency_plan 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_plan
param: int $userid The user ID.
param: int $competencyid The competency ID.
param: int $planid The plan ID.

list_competencies($planid, $userid)   X-Ref
List the competencies in this plan.

return: competency[]
param: int $planid The plan ID
param: int $userid The user ID

get_competency_by_planid($planid, $competencyid)   X-Ref
Fetch a competency by plan ID.

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

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

return: \core_competency\user_competency_plan[]
param: int $userid The user ID.
param: int $planid The plan ID.
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 plan 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 plan record.

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

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

return: boolean
param: array $competencyids The competences IDs

count_records_for_template($templateid, $proficiency=null)   X-Ref
Count the number of records matching a specific template, optionally filtered by proficient values.

return: int
param: int $templateid
param: mixed $proficiency - If true - filter by proficiency, if false filter by not proficient, if null - do not filter.

get_least_proficient_competencies_for_template($templateid, $skip = 0, $limit = 0)   X-Ref
Get the list of competencies that were completed the least times (in completed plans) from a template.

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