You are here

quiz-report-form.tpl.php in Quiz 7.5

Themes the question report.

File

theme/quiz-report-form.tpl.php
View source
<?php

/**
 * @file
 * Themes the question report.
 */

/*
 * Available variables:
 * $form - FAPI array
 *
 * All questions are in form[x] where x is an integer.
 *
 * Useful values:
 * $form[x]['question']
 *   The question as a FAPI array (usually a form field of type "markup").
 * $form[x]['score']
 *   The users score on the current question.(FAPI array usually of type
 *   "markup" or "textfield").
 * $form[x]['max_score']
 *   The max score for the current question.(FAPI array of type "value").
 * $form[x]['response']
 *   The users response, usually a FAPI array of type markup.
 */
if (isset($form[0]['question'])) {
  ?>
  <h2><?php

  print t('Question results');
  ?></h2>
<?php

}
?>
<div class="quiz-report">
  <?php

foreach ($form as $key => &$sub_form) {
  if (is_numeric($key)) {
    if (!empty($sub_form['#no_report'])) {
      drupal_render($sub_form);
    }
    elseif (empty($sub_form['question'])) {
      print drupal_render($sub_form);
    }
  }
  else {
    continue;
  }
  if (!empty($sub_form['question']) && empty($sub_form['#no_report'])) {
    ?>
    <div class="quiz-report-row clearfix">
      <div class="quiz-report-question dt">
        <div class="quiz-report-question-header clearfix">
          <?php

    print drupal_render($sub_form['score_display']);
    ?>
          <h3><?php

    print t('Question');
    ?> <?php

    print $sub_form['display_number']['#value'];
    ?></h3>
        </div>
        <?php

    print drupal_render($sub_form['question']);
    ?>
      </div>
      <?php

    if (isset($sub_form['response'])) {
      ?>
        <div class="quiz-report-response dd">
          <h3 class="quiz-report-response-header"><?php

      print t('Response');
      ?></h3>
          <?php

      print drupal_render($sub_form['response']);
      ?>
        </div>
      <?php

    }
    ?>
      <div class="quiz-report-question-feedback dd">
        <?php

    print drupal_render($sub_form['question_feedback']);
    ?>
      </div>
      <div class="quiz-report-score-feedback dd">
        <?php

    print drupal_render($sub_form['score']);
    ?>
        <?php

    print drupal_render($sub_form['answer_feedback']);
    ?>
      </div>
    </div>
    <?php

  }
  ?>
  <?php

}
?>
  <div class="quiz-report-quiz-feedback dd">
    <?php

if (isset($form['quiz_feedback']) && $form['quiz_feedback']['#markup']) {
  ?>
      <h2><?php

  print t('Quiz feedback');
  ?></h2>
      <?php

  print drupal_render($form['quiz_feedback']);
  ?>
    <?php

}
?>
  </div>
</div>
<div class="quiz-score-submit"><?php

print drupal_render_children($form);
?></div>