Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

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.

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

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

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

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

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.

param: int $userid The user ID.
param: int $competencyid The competency ID.
param: int $planid The plan ID.
return: \core_competency\user_competency_plan

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

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

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

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

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

param: int $userid The user ID.
param: int $planid The plan ID.
param: array  $competenciesorids Limit search to those competencies, or competency IDs.
return: \core_competency\user_competency_plan[]

has_records_for_competency($competencyid)   X-Ref
Checks if a competency has user competency plan 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 plan record.

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

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

param: array $competencyids The competences IDs
return: boolean

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

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

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.

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