/** * Check if template has related data. * * @param int $templateid The id of the template to check. * @return boolean */ public static function template_has_related_data($templateid) { static::require_enabled(); // First we do a permissions check. $template = new template($templateid); if (!$template->can_read()) { throw new required_capability_exception($template->get_context(), 'moodle/competency:templateview', 'nopermissions', ''); } // OK - all set. return $template->has_plans(); }