/** * Count all the competencies in a learning plan template with no linked courses. * * @param template|int $templateorid The template or its ID. * @return int */ public static function count_competencies_in_template_with_no_courses($templateorid) { // First we do a permissions check. $template = $templateorid; if (!is_object($template)) { $template = new template($template); } if (!$template->can_read()) { throw new required_capability_exception($template->get_context(), 'moodle/competency:templateview', 'nopermissions', ''); } // OK - all set. return template_competency::count_competencies_with_no_courses($template->get_id()); }