original_string: public function save_question_options($question) {
          global $DB;
          $extraquestionfields = $this->extra_question_fields();
  
          if (is_array($extraquestionfields)) {
              $question_extension_table = array_shift($extraquestionfields);
  
              $function = 'update_record';
              $questionidcolname = $this->questionid_column_name();
              $options = $DB->get_record($question_extension_table,
                      array($questionidcolname => $question->id));
              if (!$options) {
                  $function = 'insert_record';
                  $options = new stdClass();
                  $options->$questionidcolname = $question->id;
              }
              foreach ($extraquestionfields as $field) {
                  if (property_exists($question, $field)) {
                      $options->$field = $question->$field;
                  }
              }
  
              $DB->{$function}($question_extension_table, $options);
          }
      }
code: public function save_question_options($question) {
          global $DB;
          $extraquestionfields = $this->extra_question_fields();
  
          if (is_array($extraquestionfields)) {
              $question_extension_table = array_shift($extraquestionfields);
  
              $function = 'update_record';
              $questionidcolname = $this->questionid_column_name();
              $options = $DB->get_record($question_extension_table,
                      array($questionidcolname => $question->id));
              if (!$options) {
                  $function = 'insert_record';
                  $options = new stdClass();
                  $options->$questionidcolname = $question->id;
              }
              foreach ($extraquestionfields as $field) {
                  if (property_exists($question, $field)) {
                      $options->$field = $question->$field;
                  }
              }
  
              $DB->{$function}($question_extension_table, $options);
          }
      }
code_tokens: public function save_question_options ( $ question ) { global $ DB ; $ extraquestionfields = $ this -> extra_question_fields ( ) ; if ( is_array ( $ extraquestionfields ) ) { $ question_extension_table = array_shift ( $ extraquestionfields ) ; $ function = 'update_record' ; $ questionidcolname = $ this -> questionid_column_name ( ) ; $ options = $ DB -> get_record ( $ question_extension_table , array ( $ questionidcolname => $ question -> id ) ) ; if ( ! $ options ) { $ function = 'insert_record' ; $ options = new stdClass ( ) ; $ options -> $ questionidcolname = $ question -> id ; } foreach ( $ extraquestionfields as $ field ) { if ( property_exists ( $ question , $ field ) ) { $ options -> $ field = $ question -> $ field ; } } $ DB -> { $ function } ( $ question_extension_table , $ options ) ; } }
docstring: Saves question-type specific options
  
  This is called by {@link save_question()} to save the question-type specific data
  @return object $result->error or $result->notice
  @param object $question  This holds the information from the editing form,
  it is not a standard question object.
docstring_tokens: Saves question - type specific options