function multichoice_schema in Quiz 6.5
Same name and namespace in other branches
- 8.6 question_types/quiz_multichoice/quiz_multichoice.install \multichoice_schema()
- 8.4 question_types/multichoice/multichoice.install \multichoice_schema()
- 8.5 question_types/quiz_multichoice/quiz_multichoice.install \multichoice_schema()
- 6.6 question_types/multichoice/multichoice.install \multichoice_schema()
- 6.2 multichoice.install \multichoice_schema()
- 6.3 question_types/multichoice/multichoice.install \multichoice_schema()
- 6.4 question_types/multichoice/multichoice.install \multichoice_schema()
- 7.6 question_types/multichoice/multichoice.install \multichoice_schema()
- 7 question_types/multichoice/multichoice.install \multichoice_schema()
- 7.4 question_types/multichoice/multichoice.install \multichoice_schema()
- 7.5 question_types/multichoice/multichoice.install \multichoice_schema()
Implementation of hook_schema().
File
- question_types/
multichoice/ multichoice.install, line 31 - Multichoice Install (a quiz question type)
Code
function multichoice_schema() {
/**
* Stores correct answers for multichoice quiz.
*/
// Create the quiz node user answers multichoice table.
$schema['quiz_multichoice_user_answers'] = array(
'fields' => array(
'question_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'question_vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'result_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'answer_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array(
'result_id',
'question_nid',
'question_vid',
'answer_id',
),
);
/**
* Stores user answers for multichoice quiz.
*/
// Create the quiz node answers multichoice table.
$schema['quiz_multichoice_answers'] = array(
'fields' => array(
'answer_id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
//'answer' => array( 'type' => 'varchar', 'length' => 255, 'not null' => TRUE),
'answer' => array(
'type' => 'text',
),
'feedback' => array(
'type' => 'text',
),
'result_option' => array(
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
),
'is_correct' => array(
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'answer_id',
),
);
// Default the "Show Author and Date" for this question type to OFF.
$temp_array = variable_get('theme_settings', '');
$temp_array['toggle_node_info_multichoice'] = 0;
variable_set('theme_settings', $temp_array);
return $schema;
}