You are here

function quiz_generate_form in Quiz 8.6

Same name and namespace in other branches
  1. 8.5 quiz.devel.inc \quiz_generate_form()
  2. 7.6 quiz.devel.inc \quiz_generate_form()
  3. 7.5 quiz.devel.inc \quiz_generate_form()
  4. 6.x quiz.devel.inc \quiz_generate_form()

Form callback for devel_generate support.

1 string reference to 'quiz_generate_form'
quiz_menu in ./quiz.module
Implements hook_menu().

File

./quiz.devel.inc, line 6

Code

function quiz_generate_form($form, $form_state) {
  $quiz_options['quiz'] = 'Quiz';
  $form['quiz_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Quiz types'),
    '#options' => $quiz_options,
    '#default_value' => array(
      'quiz' => 'quiz',
    ),
    '#required' => TRUE,
    '#access' => FALSE,
  );
  $question_options = array();
  foreach (quiz_get_question_types() as $name => $question_type) {
    $question_options[$name] = $question_type['name'];
  }
  $form['quiz_question_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Question types'),
    '#options' => $question_options,
    '#default_value' => array_keys($question_options),
    '#required' => TRUE,
  );
  $form['quiz_limit'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of quizzes to generate'),
    '#default_value' => 50,
    '#size' => 10,
    '#required' => TRUE,
    '#description' => t('Quiz authors will be randomly assigned.'),
  );
  $form['quiz_question_limit'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of questions per quiz'),
    '#default_value' => 10,
    '#size' => 10,
    '#required' => TRUE,
    '#description' => t('Question authors will be randomly assigned.'),
  );
  $form['quiz_results'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of results per quiz'),
    '#default_value' => 50,
    '#size' => 10,
    '#required' => TRUE,
    '#description' => t('Results will be randomly assigned to users already in the system.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Generate'),
  );
  return $form;
}