function theme_quiz_results_browser_body in Quiz 8.4
Theme quiz_results_browser_body.
1 theme call to theme_quiz_results_browser_body()
- quiz_results_manage_results_form in ./
quiz.admin.inc - Form for searching after and manipulating results for a quiz
File
- ./
quiz.theme.inc, line 113 - Preprocessors and helper functions to make theming easier.
Code
function theme_quiz_results_browser_body(&$vars) {
$form = $vars['form'];
$html = '<tbody id="quiz-browser-body">';
// We need to separate the title and the checkbox. We make a custom options array...
$full_options = array();
foreach ($form['name']['#options'] as $key => $value) {
$full_options[$key] = $form['name'][$key];
$full_options[$key]['#title'] = '';
}
foreach ($form['name']['#options'] as $key => $value) {
$html .= '<tr class="quiz-results-browser-row" id="browser-' . $key . '">';
$html .= '<td valign="top">';
// Find nid and rid
$matches = array();
preg_match('/([0-9]+)-([0-9]+)/', $key, $matches);
$res_nid = $matches[1];
$res_rid = $matches[2];
$html .= '<span class = "container-inline" style = "white-space: nowrap;">' . drupal_render($full_options[$key]) . $value . '</span>';
$html .= '<div class = "quiz-hover-menu">' . $form['hover_menu'][$key]['#value'] . '</div>';
$html .= '</td><td valign="top">';
$html .= $form['started'][$key]['#value'];
$html .= '</td><td valign="top">';
$html .= $form['finished'][$key]['#value'];
if ($form['finished'][$key]['#value'] != t('In progress')) {
$html .= '<br/><em>(' . t('Duration') . ': ' . $form['duration'][$key]['#value'] . ')</em>';
}
$html .= '</td><td valign ="top">';
if (!is_numeric($form['score'][$key]['#value'])) {
$html .= $form['score'][$key]['#value'];
}
elseif ($form['evaluated'][$key]['#value'] == t('No')) {
$html .= t('Not evaluated');
}
else {
if (!empty($form['pass_rate'][$key]['#value']) && is_numeric($form['score'][$key]['#value'])) {
$pre_score = $form['score'][$key]['#value'] >= $form['pass_rate'][$key]['#value'] ? '<span class = "quiz-passed">' : '<span class = "quiz-failed">';
$post_score = $form['score'][$key]['#value'] >= $form['pass_rate'][$key]['#value'] ? ' %<br><em>' . t('Passed') . '</em></span>' : ' %<br><em>' . t('Failed') . '</em></span>';
}
else {
$pre_score = '';
$post_score = ' %';
}
$html .= $pre_score . $form['score'][$key]['#value'] . $post_score;
}
$html .= '</td><td valign="top">';
$html .= $form['evaluated'][$key]['#value'];
$html .= '</td>';
$html .= '</tr>';
}
$html .= '</tbody>';
return $html;
}