You are here

function quiz_admin_node_form in Quiz 7

Same name and namespace in other branches
  1. 8.4 quiz.admin.inc \quiz_admin_node_form()
  2. 6.4 quiz.admin.inc \quiz_admin_node_form()
  3. 7.6 quiz.admin.inc \quiz_admin_node_form()
  4. 7.4 quiz.admin.inc \quiz_admin_node_form()
  5. 7.5 quiz.admin.inc \quiz_admin_node_form()

Renders the quiz node form for the admin pages

This form is used to configure default values for the quiz node form

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

File

./quiz.admin.inc, line 261
Administrator interface for Quiz module.

Code

function quiz_admin_node_form($form, &$form_state) {

  // Create a dummy node to use as input for quiz_form
  $dummy_node = new stdClass();

  // def_uid is the uid of the default user holding the default values for the node form(no real user with this uid exists)
  $dummy_node->def_uid = variable_get('quiz_def_uid', 1);
  $additions = _quiz_get_node_defaults();
  foreach ($additions as $key => $value) {
    $dummy_node->{$key} = $value;
  }
  $form = quiz_form($dummy_node, $form_state);
  $form['direction'] = array(
    '#markup' => t('Here you can change the default quiz settings for new users.'),
    '#weight' => -10,
  );

  // unset values we can't or won't let the user edit default values for
  unset($form['#quiz_check_revision_access'], $form['title'], $form['body_field'], $form['taking']['aid'], $form['taking']['addons'], $form['quiz_availability']['quiz_open'], $form['quiz_availability']['quiz_close'], $form['resultoptions'], $form['number_of_random_questions']);
  $form['remember_settings']['#type'] = 'value';
  $form['remember_settings']['#default_value'] = TRUE;
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#submit' => array(
      'quiz_admin_node_form_submit',
    ),
  );
  return $form;
}