public static function create_template($template) {
        global $PAGE;

        $params = self::validate_parameters(self::create_template_parameters(), array('template' => $template));
        $params = $params['template'];
        $context = self::get_context_from_params($params);
        self::validate_context($context);
        $output = $PAGE->get_renderer('core');

        unset($params['contextlevel']);
        unset($params['instanceid']);
        $params = (object) $params;
        $params->contextid = $context->id;

        $result = api::create_template($params);
        $exporter = new template_exporter($result);
        $record = $exporter->export($output);
        return $record;
    }
public static function create_template($template) {
        global $PAGE;

        $params = self::validate_parameters(self::create_template_parameters(), array('template' => $template));
        $params = $params['template'];
        $context = self::get_context_from_params($params);
        self::validate_context($context);
        $output = $PAGE->get_renderer('core');

        unset($params['contextlevel']);
        unset($params['instanceid']);
        $params = (object) $params;
        $params->contextid = $context->id;

        $result = api::create_template($params);
        $exporter = new template_exporter($result);
        $record = $exporter->export($output);
        return $record;
    }
public static function create_template ( $ template ) { global $ PAGE ; $ params = self :: validate_parameters ( self :: create_template_parameters ( ) , array ( 'template' => $ template ) ) ; $ params = $ params [ 'template' ] ; $ context = self :: get_context_from_params ( $ params ) ; self :: validate_context ( $ context ) ; $ output = $ PAGE -> get_renderer ( 'core' ) ; unset ( $ params [ 'contextlevel' ] ) ; unset ( $ params [ 'instanceid' ] ) ; $ params = ( object ) $ params ; $ params -> contextid = $ context -> id ; $ result = api :: create_template ( $ params ) ; $ exporter = new template_exporter ( $ result ) ; $ record = $ exporter -> export ( $ output ) ; return $ record ; }
Create a new learning plan template

@param array $template The list of fields for the template.
@return \stdClass Record of new template.
Create a new learning plan template