public static function create_plan($plan) {
        global $PAGE;

        $params = self::validate_parameters(self::create_plan_parameters(), array('plan' => $plan));
        $params = $params['plan'];

        $context = context_user::instance($params['userid']);
        self::validate_context($context);
        $output = $PAGE->get_renderer('core');

        $params = (object) $params;

        $result = api::create_plan($params);
        $exporter = new plan_exporter($result, array('template' => null));
        return $exporter->export($output);
    }
public static function create_plan($plan) {
        global $PAGE;

        $params = self::validate_parameters(self::create_plan_parameters(), array('plan' => $plan));
        $params = $params['plan'];

        $context = context_user::instance($params['userid']);
        self::validate_context($context);
        $output = $PAGE->get_renderer('core');

        $params = (object) $params;

        $result = api::create_plan($params);
        $exporter = new plan_exporter($result, array('template' => null));
        return $exporter->export($output);
    }
public static function create_plan ( $ plan ) { global $ PAGE ; $ params = self :: validate_parameters ( self :: create_plan_parameters ( ) , array ( 'plan' => $ plan ) ) ; $ params = $ params [ 'plan' ] ; $ context = context_user :: instance ( $ params [ 'userid' ] ) ; self :: validate_context ( $ context ) ; $ output = $ PAGE -> get_renderer ( 'core' ) ; $ params = ( object ) $ params ; $ result = api :: create_plan ( $ params ) ; $ exporter = new plan_exporter ( $ result , array ( 'template' => null ) ) ; return $ exporter -> export ( $ output ) ; }
Create a new learning plan.

@param array $plan List of fields for the plan.
@return array New plan record.
Create a new learning plan .