You are here

function _quiz_get_question_row in Quiz 7

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

Helper function for theme_question_selection_table

Parameters

$sub_form: Form definition array for a filtered questions list

$id: Identifier used in $sub_form

Return value

table row Array defining a table row

See also

quiz_questions_form()

theme_question_selection_table()

1 call to _quiz_get_question_row()
theme_question_selection_table in ./quiz.admin.inc
Theme a question selection table, adding drag and drop support.

File

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

Code

function _quiz_get_question_row($sub_form, $id) {
  $question_types = _quiz_get_question_types();
  $type = $sub_form['types'][$id]['#markup'];

  // We add the class "hidden-class" to hide questions that haven't been added to the quiz yet.
  $hidden_class = $sub_form['stayers'][$id]['#default_value'] === 0 ? ' hidden-question' : '';
  $data_array = array(
    // The checkbox and the title
    drupal_render($sub_form['stayers'][$id]) . drupal_render($sub_form['titles'][$id]),
    $type,
    $sub_form['view_links'][$id]['#markup'] . '<SPAN CLASS="q-remove" STYLE="display:none"> | ' . $sub_form['remove_links'][$id]['#markup'] . '</SPAN>',
    isset($sub_form['revision'][$id]) ? drupal_render($sub_form['revision'][$id]) : t("Up to date"),
    drupal_render($sub_form['max_scores'][$id]),
  );
  if (isset($sub_form['compulsories'])) {
    $data_array[] = drupal_render($sub_form['compulsories'][$id]);
  }
  $data_array[] = drupal_render($sub_form['weights'][$id]);
  return array(
    'class' => array(
      'q-row draggable' . $hidden_class,
    ),
    'id' => 'q-' . $id,
    'data' => $data_array,
  );
}