original_string: public static function create_template(stdClass $record) {
          static::require_enabled();
          $template = new template(0, $record);
  
          // First we do a permissions check.
          if (!$template->can_manage()) {
              throw new required_capability_exception($template->get_context(), 'moodle/competency:templatemanage',
                  'nopermissions', '');
          }
  
          // OK - all set.
          $template = $template->create();
  
          // Trigger a template created event.
          \core\event\competency_template_created::create_from_template($template)->trigger();
  
          return $template;
      }
code: public static function create_template(stdClass $record) {
          static::require_enabled();
          $template = new template(0, $record);
  
          // First we do a permissions check.
          if (!$template->can_manage()) {
              throw new required_capability_exception($template->get_context(), 'moodle/competency:templatemanage',
                  'nopermissions', '');
          }
  
          // OK - all set.
          $template = $template->create();
  
          // Trigger a template created event.
          \core\event\competency_template_created::create_from_template($template)->trigger();
  
          return $template;
      }
code_tokens: public static function create_template ( stdClass $ record ) { static :: require_enabled ( ) ; $ template = new template ( 0 , $ record ) ; // First we do a permissions check. if ( ! $ template -> can_manage ( ) ) { throw new required_capability_exception ( $ template -> get_context ( ) , 'moodle/competency:templatemanage' , 'nopermissions' , '' ) ; } // OK - all set. $ template = $ template -> create ( ) ; // Trigger a template created event. \ core \ event \ competency_template_created :: create_from_template ( $ template ) -> trigger ( ) ; return $ template ; }
docstring: Create a learning plan template from a record containing all the data for the class.
  
  Requires moodle/competency:templatemanage capability.
  
  @param stdClass $record Record containing all the data for an instance of the class.
  @return template
docstring_tokens: Create a learning plan template from a record containing all the data for the class .