You are here

function questions_export_form in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/questions_export/questions_export.admin.inc \questions_export_form()

Implementation of hook_form form to upload questions

1 string reference to 'questions_export_form'
questions_export_menu in includes/questions_export/questions_export.module
Implementation of hook_menu

File

includes/questions_export/questions_export.admin.inc, line 16

Code

function questions_export_form() {
  $form = array();
  $form['#attributes'] = array(
    'enctype' => 'multipart/form-data',
  );
  $form['quiz_questions_export'] = array(
    '#type' => 'fieldset',
    '#title' => t('Export Questions'),
    '#description' => t('Quiz questions import allows to export question and save it out-side of drupal in a portable text file format. Export file can be used as backback or source to generate question in other drupal site.'),
  );
  $option = quiz_get_all_quiz_title();

  // $options is an array with nid as index and quiz node's title as value
  $form['quiz_questions_export']['quiz_node_title'] = array(
    '#type' => 'select',
    '#title' => t('Quiz'),
    '#options' => $option,
    '#description' => count($options) ? t('Select the quiz to export its question(s).') : t('No quiz contents where found. To !create_a_quiz go to Content Management -> Create Content -> Quiz.', array(
      '!create_a_quiz' => l(t('create a quiz'), 'node/add/quiz'),
    )),
    '#required' => TRUE,
  );
  $form['quiz_questions_export']['exporter'] = array(
    '#type' => 'select',
    '#title' => t('Export format'),
    '#options' => _questions_exporters(),
    '#description' => t('Select the data format to export into.'),
    '#required' => TRUE,
  );
  $form['quiz_questions_export']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Export'),
  );
  $form['quiz_questions_export']['#submit'][] = 'questions_export_form_submit';
  return $form;
}