Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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.

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

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

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

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.

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

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.

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

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.

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

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.

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