original_string: public static function update_plan($plan) {
          global $PAGE;
  
          $params = self::validate_parameters(self::update_plan_parameters(), array('plan' => $plan));
  
          $params = $params['plan'];
  
          $plan = api::read_plan($params['id']);
          self::validate_context($plan->get_context());
          $output = $PAGE->get_renderer('core');
  
          $params = (object) $params;
          $result = api::update_plan($params);
          $exporter = new plan_exporter($result, ['template' => $plan->get_template()]);
          return $exporter->export($output);
      }
code: public static function update_plan($plan) {
          global $PAGE;
  
          $params = self::validate_parameters(self::update_plan_parameters(), array('plan' => $plan));
  
          $params = $params['plan'];
  
          $plan = api::read_plan($params['id']);
          self::validate_context($plan->get_context());
          $output = $PAGE->get_renderer('core');
  
          $params = (object) $params;
          $result = api::update_plan($params);
          $exporter = new plan_exporter($result, ['template' => $plan->get_template()]);
          return $exporter->export($output);
      }
code_tokens: public static function update_plan ( $ plan ) { global $ PAGE ; $ params = self :: validate_parameters ( self :: update_plan_parameters ( ) , array ( 'plan' => $ plan ) ) ; $ params = $ params [ 'plan' ] ; $ plan = api :: read_plan ( $ params [ 'id' ] ) ; self :: validate_context ( $ plan -> get_context ( ) ) ; $ output = $ PAGE -> get_renderer ( 'core' ) ; $ params = ( object ) $ params ; $ result = api :: update_plan ( $ params ) ; $ exporter = new plan_exporter ( $ result , [ 'template' => $ plan -> get_template ( ) ] ) ; return $ exporter -> export ( $ output ) ; }
docstring: Updates a new learning plan.
  
  @param array $plan Fields for the plan (id is required)
  @return mixed
docstring_tokens: Updates a new learning plan .