function theme_quiz_progress in Quiz 8.5
Same name and namespace in other branches
- 8.6 quiz.theme.inc \theme_quiz_progress()
- 8.4 quiz.pages.inc \theme_quiz_progress()
- 5.2 quiz.module \theme_quiz_progress()
- 5 quiz.module \theme_quiz_progress()
- 6.6 quiz.pages.inc \theme_quiz_progress()
- 6.2 quiz.pages.inc \theme_quiz_progress()
- 6.3 quiz.pages.inc \theme_quiz_progress()
- 6.4 quiz.pages.inc \theme_quiz_progress()
- 6.5 quiz.pages.inc \theme_quiz_progress()
- 7.6 quiz.pages.inc \theme_quiz_progress()
- 7 quiz.pages.inc \theme_quiz_progress()
- 7.4 quiz.pages.inc \theme_quiz_progress()
- 7.5 quiz.theme.inc \theme_quiz_progress()
Theme a progress indicator for use during a quiz.
Parameters
$question_number: The position of the current question in the sessions' array.
$num_of_question: The number of questions for this quiz as returned by quiz_get_number_of_questions().
Return value
Themed html.
2 theme calls to theme_quiz_progress()
- ajax_quiz_navigate_quiz in modules/
ajax_quiz/ ajax_quiz.module - AJAX callback for quiz submission.
- QuizQuestionController::take in src/
Controller/ QuizQuestionController.php - Take a quiz questions.
File
- ./
quiz.theme.inc, line 22 - quiz.theme.inc Quiz theme functions.
Code
function theme_quiz_progress($variables) {
drupal_add_js(drupal_get_path('module', 'quiz') . '/js/quiz.jumper.js');
$output = '';
$output .= '<div id="quiz-progress">';
$text = 'Page <span id="quiz-question-number">!x</span> of <span id="quiz-num-questions">@y</span>';
if ($variables['allow_jumping']) {
// Show jump form.
if ($variables['pager']) {
$output .= theme('quiz_pager', array(
'siblings' => \Drupal::config('quiz.settings')
->get('pager_siblings', 5),
'current' => $variables['current'],
'total' => count($variables['questions']),
));
}
else {
$selectbox = drupal_get_form('quiz_jumper_form', $variables['questions'], $variables['current']);
$output .= t($text, array(
'!x' => drupal_render($selectbox),
'@y' => count($variables['questions']),
));
}
}
else {
// Just text.
$output .= t($text, array(
'!x' => $variables['current'],
'@y' => count($variables['questions']),
));
}
$output .= '</div>' . "\n";
return $output;
}