You are here

function long_answer_update_7501 in Quiz 7.5

Add filtered input support for long answer rubrics and answers.

File

question_types/long_answer/long_answer.install, line 154
Long_answer questions install file.

Code

function long_answer_update_7501() {
  db_add_field('quiz_long_answer_node_properties', 'answer_text_processing', array(
    'type' => 'int',
    'size' => 'tiny',
    'description' => 'Whether or not to allow filtered text answers.',
  ));
  db_add_field('quiz_long_answer_node_properties', 'rubric_format', array(
    'type' => 'varchar',
    'length' => 255,
    'description' => 'Text format for the rubric text.',
  ));
  db_add_field('quiz_long_answer_user_answers', 'answer_format', array(
    'type' => 'varchar',
    'length' => 255,
    'description' => 'Text format for the answer text.',
  ));

  // Updating existing, which were all plain text.
  db_update('quiz_long_answer_user_answers')
    ->fields(array(
    'answer_format' => 'plain_text',
  ))
    ->execute();
  db_update('quiz_long_answer_node_properties')
    ->fields(array(
    'rubric_format' => 'plain_text',
    'answer_text_processing' => 0,
  ))
    ->execute();
  return t('Added text format selection for long answer rubrics and answers.');
}