function theme_opigno_quiz_take_summary in Opigno Quiz App 7
1 string reference to 'theme_opigno_quiz_take_summary'
File
- ./
opigno_quiz_app.module, line 1936 - Module file. Defines module hooks.
Code
function theme_opigno_quiz_take_summary($variables) {
$quiz = $variables['quiz'];
$questions = $variables['questions'];
$score = $variables['score'];
$summary = $variables['summary'];
$rid = $variables['rid'];
// Set the title here so themers can adjust.
drupal_set_title($quiz->title);
// Display overall result.
$output = '';
if (!empty($score['possible_score'])) {
if (!$score['is_evaluated']) {
if (user_access('score taken quiz answer')) {
$msg = t('Parts of this @quiz have not been evaluated yet. The score below is not final. <a class="self-score" href="!result_url">Click here</a> to give scores on your own.', array(
'@quiz' => QUIZ_NAME,
'!result_url' => url('node/' . $quiz->nid . '/results/' . $rid),
));
}
else {
$msg = t('Parts of this @quiz have not been evaluated yet. The score below is not final.', array(
'@quiz' => QUIZ_NAME,
));
}
drupal_set_message($msg, 'warning');
}
$output .= '<div id="quiz_score_possible">' . t('You got %num_correct of %question_count possible points.', array(
'%num_correct' => $score['numeric_score'],
'%question_count' => $score['possible_score'],
)) . '</div>' . "\n";
$output .= '<div id="quiz_score_percent">' . t('Your score: %score %', array(
'%score' => $score['percentage_score'],
)) . '</div>' . "\n";
}
if (isset($summary['passfail'])) {
$output .= '<div id="quiz_summary">' . $summary['passfail'] . '</div>' . "\n";
}
if (isset($summary['result'])) {
$output .= '<div id="quiz_summary">' . $summary['result'] . '</div>' . "\n";
}
// Get the feedback for all questions. These are included here to provide maximum flexibility for themers
if ($quiz->display_feedback) {
$form = drupal_get_form('quiz_report_form', $questions);
$output .= drupal_render($form);
}
$group = og_context('node');
$nextlink = "";
if (!empty($group['gid'])) {
global $user;
// Save the course NID for later.
$course_nid = $group['gid'];
// If the course is in a class that the user is part of, get the class
// context. Else, get the course context.
$classes = opigno_class_app_classes_of_course_that_user_is_part_of($group['gid'], $user->uid);
if (!empty($classes)) {
$class = key($classes);
$group = node_load($class);
}
else {
$group = node_load($group['gid']);
}
$continue = opigno_quiz_app_get_next_lesson_from_course($course_nid, $quiz->nid);
if (isset($continue)) {
$nextlink = l(t("To next lesson"), "node/" . $continue . "/take", array(
'attributes' => array(
'class' => array(
'opigno-quiz-action',
'action-element',
),
),
));
}
else {
$nextlink = l(t("Back to @type", array(
'@type' => $group->type,
)), "node/" . $group->nid, array(
'attributes' => array(
'class' => array(
'opigno-quiz-action',
'action-element',
),
),
));
}
}
return $output . '<div id="nextlink">' . $nextlink . '</div>';
}