예제 #1
0
 /**
  * Count the user-completency-plans in the template, optionally filtered by proficiency.
  *
  * Requires moodle/competency:templateview capability at the system context.
  *
  * @param mixed $templateorid The id or the template.
  * @param mixed $proficiency If true, filter by proficiency, if false filter by not proficient, if null - no filter.
  * @return int
  */
 public static function count_user_competency_plans_for_template($templateorid, $proficiency = null)
 {
     static::require_enabled();
     $template = $templateorid;
     if (!is_object($template)) {
         $template = new template($template);
     }
     // First we do a permissions check.
     if (!$template->can_read()) {
         throw new required_capability_exception($template->get_context(), 'moodle/competency:templateview', 'nopermissions', '');
     }
     return user_competency_plan::count_records_for_template($template->get_id(), $proficiency);
 }