original_string: 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);
      }
code: 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);
      }
code_tokens: 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 ) ; }
docstring: Create a new learning plan.
  
  @param array $plan List of fields for the plan.
  @return array New plan record.
docstring_tokens: Create a new learning plan .