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.

Template cohort persistent.

Copyright: 2015 Frédéric Massart - FMCorz.net
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 234 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: template_cohort  - X-Ref

Template cohort persistent.

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

return: array Where keys are the property names.

validate_cohortid($value)   X-Ref
Validate the cohort ID.

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

validate_templateid($value)   X-Ref
Validate the template ID.

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

get_missing_plans($templateid, $cohortid, $unlinkedaremissing = false)   X-Ref
Return an array of user IDs for which the plans are missing.

Plans are considered as missing when a member of a cohort does not have a plan created.
When the parameter $unlinkedaremissing is set to false, plans that were unlinked from
their template will be ignored so that we do not recreate unlinked plans endlessly.

This method ignores the due date of the template.

return: int[]   User IDs.
param: int     $templateid The template ID.
param: int     $cohortid The cohort ID.
param: boolean $unlinkedaremissing When true, unlinked plans are considered as missing.

get_relation($templateid, $cohortid)   X-Ref
Get a relation.

This does not perform any validation on the data passed. If the relation exists in the database
then it is loaded in a the model, if not then it is up to the developer to save the model.

return: template_cohort
param: int $templateid
param: int $cohortid

get_relations_by_templateid($templateid)   X-Ref
Get a relations by templateid.

This does not perform any validation on the data passed. If the relation exists in the database
then it is loaded in a the model, if not then it is up to the developer to save the model.

return: template_cohort[] array of template cohort
param: int $templateid

get_all_missing_plans($lastruntime = 0, $unlinkedaremissing = false)   X-Ref
Return an array of templates persistent with their missing userids.

Note that only cohorts associated with visible templates are considered,
as well as only templates with a due date in the future, or no due date.

return: array( array(
param: int $lastruntime  The last time the Cohort ssync task ran.
param: bool $unlinkedaremissing When true, unlinked plans are considered as missing.