quiz.install in Quiz 8.6
Quiz install schema for installing the quiz module.
File
quiz.installView source
<?php
/**
* @file
* Quiz install schema for installing the quiz module.
*/
/**
* Implements hook_install().
*/
function quiz_install() {
// Grant default permissions to authenticated users, to take available quizzes
// and view their own results.
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
'view own quiz_result',
));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
'view any quiz',
));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
'access quiz',
));
}
/**
* Implements hook_schema().
*/
function quiz_schema() {
return;
$schema['quiz_terms'] = array(
'description' => 'Table storing what terms belongs to what quiz for categorized random quizzes',
'fields' => array(
'nid' => array(
'description' => 'The quiz ID of this quiz term.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'description' => 'The quiz version ID of this quiz term.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'weight' => array(
'description' => 'The terms weight decides the order of the terms',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'tid' => array(
'description' => 'Taxonomy term ID from which to pull questions.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'max_score' => array(
'description' => 'Max score for each question marked with this term.',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
),
'number' => array(
'description' => 'Number of questions to be drawn from this term.',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array(
'vid',
'tid',
),
'indexes' => array(
'version' => array(
'vid',
),
),
);
return $schema;
}
Functions
Name![]() |
Description |
---|---|
quiz_install | Implements hook_install(). |
quiz_schema | Implements hook_schema(). |