function displayQuestion($q_no, $q_id, $theme, $scenario, $leadin, $q_type, $correct, $settings, $q_media, $q_media_width, $q_media_height, $options, $comments, $correct_buf, $display_method, $score_method, $labelcolor, $themecolor, $std, $reviewer_data, $type, $string, $language) { $configObject = Config::get_instance(); $cfg_root_path = $configObject->get('cfg_root_path'); if ($theme != '') { echo "<tr><td colspan=\"2\"><h1 style=\"color:{$themecolor}\">{$theme}</h1></td></tr>\n"; } echo "<tr>\n"; if ($q_type != 'extmatch' and $q_type != 'matrix') { if ($q_type == 'info') { echo "<td colspan=\"2\" style=\"padding-left:10px; padding-right:10px\">{$leadin}\n"; } else { if ($scenario != '') { echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$scenario}<br />\n"; echo $leadin; if ($q_media != '' and $q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'area') { echo "<p align=\"center\">" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } if ($q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'blank') { echo "<p>\n<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" style=\"margin-left:30px\">\n"; } } else { echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$leadin}\n"; if ($q_media != '' and $q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'area') { echo "<p align=\"center\">" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } if ($q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'blank') { echo "<p>\n<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" style=\"margin-left:30px\">\n"; } } } switch ($q_type) { case 'area': ?> <br /> <?php if ($configObject->get('cfg_interactive_qs') == 'html5') { //<!-- ======================== HTML5 part include find ================= --> echo "<canvas id='canvas" . $q_no . "' width='" . ($q_media_width + 2) . "' height='" . ($q_media_height + 1) . "'></canvas>\n"; echo "<div style='width:100%;text-align: left;' id='canvasbox'></div>\n"; echo "<script>\n"; echo "setUpQuestion(" . $q_no . ", 'q" . $q_no . "','" . $language . "', '" . $q_media . "', '" . $correct . "', '','','#FFC0C0','area','script');\n"; echo "</script>\n"; //<!-- ==================================================== --> } else { echo "<script>\n"; echo "write_string('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"" . ($q_media_width + 2) . "\" height=\"" . ($q_media_height + 1) . "\" id=\"externalinterfaceq" . $q_no . "_1\" align=\"top\">');\n"; echo "write_string('<param name=\"movie\" value=\"" . $configObject->get('cfg_root_path') . "/question/edit/area.swf\" />');\n"; echo "write_string('<param name=\"quality\" value=\"high\" />');\n"; echo "write_string('<param name=\"bgcolor\" value=\"#ffffff\" />');\n"; echo "write_string('<param name=\"play\" value=\"true\" />');\n"; echo "write_string('<param name=\"loop\" value=\"true\" />');\n"; echo "write_string('<param name=\"wmode\" value=\"opaque\" />');\n"; echo "write_string('<param name=\"scale\" value=\"showall\" />');\n"; echo "write_string('<param name=\"menu\" value=\"true\" />');\n"; echo "write_string('<param name=\"devicefont\" value=\"false\" />');\n"; echo "write_string('<param name=\"salign\" value=\"top\" />');\n"; echo "write_string('<param name=\"allowScriptAccess\" value=\"sameDomain\" />');\n"; echo "write_string('<!--[if !IE]>-->');\n"; echo "write_string('<object type=\"application/x-shockwave-flash\" data=\"" . $configObject->get('cfg_root_path') . "/question/edit/area.swf\" id=\"externalinterfaceq" . $q_no . "_2\" width=\"" . ($q_media_width + 2) . "\" height=\"" . ($q_media_height + 1) . "\">');\n"; echo "write_string('<param name=\"movie\" value=\"" . $configObject->get('cfg_root_path') . "/question/edit/area.swf\" />');\n"; echo "write_string('<param name=\"quality\" value=\"high\" />');\n"; echo "write_string('<param name=\"bgcolor\" value=\"#ffffff\" />');\n"; echo "write_string('<param name=\"play\" value=\"true\" />');\n"; echo "write_string('<param name=\"loop\" value=\"true\" />');\n"; echo "write_string('<param name=\"wmode\" value=\"opaque\" />');\n"; echo "write_string('<param name=\"scale\" value=\"showall\" />');\n"; echo "write_string('<param name=\"menu\" value=\"true\" />');\n"; echo "write_string('<param name=\"devicefont\" value=\"false\" />');\n"; echo "write_string('<param name=\"salign\" value=\"top\" />');\n"; echo "write_string('<param name=\"allowScriptAccess\" value=\"sameDomain\" />');\n"; echo "write_string('<!--<![endif]-->');\n"; echo "write_string('<a href=\"https://www.adobe.com/go/getflash\"> <img src=\"https://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Get Adobe Flash player\" /></a>');\n"; echo "write_string('<!--[if !IE]>-->');\n"; echo "write_string('</object>');\n"; echo "write_string('<!--<![endif]-->');\n"; echo "write_string('</object>');\n"; echo "sendTextToAS3('{$language}', 'q{$q_no}', 1, '../media/" . $q_media . "', '" . $correct . "', '');\n"; echo "</script>\n<br />"; } ?> <input type="hidden" name="q<?php echo $q_no; ?> " id="q<?php echo $q_no; ?> " /> <?php break; case 'blank': $options[0] = preg_replace("| mark=\"([0-9]{1,3})\"|", "", $options[0]); $options[0] = preg_replace("| size=\"([0-9]{1,3})\"|", "", $options[0]); $blank_details = array(); $blank_details = explode('[blank', $options[0]); $array_size = count($blank_details); $blank_count = 0; while ($blank_count < $array_size) { if (strpos($blank_details[$blank_count], '[/blank]') === false) { echo $blank_details[$blank_count]; } else { $end_start_tag = strpos($blank_details[$blank_count], ']'); $start_end_tag = strpos($blank_details[$blank_count], '[/blank]'); $blank_options = substr($blank_details[$blank_count], $end_start_tag + 1, $start_end_tag - 1); $remainder = substr($blank_details[$blank_count], $start_end_tag + 8); if ($display_method == 'dropdown') { echo '<select>'; $options_array = array(); $options_array = explode(',', $blank_options); $i = 0; foreach ($options_array as $individual_blank_option) { $individual_blank_option = trim($individual_blank_option); if ($i == 0) { echo '<option value="" selected="selected">' . $individual_blank_option . '</option>'; } else { echo '<option value="">' . $individual_blank_option . '</option>'; } $i++; } echo '</select>'; } else { // Correct answer. $correct_options = explode(',', $blank_options); echo '<input type="text" size="10" value="' . $correct_options[0] . '" />'; } echo $remainder; } $blank_count++; } break; case 'calculation': break; case 'dichotomous': $tmp_std_array = explode(',', $std); $std_part = 0; if ($score_method == 'YN_Positive') { $true_label = 'Yes'; $false_label = 'No'; } else { $true_label = 'True'; $false_label = 'False'; } $i = 0; foreach ($options as $individual_option) { $i++; if ($correct_buf[$i - 1] == 't') { echo "<tr><td style=\"font-weight:bold\">{$true_label}</td><td>{$individual_option}</td></tr>\n"; } else { echo "<tr><td style=\"font-weight:bold\">{$false_label}</td><td>{$individual_option}</td></tr>\n"; } } break; case 'labelling': $tmp_std_array = explode(',', $std); $std_part = 0; $tmp_std_array = explode(',', $std); $std_part = 0; $max_col1 = 0; $max_col2 = 0; $tmp_first_split = explode(';', $correct); $tmp_second_split = explode('|', $tmp_first_split[11]); foreach ($tmp_second_split as $ind_label) { $label_parts = explode('$', $ind_label); if (isset($label_parts[4]) and trim($label_parts[4]) != '') { if ($label_parts[0] < 10) { $max_col1 = $label_parts[0]; } else { $max_col2 = $label_parts[0]; } } } $max_col2 -= 10; $max_label = max($max_col1, $max_col2); $tmp_height = $q_media_height; if ($tmp_height < $max_label * 55) { $tmp_height = $max_label * 55; } $correct = str_replace('"', '"', $correct); $correct = str_replace("'", ''', $correct); ?> <div align="center"> <?php require_once '../classes/configobject.class.php'; $configObject = Config::get_instance(); if ($configObject->get('cfg_interactive_qs') == 'html5') { //<!-- ======================== HTML5 part rep disc ================= --> echo "<canvas id='canvas" . $q_no . "' width='" . ($q_media_width + 220) . "' height='" . $tmp_height . "'></canvas>\n"; echo "<br /><div style='width:100%;text-align: left;' id='canvasbox'></div>\n"; echo "<script>\n"; echo "setUpQuestion(" . $q_no . ", 'flash" . $q_no . "', '" . $language . "', '" . $q_media . "', '" . trim($correct) . "', '', '','#FFC0C0','labelling','analysis');\n"; echo "</script>\n"; //<!-- ==================================================== --> } else { echo "<script>\n"; echo "function swfLoaded" . $q_no . "(message) {\n"; echo "var num = message.substring(5,message.length);\n"; echo "setUpFlash(num, message, '" . $language . "', '" . $q_media . "', '" . trim($correct) . "', '','#FFC0C0');}\n"; echo "write_string('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" id=\"flash" . $q_no . "\" width=\"" . ($q_media_width + 250) . "\" height=\"" . $tmp_height . "\" align=\"middle\">');\n"; echo "write_string('<param name=\"allowScriptAccess\" value=\"always\" />');\n"; echo "write_string('<param name=\"movie\" value=\"" . $configObject->get('cfg_root_path') . "/reports/label_analysis.swf\" />');\n"; echo "write_string('<param name=\"quality\" value=\"high\" />');\n"; echo "write_string('<param name=\"bgcolor\" value=\"#ffffff\" />');\n"; echo "write_string('<embed src=\"" . $configObject->get('cfg_root_path') . "/reports/label_analysis.swf\" quality=\"high\" bgcolor=\"#ffffff\" width=\"" . ($q_media_width + 250) . "\" height=\"" . $tmp_height . "\" swliveconnect=\"true\" id=\"flash" . $q_no . "\" name=\"flash" . $q_no . "\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" />');\n"; echo "write_string('</object>');\n"; echo "</script>\n"; } ?> </div> <br /> <?php break; case 'hotspot': $tmp_width = $q_media_width + 301; if ($tmp_width < 375) { $tmp_width = 375; } $tmp_height = $q_media_height + 30; ?> <div> <?php if ($configObject->get('cfg_interactive_qs') == 'html5') { //"<!-- ======================== HTML5 part include finf ================= --> echo "<canvas id='canvas" . $q_no . "' width='" . $tmp_width . "' height='" . $tmp_height . "'></canvas>\n"; echo "<br /><div style='width:100%;text-align: left;' id='canvasbox'></div>\n"; echo "<script>\n"; echo "setUpQuestion(" . $q_no . ", 'flash" . $q_no . "', '" . $language . "', '" . $q_media . "', '" . str_replace(' ', ' ', $correct) . "', '', '0,0,0000000000000','#FFC0C0','hotspot','script');\n"; echo "</script>\n"; //<!-- ==================================================== --> } else { echo "<script>\n"; echo "function swfLoaded" . $q_no . "(message) {\n"; echo "var num = message.substring(5,message.length);\n"; echo "setUpFlash(num, message, '" . $language . "', '" . $q_media . "', '" . str_replace(' ', ' ', $correct) . "', '', '1,1,0000000000000','#FFC0C0');}\n"; echo "write_string('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" id=\"flash" . $q_no . "\" width=\"" . $tmp_width . "\" height=\"" . $tmp_height . "\" align=\"middle\">');\n"; echo "write_string('<param name=\"allowScriptAccess\" value=\"always\" />');\n"; echo "write_string('<param name=\"movie\" value=\"" . $configObject->get('cfg_root_path') . "/paper/hotspot_answer.swf\" />');\n"; echo "write_string('<param name=\"quality\" value=\"high\" />');\n"; echo "write_string('<param name=\"bgcolor\" value=\"#ffffff\" />');\n"; echo "write_string('<embed src=\"" . $configObject->get('cfg_root_path') . "/paper/hotspot_answer.swf\" quality=\"high\" bgcolor=\"white\" width=\"" . $tmp_width . "\" height=\"" . $tmp_height . "\" swliveconnect=\"true\" id=\"flash" . $q_no . "\" name=\"flash" . $q_no . "\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" />');\n"; echo "write_string('</object>');\n"; echo "</script>\n"; } ?> </div> <?php break; case 'mcq': $i = 0; foreach ($options as $individual_option) { $i++; if ($correct == $i) { echo "<tr><td><input type=\"radio\" checked=\"checked\" /></td><td>{$individual_option}</td></tr>\n"; } else { echo "<tr><td><input type=\"radio\" /></td><td>{$individual_option}</td></tr>\n"; } } break; case 'true_false': if ($correct == 't') { echo "<tr><td><input type=\"radio\" checked=\"checked\" /></td><td>True</td></tr>\n"; echo "<tr><td><input type=\"radio\" /></td><td>False</td></tr>\n"; } else { echo "<tr><td><input type=\"radio\" /></td><td>True</td></tr>\n"; echo "<tr><td><input type=\"radio\" checked=\"checked\" /></td><td>False</td></tr>\n"; } break; case 'mrq': $tmp_std_array = explode(',', $std); $i = 0; $correct_stems = 0; foreach ($options as $individual_option) { $i++; if ($correct_buf[$i - 1] == 'y') { echo "<tr><td><input type=\"checkbox\" checked=\"checked\" /></td><td>{$individual_option}</td></tr>\n"; } else { echo "<tr><td><input type=\"checkbox\" /></td><td>{$individual_option}</td></tr>\n"; } } break; case 'rank': $tmp_std_array = explode(',', $std); $std_part = 0; $rank_no = 0; foreach ($correct_buf as $individual_correct) { if ($individual_correct > $rank_no and $individual_correct < 9990) { $rank_no = $individual_correct; } } $i = 0; foreach ($options as $individual_option) { $i++; echo "<tr><td><select><option value=\"\"></option>"; for ($a = 1; $a <= $rank_no; $a++) { if ($correct_buf[$i - 1] == $a) { echo '<option value="" selected="selected">' . displayRank($a, $string) . '</option>'; } else { echo '<option value="">' . displayRank($a, $string) . '</option>'; } } echo "</select></td><td>{$individual_option}</td></tr>\n"; } break; case 'textbox': $settings = json_decode($settings, true); if (isset($settings['terms'])) { $correct_answers = explode(';', $settings['terms']); foreach ($correct_answers as $single_answer) { $answer_count[$single_answer] = 0; } } break; } if ($q_type != 'info' and $q_type != 'blank' and $q_type != 'labelling' and $q_type != 'hotspot') { echo "</table></p>\n"; } } elseif ($q_type == 'matrix') { $matching_scenarios = explode('|', $scenario); $correct_answers = explode('|', $correct); echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$leadin}\n"; echo '<ol type="i">'; $i = 0; echo '<table cellpadding="2" cellspacing="0" border="1" class="matrix">'; echo "<tr>\n<td colspan=\"2\"> </td>"; foreach ($options as $single_option) { echo '<td>' . $single_option . '</td>'; } echo "<tr>\n"; $row_no = 0; foreach ($matching_scenarios as $single_scenario) { if (trim($single_scenario) != '') { echo "<tr>\n"; echo '<td align="right">' . chr(65 + $row_no) . '.</td><td>' . $single_scenario . '</td>'; $answer_no = 1; $col_no = 1; foreach ($options as $single_option) { if ($correct_answers[$row_no] == $col_no) { echo '<td><div align="center"><input type="radio" name="q' . $q_no . '_' . $row_no . '" value="' . $answer_no . '" checked /></div></td>'; } else { echo '<td><div align="center"><input type="radio" name="q' . $q_no . '_' . $row_no . '" value="' . $answer_no . '" /></div></td>'; } $answer_no++; $col_no++; } echo "</tr>\n"; $row_no++; } } echo '</table>'; echo "</ol>\n</td></tr>\n"; } elseif ($q_type == 'extmatch') { $matching_scenarios = explode('|', $scenario); $matching_media = explode('|', $q_media); $tmp_media_width_array = explode('|', $q_media_width); $tmp_media_height_array = explode('|', $q_media_height); $tmp_answers_array = explode('|', $correct_buf[0]); $tmp_std_array = explode(',', $std); $std_part = 0; array_unshift($matching_scenarios, ''); $max_scenarios = max(count($matching_scenarios), count($matching_media)); $scenario_no = 0; for ($part_id = 1; $part_id < $max_scenarios; $part_id++) { if (isset($matching_scenarios[$part_id]) and trim(strip_tags($matching_scenarios[$part_id], '<img>')) != '' or isset($matching_media[$part_id]) and $matching_media[$part_id] != '') { $scenario_no++; } } echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$leadin}\n<ol type=\"A\">"; if ($matching_media[0] != '') { echo "<div align=\"center\">" . display_media($matching_media[0], $tmp_media_width_array[0], $tmp_media_height_array[0], '') . "</div>\n"; } for ($i = 1; $i <= $scenario_no; $i++) { echo "<li>\n"; if (isset($matching_media[$i]) and $matching_media[$i] != '') { echo "<div>" . display_media($matching_media[$i], $tmp_media_width_array[$i], $tmp_media_height_array[$i], '') . "</div>\n"; } if ($matching_scenarios[$i]) { echo $matching_scenarios[$i] . '<br />'; } $option_no = 1; $specific_answers = array(); $specific_answers = explode('$', $tmp_answers_array[$i - 1]); if (count($specific_answers) > 1) { echo '<select multiple="multiple" size="10">'; } else { echo '<select>'; } foreach ($options as $individual_option) { $answer_match = false; for ($x = 0; $x < count($specific_answers); $x++) { if ($option_no == $specific_answers[$x]) { $answer_match = true; } } if ($answer_match == true) { echo "<option value=\"\" selected=\"selected\">{$individual_option}</option>\n"; } else { echo "<option value=\"\">{$individual_option}</option>\n"; } $option_no++; } echo "</select><br /> </li>\n"; } echo "</ol>\n"; } echo "</td></tr>\n"; // Display comments here. if ($q_type != 'info') { echo displayComments($q_id, $comments, $q_type, $q_no, $reviewer_data, $type, $string, $language); } echo "<tr><td colspan=\"2\"> </td></tr>\n"; }
function display_question($question, &$question_no, $answers, $string) { $question_no++; if ($question['scenario'] != '') { echo "<tr><td class=\"q_no\">" . $question_no . ". </td><td style=\"background-color:#E4EEFC; border-bottom:1px solid #B5C4DF; font-weight:bold\">" . $string['clinicalvignette'] . "</td></tr>\n"; echo '<tr><td style="vertical-align:top; text-align:right"></td><td>'; if ($question['notes'] != '') { echo '<p class="note"><img src="../artwork/notes_icon.gif" width="16" height="16" alt="Note" /> <strong>' . $string['note'] . '</strong> ' . $question['notes'] . '</p>'; } echo $question['scenario'] . "<br />\n<br />"; $li_set = 1; } if ($question['q_media'] != '') { if ($li_set == 0) { echo '<tr><td class="q_no">' . $question_no . '. </td><td>'; } echo '<p style="text-align:center">' . display_media($question['q_media'], $question['q_media_width'], $question['q_media_height'], '') . "</p>\n"; $li_set = 1; } $sct_parts = explode('~', $question['leadin']); $sct_titles = array(1 => 'hypothesis', 2 => 'investigation', 3 => 'prescription', 4 => 'intervention', 5 => 'treatment'); echo '<table cellpadding="2" cellspacing="0" border="0" style="width:100%">'; echo "<tr><td style=\"width:49%; background-color:#E4EEFC; border-bottom:1px solid #B5C4DF; font-weight:bold\">" . $string[$sct_titles[$question['display_method']]] . "</td><td style=\"width:2%\"> </td><td style=\"width:49%; background-color:#E4EEFC; border-bottom:1px solid #B5C4DF; font-weight:bold\">" . $string['newinformation'] . "</td></tr>\n"; echo "<tr><td style=\"width:49%; vertical-align:top\">" . $sct_parts[0] . "</td><td style=\"width:2%\"> </td><td style=\"width:49%; vertical-align:top\">" . $sct_parts[1] . "</td></tr>\n"; echo "</table>\n"; echo '<p><strong>' . $string['sct_msg' . $question['display_method']] . '</strong></p>'; echo '<blockquote><table cellpadding="2" cellspacing="0" border="0">'; $part_id = 0; foreach ($question['options'] as $option_text) { $part_id++; if (isset($answers[$question['q_id']]['answer']) and $part_id == $answers[$question['q_id']]['answer']) { echo "<tr><td><input type=\"radio\" name=\"q" . $question_no . "\" value=\"{$part_id}\" checked /></td><td>{$option_text}</td></tr>\n"; } else { echo "<tr><td><input type=\"radio\" name=\"q" . $question_no . "\" value=\"{$part_id}\" /></td><td>{$option_text}</td></tr>\n"; } } echo "</table>\n</blockquote>\n"; echo "<span style=\"color:#808080\">" . $string['briefreasonwhy'] . "</span><br /><textarea name=\"reason{$question_no}\" cols=\"100\" rows=\"3\" />"; if (isset($answers[$question['q_id']]['reason'])) { echo $answers[$question['q_id']]['reason']; } echo "</textarea>\n"; echo "</td></tr>\n"; echo "<tr><td colspan=\"2\"> </td></tr>\n"; }
echo $correct_f; ?> /> <label for="option_correct<?php echo $index; ?> _f" class="heavy dichotomous-false"><?php echo $labels['false']; ?> </label> </td> </tr> <?php if ($option->id != -1) { $media = $option->get_media(); if ($media['filename'] != '') { $current_media_html = display_media($media['filename'], $media['width'], $media['height'], '', $index, $locked); ?> <tr<?php echo $alt_c; ?> > <th><?php echo $string['current'] . ' ' . $string['media']; ?> </th> <td><?php echo $current_media_html; ?> </td> <td> </td> </tr>
function display_question($question, &$question_no, $reviews, &$string, $db) { $question_no++; if ($question['scenario'] != '') { echo "<tr><td class=\"q_no\">" . $question_no . ". </td><td style=\"background-color:#E4EEFC; border-bottom:1px solid #B5C4DF; font-weight:bold; padding:2px; color:#000040\">{$string['clinicalvignette']}</td></tr>\n"; echo '<tr><td style="vertical-align:top; text-align:right"></td><td>'; if ($question['notes'] != '') { echo '<p class="note"><img src="../artwork/notes_icon.gif" width="16" height="16" alt="' . ucwords($string['note']) . '" /> <strong>' . $string['note'] . ':</strong> ' . $question['notes'] . '</p>'; } echo $question['scenario'] . "<br />\n<br />"; $li_set = 1; } if ($question['q_media'] != '') { if ($li_set == 0) { echo '<tr><td class="q_no">' . $question_no . '. </td><td>'; } echo '<p align="center">' . display_media($question['q_media'], $question['q_media_width'], $question['q_media_height'], '') . "</p>\n"; $li_set = 1; } $sct_parts = explode('~', $question['leadin']); echo '<table cellpadding="2" cellspacing="0" border="0" style="width:100%">'; $sct_titles = array(1 => $string['hypothesis'], 2 => $string['investigation'], 3 => $string['prescription'], 4 => $string['intervention'], 5 => $string['treatment']); echo "<tr><td style=\"width:49%; background-color:#E4EEFC; border-bottom:1px solid #B5C4DF; font-weight:bold\">" . $sct_titles[$question['display_method']] . "</td><td style=\"width:2%\"> </td><td style=\"width:49%; background-color:#E4EEFC; border-bottom:1px solid #B5C4DF; font-weight:bold\">{$string['newinformation']}</td></tr>\n"; echo "<tr><td style=\"width:49%; vertical-align:top\">" . $sct_parts[0] . "</td><td style=\"width:2%\"> </td><td style=\"width:49%; vertical-align:top\">" . $sct_parts[1] . "</td></tr>\n"; echo "</table>\n"; echo '<p><strong>'; echo $string['thenthis'] . ' '; echo mb_strtolower($sct_titles[$question['display_method']], 'UTF-8'); echo ' ' . $string['becomes'] . ':'; echo '</strong></p>'; echo '<blockquote><table cellpadding="2" cellspacing="0" border="0">'; $no_experts = 0; $max_experts = 0; for ($i = 1; $i <= count($question['options']); $i++) { if (isset($reviews[$question['q_id']][$i])) { $no_experts += $reviews[$question['q_id']][$i]; if ($reviews[$question['q_id']][$i] > $max_experts) { $max_experts = $reviews[$question['q_id']][$i]; } } } $part_id = 0; foreach ($question['options'] as $optionID => $option_text) { $part_id++; echo "<tr><td><input type=\"radio\" name=\"q" . $question_no . "\" value=\"{$part_id}\" /></td><td style=\"color:#808080\">"; if (isset($reviews[$question['q_id']][$part_id])) { $review_no = $reviews[$question['q_id']][$part_id]; } else { $review_no = 0; } echo $review_no . ' ' . $string['outof'] . ' ' . $no_experts; echo "</td><td>{$option_text}</td></tr>\n"; if (isset($_POST['submit'])) { saveResponseData($optionID, $review_no, $max_experts, $db); } } echo "</table>\n</blockquote>\n"; echo "<span style=\"color:#808080\">{$string['briefreasonwhy']}</span><br /><ul>"; if (isset($reviews[$question['q_id']]) and count($reviews[$question['q_id']]['reason']) > 0) { foreach ($reviews[$question['q_id']]['reason'] as $comment) { if (trim($comment) != '') { echo "<li>{$comment}</li>\n"; } } } else { echo "<li>{$string['nocomments']}</li>\n"; } echo "</ul></td></tr>\n"; echo "<tr><td colspan=\"2\"> </td></tr>\n"; }
function displayQuestion($q_no, $q_id, $theme, $scenario, $leadin, $q_type, $correct, $q_media, $q_media_width, $q_media_height, $options, $log, $correct_buf, $screen, $candidates) { global $old_likert_scale, $old_score_method, $old_display_method, $table_on, $string; if ($q_type != 'likert' and $q_type != 'textbox' and $table_on == 1) { echo "</table>\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; $old_likert_scale = ''; } if ($q_type != 'textbox') { if ($theme != '') { $cols = substr_count($old_likert_scale, '|'); if ($cols > 0) { $cols += 5; } else { $cols = 2; } echo "<tr><td colspan=\"{$cols}\"><h1 style=\"marging-left:10px\">{$theme}</h1></td></tr>\n"; $old_likert_scale = ''; } if ($q_type != 'likert') { echo "<tr>\n"; } } if ($q_type != 'extmatch' and $q_type != 'matrix' and $q_type != 'textbox') { if ($scenario != '' and $q_type != 'likert') { echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$scenario}<br /><br />\n"; echo $leadin; if ($q_media != '' and $q_type != 'hotspot' and $q_type != 'labelling') { echo "<p align=\"center\">" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } if ($q_type != 'hotspot' and $q_type != 'labelling') { echo "<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; } } elseif ($q_type != 'likert') { echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$leadin}\n"; if ($q_media != '' and $q_type != 'hotspot' and $q_type != 'labelling') { echo "<p align=\"center\">" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } if ($q_type != 'hotspot' and $q_type != 'labelling') { echo "<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; } } switch ($q_type) { case 'blank': echo '<p>'; $blank_details = array(); $blank_details = explode('[blank', $options[0]); $array_size = count($blank_details); $blank_count = 0; while ($blank_count < $array_size) { if (strpos($blank_details[$blank_count], '[/blank]') === false) { echo $blank_details[$blank_count]; } else { $end_start_tag = strpos($blank_details[$blank_count], ']'); $start_end_tag = strpos($blank_details[$blank_count], '[/blank]'); $blank_options = substr($blank_details[$blank_count], $end_start_tag + 1, $start_end_tag - 1); $remainder = substr($blank_details[$blank_count], $start_end_tag + 8); echo '<span style="color:#800000; font-weight:bold">[blank]</span>'; $options_array = array(); $options_array = explode(',', $blank_options); $i = 0; foreach ($options_array as $individual_blank_option) { if ($log[$screen][$q_id][$blank_count + 1][$individual_blank_option] == '') { $log[$screen][$q_id][$blank_count + 1][$individual_blank_option] = 0; } if ($i == 0) { echo '<strong>' . $individual_blank_option . '=' . $log[$screen][$q_id][$blank_count + 1][$individual_blank_option] . '</strong>'; } else { echo ', ' . $individual_blank_option . '=' . $log[$screen][$q_id][$blank_count + 1][$individual_blank_option]; } $i++; } echo '<span style="color:#800000; font-weight:bold">[/blank]</span>' . $remainder; } $blank_count++; } echo '</p>'; break; case 'dichotomous': if ($old_display_method == 'YN_Positive' or $old_display_method == 'YN_NegativeAbstain') { echo "<tr><td style=\"font-weight:bold; text-align:center\">" . $string['yes'] . "</td><td style=\"font-weight:bold; text-align:center\">" . $string['no'] . "</td><td style=\"font-weight:bold; text-align:center\">" . $string['abstain'] . "</td><td></td></tr>\n"; } else { echo "<tr><td style=\"font-weight:bold; text-align:center\">" . $string['true'] . "</td><td style=\"font-weight:bold; text-align:center\">" . $string['false'] . "</td><td style=\"font-weight:bold; text-align:center\">" . $string['abstain'] . "</td><td></td></tr>\n"; } $i = 0; foreach ($options as $individual_option) { $i++; if ($log[$screen][$q_id][$i]['u'] == '') { $log[$screen][$q_id][$i]['u'] = 0; } if ($log[$screen][$q_id][$i]['t'] == '') { $log[$screen][$q_id][$i]['t'] = 0; } if ($log[$screen][$q_id][$i]['f'] == '') { $log[$screen][$q_id][$i]['f'] = 0; } if ($correct_buf[$i - 1] == 't') { echo "<tr><td class=\"figures\">" . $log[$screen][$q_id][$i]['t'] . " (" . round($log[$screen][$q_id][$i]['t'] / $candidates * 100) . "%)</td><td class=\"figures\">" . $log[$screen][$q_id][$i]['f'] . " (" . round($log[$screen][$q_id][$i]['f'] / $candidates * 100) . "%)</td><td class=\"figures\">" . $log[$screen][$q_id][$i]['u'] . " (" . round($log[$screen][$q_id][$i]['u'] / $candidates * 100) . "%)</td><td>{$individual_option}</td></tr>\n"; } elseif ($correct_buf[$i - 1] == 'f') { echo "<tr><td class=\"figures\">" . $log[$screen][$q_id][$i]['t'] . " (" . round($log[$screen][$q_id][$i]['t'] / $candidates * 100) . "%)</td><td class=\"figures\">" . $log[$screen][$q_id][$i]['f'] . " (" . round($log[$screen][$q_id][$i]['f'] / $candidates * 100) . "%)</td><td class=\"figures\">" . $log[$screen][$q_id][$i]['u'] . " (" . round($log[$screen][$q_id][$i]['u'] / $candidates * 100) . "%)</td><td>{$individual_option}</td></tr>\n"; } else { echo "<tr><td class=\"figures\">" . $log[$screen][$q_id][$i]['t'] . " (" . round($log[$screen][$q_id][$i]['t'] / $candidates * 100) . "%)</td><td class=\"figures\">" . $log[$screen][$q_id][$i]['f'] . " (" . round($log[$screen][$q_id][$i]['f'] / $candidates * 100) . "%)</td><td class=\"figures\">" . $log[$screen][$q_id][$i]['u'] . " (" . round($log[$screen][$q_id][$i]['u'] / $candidates * 100) . "%)</td><td>{$individual_option}</td></tr>\n"; } } break; case 'labelling': ?> <div align="center"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="<?php echo $q_media_width + 35; ?> " height="<?php echo $q_media_height; ?> " id="label_answer" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="label_analysis.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="FlashVars" value="imageName=<?php echo $q_media; ?> &labels=<?php echo $correct; ?> " /> <embed src="label_analysis.swf" FlashVars="imageName=<?php echo $q_media; ?> &labels=<?php echo $correct; ?> " quality="high" bgcolor="#ffffff" width="<?php echo $q_media_width + 35; ?> " height="<?php echo $q_media_height; ?> " name="label_answer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> </div> <br /> <?php echo "<p>\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; $i = 1; foreach ($correct_buf as $individual_coord) { echo "<tr><td colspan=\"3\">Placeholder " . chr($i + 64) . ".</td></tr>\n"; $option_no = 1; foreach ($options as $individual_option) { $individual_option = trim($individual_option); if ($option_no == $i) { if ($log[$screen][$q_id][$individual_coord][$individual_option] == '') { echo "<tr><td style=\"width: 20px\"> </td><td><strong>{$individual_option}</strong></td><td><strong>0</strong></td></tr>\n"; } else { echo "<tr><td></td><td><strong>{$individual_option}</strong></td><td><strong>" . $log[$screen][$q_id][$individual_coord][$individual_option] . "</strong></td></tr>\n"; } } else { if ($log[$screen][$q_id][$individual_coord][$individual_option] == '') { echo "<tr><td></td><td>{$individual_option}</td><td>0</td></tr>\n"; } else { echo "<tr><td></td><td>{$individual_option}</td><td>" . $log[$screen][$q_id][$individual_coord][$individual_option] . "</td></tr>\n"; } } $option_no++; } echo "<tr><td colspan=\"3\"> </td></tr>\n"; $i++; } break; case 'likert': $old_size = substr_count($old_likert_scale, '|'); $current_properties = explode('|', $old_display_method); $new_size = substr_count($old_display_method, '|'); if ($current_properties[$new_size] == 'true') { $na = true; } else { $na = false; } if ($old_likert_scale != $old_display_method or $table_on == 0) { if ($table_on == 1) { echo "</table>\n"; } echo "<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\" style=\"margin-right:10px\">\n"; echo '<tr><td></td><td></td>'; if ($na == true) { echo '<td style="vertical-align:bottom; text-align:center" colspan="2">' . $string['na'] . '</td>'; } for ($point = 1; $point <= $new_size; $point++) { echo "<td style=\"vertical-align:bottom; text-align:center\" colspan=\"2\"><strong>" . $current_properties[$point - 1] . "</strong></td>"; } echo "<td style=\"vertical-align:bottom; color:#808080\" colspan=\"2\">" . $string['unanswered'] . "</td><td style=\"vertical-align:bottom\">" . $string['mean'] . "</td></tr>\n"; $table_on = 1; } echo "<tr><td class=\"q_no\">{$q_no}. </td><td>{$leadin}</td>"; $i = 0; $sub_total = 0; foreach ($options as $individual_option) { $i++; if ($i > 1 or $na == true) { if (!isset($log[$screen][$q_id][1][$individual_option])) { echo "<td class=\"figures\">0</td><td>(0%)</td>\n"; } else { echo "<td class=\"figures\">" . $log[$screen][$q_id][1][$individual_option] . "</td><td>(" . round($log[$screen][$q_id][1][$individual_option] / $candidates * 100) . "%)</td>\n"; } if ($individual_option >= 1 and $individual_option <= 10) { if (isset($log[$screen][$q_id][1][$individual_option])) { $sub_total += $individual_option * $log[$screen][$q_id][1][$individual_option]; } } } } if (isset($log[$screen][$q_id][1]['n/a'])) { $unanswered = $log[$screen][$q_id][1]['n/a']; } else { $unanswered = 0; } if (!isset($log[$screen][$q_id][1]['u'])) { echo "<td class=\"figures\" style=\"color:#808080\">0</td><td style=\"color:#808080\">(0%)</td>"; } else { $unanswered += $log[$screen][$q_id][1]['u']; if ($candidates == 0) { echo "<td class=\"figures\" style=\"color:#808080\">" . $log[$screen][$q_id][1]['u'] . "</td><td style=\"color:#808080\">(0%)</td>"; } else { echo "<td class=\"figures\" style=\"color:#808080\">" . $log[$screen][$q_id][1]['u'] . "</td><td style=\"color:#808080\">(" . round($log[$screen][$q_id][1]['u'] / $candidates * 100) . "%)</td>"; } } if ($candidates - $unanswered == 0) { echo "<td class=\"figures\"> </td></tr>\n"; } else { echo "<td class=\"figures\">" . number_format($sub_total / ($candidates - $unanswered), 1) . "</td></tr>\n"; } $old_likert_scale = $old_display_method; break; case 'hotspot': ?> <div align="center"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" id="hotspot<?php echo $q_no; ?> " width="<?php echo $q_media_width + 2; ?> " height="<?php echo $q_media_height + 40; ?> " align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="hotspot_analysis.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="FlashVars" value="imageName=<?php echo $q_media; ?> &config=<?php echo $correct; ?> &answers=<?php echo $log[$screen][$q_id][1]['coords']; ?> " /> <embed src="hotspot_analysis.swf" FlashVars="imageName=<?php echo $q_media; ?> &config=<?php echo $correct; ?> &answers=<?php echo $log[$screen][$q_id][1]['coords']; ?> " quality="high" bgcolor="#ffffff" width="<?php echo $q_media_width + 2; ?> " height="<?php echo $q_media_height + 40; ?> " swLiveConnect=true id="hotspot<?php echo $q_no; ?> " name="hotspot<?php echo $q_no; ?> " align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" /> </object> </div> <?php echo "<p>\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; echo "<tr><td class=\"figures\">Correct</td><td>" . $log[$screen][$q_id][1][1] . "</td></tr>\n"; echo "<tr><td class=\"figures\">Incorrect</td><td>" . $log[$screen][$q_id][1][0] . "</td></tr>\n"; if ($log[$screen][$q_id][1]['u'] == '') { $log[$screen][$q_id][1]['u'] = 0; } echo "<tr><td class=\"figures\" style=\"color:#808080\">" . $string['unanswered'] . "</td><td style=\"color:#808080\">" . $log[$screen][$q_id][1]['u'] . "</td></tr>\n"; break; case 'mcq': $i = 0; foreach ($options as $individual_option) { $i++; echo "<tr>"; if (!isset($log[$screen][$q_id][1][$i]) or $log[$screen][$q_id][1][$i] == '') { echo "<td class=\"figures\">0</td><td>(0%)</td><td>{$individual_option}</td></tr>\n"; } else { echo "<td class=\"figures\">" . $log[$screen][$q_id][1][$i] . "</td><td>(" . round($log[$screen][$q_id][1][$i] / $candidates * 100) . "%)</td><td>{$individual_option}</td></tr>\n"; } } if (!isset($log[$screen][$q_id][1]['u'])) { echo "<tr style=\"color:#808080\"><td class=\"figures\">0</td><td>(0%)</td><td>" . $string['unanswered'] . "</td></tr>\n"; } else { echo "<tr style=\"color:#808080\"><td class=\"figures\">" . $log[$screen][$q_id][1]['u'] . "</td><td>(" . round($log[$screen][$q_id][1]['u'] / $candidates * 100) . "%)</td><td>" . $string['unanswered'] . "</td></tr>\n"; } break; case 'mrq': $i = 0; foreach ($options as $individual_option) { $i++; if (!isset($log[$screen][$q_id][$i]['y']) or $log[$screen][$q_id][$i]['y'] == '') { $log[$screen][$q_id][$i]['y'] = 0; } echo "<tr><td class=\"figures\">" . $log[$screen][$q_id][$i]['y'] . "</td><td>(" . round($log[$screen][$q_id][$i]['y'] / $candidates * 100) . "%)</td><td>{$individual_option}</td></tr>\n"; } $q_option_no = count($options); $log_option_no = count($log[$screen][$q_id]); if ($log_option_no > $q_option_no) { foreach ($log[$screen][$q_id] as $key => $value) { if ($key > $q_option_no) { foreach ($value as $text => $number) { echo "<tr><td class=\"figures\">{$number}</td><td>(" . round($number / $candidates * 100) . "%)</td><td>{$text}</td></tr>\n"; } } } } break; case 'rank': $old_likert_scale = ''; $rank_no = count($correct_buf); $i = 0; $require_na = false; foreach ($options as $individual_option) { $i++; if (isset($log[$screen][$q_id][$i]['correct']) and $log[$screen][$q_id][$i]['correct'] == 9990) { $require_na = true; } } $i = 0; foreach ($options as $individual_option) { echo "<tr><td colspan=\"4\">{$individual_option}</td></tr>\n"; for ($rank_position = 1; $rank_position <= $rank_no; $rank_position++) { if (isset($log[$screen][$q_id][$i][$rank_position]) and $log[$screen][$q_id][$i][$rank_position] == '') { $log[$screen][$q_id][$i][$rank_position] = 0; } if (isset($log[$screen][$q_id][$i][$rank_position])) { echo "<tr><td class=\"figures\">" . $log[$screen][$q_id][$i][$rank_position] . "</td><td>(" . number_format($log[$screen][$q_id][$i][$rank_position] / $candidates * 100, 0) . "%)</td><td></td><td>{$rank_position}"; } else { echo "<tr><td class=\"figures\">0</td><td>(0%)</td><td></td><td>{$rank_position}"; } if ($rank_position == 1) { echo 'st'; } elseif ($rank_position == 2) { echo 'nd'; } elseif ($rank_position == 3) { echo 'rd'; } else { echo 'th'; } echo "</td><td style=\"width:50%\"> </td></tr>\n"; } if (isset($reqire_na) and $reqire_na == true) { echo "<tr><td class=\"figures\">" . $log[$screen][$q_id][$i][9990] . "</td><td>(" . number_format($log[$screen][$q_id][$i][9990] / $candidates * 100, 0) . "%)</td><td></td><td>" . $string['na'] . "</td><td style=\"width:50%\"> </td></tr>"; } if (isset($log[$screen][$q_id][$i]['u'])) { echo "<tr><td class=\"figures\">" . $log[$screen][$q_id][$i]['u'] . "</td><td>(" . number_format($log[$screen][$q_id][$i]['u'] / $candidates * 100, 0) . "%)</td><td></td><td style=\"color:#808080\">" . $string['unanswered'] . "</td><td style=\"width:50%\"> </td></tr>"; } else { echo "<tr><td class=\"figures\">0</td><td>(0%)</td><td></td><td style=\"color:#808080\">" . $string['unanswered'] . "</td><td style=\"width:50%\"> </td></tr>"; } echo "<tr><td colspan=\"4\"> </td></tr>\n"; $i++; } break; } if ($q_type != 'likert') { echo "</table>\n"; } } elseif ($q_type == 'matrix') { $tmp_media_array = explode('|', $q_media); $tmp_media_width_array = explode('|', $q_media_width); $tmp_media_height_array = explode('|', $q_media_height); $tmp_ext_scenarios = explode('|', $scenario); $tmp_answers_array = explode('|', $correct_buf[0]); echo "<tr><td class=\"q_no\">{$q_no}. </td><td><p>{$leadin}</p>"; echo "<p>\n<table cellpadding=\"2\" cellspacing=\"0\" border=\"1\">\n"; echo '<tr><td> </td>'; foreach ($options as $individual_option) { echo "<td>{$individual_option}</td>"; } echo "<td style=\"color:#808080\">" . $string['unanswered'] . "</td></tr>\n"; for ($i = 1; $i <= substr_count($scenario, '|') + 1; $i++) { echo "<tr>\n"; echo "<td>" . $tmp_ext_scenarios[$i - 1] . "</td>"; $option_no = 1; foreach ($options as $individual_option) { if (!isset($log[$screen][$q_id][$i][$option_no])) { echo "<td class=\"figures\">0 (0%)</td>"; } else { echo "<td class=\"figures\">" . $log[$screen][$q_id][$i][$option_no] . " (" . number_format($log[$screen][$q_id][$i][$option_no] / $candidates * 100, 0) . "%)</td>"; } $option_no++; } if (isset($log[$screen][$q_id][$i]['u'])) { echo "<td class=\"figures\">" . $log[$screen][$q_id][$i]['u'] . "</td>"; } else { echo "<td class=\"figures\">0</td>"; } echo "</tr>\n"; } echo "</table>\n</td></tr>\n"; } elseif ($q_type == 'extmatch') { $tmp_media_array = explode('|', $q_media); $tmp_media_width_array = explode('|', $q_media_width); $tmp_media_height_array = explode('|', $q_media_height); $tmp_ext_scenarios = explode('|', $scenario); $tmp_answers_array = explode('|', $correct_buf[0]); echo "<tr><td class=\"q_no\">{$q_no}. </td><td><p>{$leadin}</p>\n<ol type=\"i\">"; if ($tmp_media_array[0] != '') { echo "<p align=\"center\">" . display_media($tmp_media_array[0], $tmp_media_width_array[0], $tmp_media_height_array[0], '') . "</p>\n"; } for ($i = 1; $i <= substr_count($scenario, '|') + 1; $i++) { echo "<li>\n"; if ($tmp_media_array[$i] != '') { echo "<p>" . display_media($tmp_media_array[$i], $tmp_media_width_array[$i], $tmp_media_height_array[$i], '') . "</p>\n"; } if ($tmp_ext_scenarios[$i - 1]) { echo "<p>" . $tmp_ext_scenarios[$i - 1] . "</p>\n"; } echo "<p>\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; $option_no = 1; foreach ($options as $individual_option) { $specific_answers = array(); $specific_answers = explode('|', $tmp_answers_array[$i - 1]); $answer_match = false; for ($x = 0; $x < count($specific_answers); $x++) { if ($option_no == $specific_answers[$x]) { $answer_match = true; } } if ($answer_match == true) { if ($log[$screen][$q_id][$i][$option_no] == '') { echo "<tr><td class=\"figures\" style=\"font-weight:bold\">0</td><td style=\"font-weight:bold\">{$individual_option}</td></tr>\n"; } else { echo "<tr><td class=\"figures\" style=\"font-weight:bold\">" . $log[$screen][$q_id][$i][$option_no] . " (" . round($log[$screen][$q_id][$i][$option_no] / $candidates * 100) . "%)</td><td style=\"font-weight:bold\">{$individual_option}</td></tr>\n"; } } else { if ($log[$screen][$q_id][$i][$option_no] == '') { echo "<tr><td class=\"figures\">0</td><td>{$individual_option}</td></tr>\n"; } else { echo "<tr><td class=\"figures\">" . $log[$screen][$q_id][$i][$option_no] . " (" . round($log[$screen][$q_id][$i][$option_no] / $candidates * 100) . "%)</td><td>{$individual_option}</td></tr>\n"; } } $option_no++; } if ($log[$screen][$q_id][$i]['u'] > 0) { echo "<tr style=\"color:#808080\"><td class=\"figures\">" . $log[$screen][$q_id][$i]['u'] . " (" . round($log[$screen][$q_id][$i]['u'] / $candidates * 100) . "%)</td><td>" . $string['unanswered'] . "</td></tr>\n"; } else { echo "<tr style=\"color:#808080\"><td class=\"figures\">0</td><td>" . $string['unanswered'] . "</td></tr>\n"; } echo "</table></p></li>\n"; } echo "</ol>\n"; } echo "</td></tr>\n"; }
echo '<tr><a name="' . $question_no . '"></a><td class="q_no">' . $question_no . '. </td><td valign="top">' . $scenario . '<br /><br />'; $li_set = 1; } if ($q_media != '' and $q_media != NULL and $q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'flash' and $q_type != 'extmatch' and $q_type != 'area') { if (substr($q_media, -4) == '.gif' or substr($q_media, -4) == '.jpg' or substr($q_media, -4) == 'jpeg' or substr($q_media, -4) == '.png') { if ($li_set == 0) { echo '<tr><a name="' . $question_no . '"></a><td class="q_no">' . $question_no . '. </td><td>'; } $li_set = 1; echo "<p align=\"center\">" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } else { if ($li_set == 0) { echo '<tr><a name="' . $question_no . '"></a><td class="q_no">' . $question_no . '. </td><td>'; } $li_set = 1; echo "<p align=\"center\">" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } } if ($q_type != 'likert' and $q_type != 'enhancedcalc' and $q_type != 'info' and $q_type != 'hotspot' and $q_type != 'area') { if ($li_set == 0) { echo '<tr><a name="' . $question_no . '"></a><td class="q_no">' . $question_no . '. </td><td>'; } $li_set = 1; echo $leadin; } if ($q_type == 'info') { if ($li_set == 0) { echo '<tr><td colspan="2" style="padding-left:20px; padding-right:20px">' . $leadin; } $li_set = 1; $question_no--;
STYLE; } else { echo '<style>body{background:#777;color:#eee;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:0.8em;margin:0;padding:0.5em;}a{color:#fff}a.signIn{background:#555;padding:0.3em 0.67em;text-decoration:none;}p{margin-top:0;}</style>' . "\n"; } echo '<script src="' . JQUERY_URL . '"></script>' . "\n"; if ($media_work->get_value('integration_library') && $media_work->get_value('integration_library') != 'default') { // media api echo '<script src="/reason_package/reason_4.0/lib/core/classes/media/api/media_api.js"></script>' . "\n"; } elseif ($media_work->get_value('av_type') == '') { echo '<script src="/reason_package/reason_4.0/lib/core/classes/media/api/media_api_flv.js"></script>' . "\n"; } echo '</head>' . "\n"; echo '<body>' . "\n"; switch ($page_state) { case 'ok': display_media($media_work, $displayer); break; case 'unauthorized': echo '<p>Sorry. You do not have permission to view this media.</p>'; break; case 'authentication_required': echo '<p>You must be signed in to view this media.'; // Use the parent's URL, since this is just an iframe in all likelihood if (!empty($_SERVER['HTTP_REFERER'])) { $dest = $_SERVER['HTTP_REFERER']; } else { $dest = get_current_url(); } $link = REASON_LOGIN_URL . '?dest_page=' . urlencode($dest); echo ' <a target="_parent" href="' . $link . '" class="signIn">Sign in</a></p>' . "\n"; break;
public function render_paper($extra = array()) { global $string; // Display question on paper $screen_pre_submitted = null; if (isset($extra['screen_pre_submitted'])) { $screen_pre_submitted = $extra['screen_pre_submitted']; } // Make sure data is arrays not encoded if (!is_array($this->useranswer)) { $this->useranswer = json_decode($this->useranswer, true); } $this->decode_settings(); // Create array of units and functions if (isset($this->settings['answersexp']) and !is_array($this->settings['answersexp']) or !isset($this->settings['answersexp'])) { foreach ($this->settings['answers'] as $key => $value) { $units = explode(',', $value['units']); foreach ($units as $value1) { $value1 = trim($value1); $this->settings['answersexp'][$value1] = $value['formula']; } } } $calculatevars = array(); $this->generate_variables(); $varname = array_keys($this->useranswer['vars']); $varvalue = array_values($this->useranswer['vars']); if (isset($extra['reviewers']) and $extra['reviewers']) { $leadin = $this->replace_leadin(true); } else { $leadin = $this->replace_leadin(false); } $dispunits = ''; if ($this->settings['show_units'] === true) { if (count($this->settings['answersexp']) > 1) { // Make drop down of units $dispunits = " <select name='qid[" . $this->id . "][uansunit]'>"; foreach ($this->settings['answersexp'] as $key => $value) { $dispunits = $dispunits . "<option value='{$key}'>{$key}</option>"; } $dispunits = $dispunits . '</select>'; } else { $dispunits = array_keys($this->settings['answersexp']); $dispunits = " " . $dispunits[0] . "<input type=\"hidden\" name=\"qid[" . $this->id . "][uansunit]\" value=\"" . $dispunits[0] . "\" />"; } } if (isset($extra['reviewers']) and $extra['reviewers']) { // Display additional information for reviewers echo "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" style=\"padding:10px; border: 2px solid #FCE699; background-color:#FFFFEE; width:700px\">\n"; echo "<tr><td colspan=\"4\">" . $string['notvisible'] . "</td></tr>"; echo "<tr><td colspan=\"4\" style=\"text-align:justify\">" . $string['reviewermsg'] . "</td></tr>"; echo "<tr><td colspan=\"4\"> </td></tr>"; echo "<tr style=\"font-weight:bold\"><td style=\"width:80px; border-bottom: 1px solid #FCE699\">{$string['variable']}</td><td style=\"width:80px; border-bottom: 1px solid #FCE699\">" . $string['generated'] . "</td><td style=\"width:80px; border-bottom: 1px solid #FCE699\">" . $string['min'] . "</td><td style=\"width:460px; border-bottom: 1px solid #FCE699\">" . $string['max'] . "</td></tr>\n"; foreach ($this->settings['vars'] as $key => $value) { echo "<tr><td>" . $key . "</td><td>" . $this->useranswer['vars'][$key] . "</td><td>" . $value['min'] . "</td><td>" . $value['max'] . "</td></tr>\n"; } $formula_no = 1; foreach ($this->settings['answers'] as $answer) { echo "<tr><td>" . $string['formula'] . " {$formula_no}</td><td colspan=\"2\">" . $answer['formula'] . "</td><td>units: " . $answer['units'] . "</td></tr>\n"; $formula_no++; } if (strlen($this->settings['tolerance_full']) > 0) { echo "<tr><td colspan=\"3\">{$string['tolerancefull']}</td><td>" . $this->settings['tolerance_full']; if ($this->settings['fulltoltyp'] == '%') { echo '%'; } echo "</td></tr>\n"; } if (strlen($this->settings['tolerance_partial']) > 0) { echo "<tr><td colspan=\"3\">{$string['tolerancepartial']}</td><td>" . $this->settings['tolerance_partial']; if ($this->settings['parttoltyp'] == '%') { echo '%'; } echo "</td></tr>\n"; } echo "<tr><td colspan=\"4\"><input type=\"button\" class=\"reveal\" value=\"" . $string['togglevariables'] . "\" /></td></tr>\n"; echo "</table>\n<br />"; $real_answer = $this->get_real_answer(); $this->add_to_useranswer('uans', $real_answer); // Get the real answer and override } if ($this->scenario != '') { echo "<p>" . $this->scenario . "</p>\n"; } if ($this->q_media != '') { echo "<p align=\"center\">" . display_media($this->q_media, $this->q_media_width, $this->q_media_height, '') . "</p>\n"; } $marking_precision_feedback = ''; if ($this->is_strict_dp_enabled()) { $marking_precision_feedback = " <span class=\"calc_fb\">(" . $string['answer_to'] . " " . $this->settings['dp'] . " " . $string['decimal_places'] . ")</span>"; } else { if ($this->is_strict_sf_enabled()) { $marking_precision_feedback = " <span class=\"calc_fb\">(" . $string['answer_to'] . " " . $this->settings['sf'] . " " . $string['significant_figures'] . ")</span>"; } } echo $leadin; if (in_array('ERROR', $varvalue, true)) { echo "<p><input type=\"text\" style=\"text-align:right\" name=\"qid[" . $this->id . "][uans]\" size=\"10\" value=\"\" disabled=\"disabled\" />" . $dispunits . $marking_precision_feedback . "</p>\n"; } else { if (isset($this->useranswer['uans']) and $this->useranswer['uans'] == '') { echo "<div><input type=\"text\" style=\"text-align:right\" name=\"qid[" . $this->id . "][uans]\" size=\"10\" class=\"unans ecalc-answer\" />" . $dispunits . $marking_precision_feedback . "</div>\n"; } else { if (isset($this->useranswer['uans']) and $this->useranswer['uans'] != '') { // Or $screen_pre_submitted == 0 $ans = $this->useranswer['uans']; echo "<div><input type=\"text\" style=\"text-align:right\" id=\"q{$extra['num_on_screen']}\" name=\"qid[" . $this->id . "][uans]\" size=\"10\" value=\"" . $ans . "\" class=\"ecalc-answer\" />" . $dispunits . $marking_precision_feedback . "</div>\n"; } else { echo "<div><input type=\"text\" style=\"text-align:right\" class=\"ecalc-answer\" id=\"q{$extra['num_on_screen']}\" name=\"qid[" . $this->id . "][uans]\" size=\"10\" value=\"\" />" . $dispunits . $marking_precision_feedback . "</div>\n"; $unanswered = true; } } } $marks = $this->settings['marks_correct']; }
<label for="edit_extmatch<?php echo $index; ?> "><?php echo $string['stem']; ?> </label></th> <td> <?php echo wysywig_or_non_editable($dis_class, 'edit_extmatch' . $index, 'question_stem' . strval($index), $stem); ?> </td> </tr> <?php if (isset($all_media['filenames'][$index]) and $all_media['filenames'][$index] != '') { $current_media_html = display_media($all_media['filenames'][$index], $all_media['widths'][$index], $all_media['heights'][$index], '', $index, $locked); ?> <tr<?php echo $alt_c; ?> > <th><?php echo $string['current'] . ' ' . $string['media']; ?> </th> <td><?php echo $current_media_html; ?> </td> </tr> <?php
if ($dis_class != '') { $disabled = ' disabled="disabled"'; $locked = true; } else { $disabled = ''; $locked = false; } if ($current_media['filename'] != '') { ?> <tr> <th><?php echo $string['current'] . ' ' . $media_label; ?> </th> <td><?php echo display_media($current_media['filename'], $current_media['width'], $current_media['height'], '', $media_index_display, $locked); ?> </td> </tr> <?php } ?> <tr> <th><label for="<?php echo $media_for; ?> _media<?php echo $media_index; ?> "><?php echo $string['change'] . ' ' . $media_label;
function displayQuestion($exclusions, $q_no, $q_id, $theme, $scenario, $leadin, $q_type, $correct, $q_media, $q_media_width, $q_media_height, $options, $o_media, $bottom_log, $top_log, $freq_log, $correct_buf, $candidate_no, $score_method, $display_method, $themecolor, $std) { global $ex_no, $d_no, $d_total, $user_total, $language, $string; $configObject = Config::get_instance(); if ($theme != '') { echo "<tr><td colspan=\"2\"><h1 style=\"color:{$themecolor}\">{$theme}</h1></td></tr>\n"; } echo "<tr>\n"; $tmp_std_array = !empty($std) ? explode(',', $std) : array(); $parts = count($tmp_std_array); for ($i = 0; $i < $parts; $i++) { $tmp_std_array[$i] = str_replace('exclude_', '', $tmp_std_array[$i]); } if ($q_type != 'extmatch' and $q_type != 'matrix' and $q_type != 'textbox') { if ($q_type == 'info') { echo "<td colspan=\"2\" style=\"padding-left:15px\">{$leadin}\n"; } else { echo "<td class=\"q_no\">{$q_no}. </td><td><div"; if (($q_type == 'dichotomous' or $q_type == 'labelling' or $q_type == 'blank' or $q_type == 'hotspot') and $score_method == 'Mark per Question' or $q_type == 'flash') { echo ' id="q_' . ($ex_no + 1) . '_1"'; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; } } echo '>'; if (trim(str_replace(' ', '', $scenario)) != '') { echo "{$scenario}<br /><br />\n"; } if ($q_type != 'hotspot' and $q_type != 'timedate' and $q_type != 'enhancedcalc' and $q_type != 'flash' and $q_type != 'area') { echo "{$leadin}</div>\n"; } if ($q_media != '' and $q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'flash' and $q_type != 'area') { echo "<p align=\"center\">" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } if ($q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'enhancedcalc' and $q_type != 'blank' and $q_type != 'flash' and $q_type != 'area') { echo "<p>\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; } } switch ($q_type) { case 'random': echo "<div class=\"q_warning\">" . $string['randomwarning'] . "</div>\n"; break; case 'keyword_based': echo "<div class=\"q_warning\">" . $string['keywordwarning'] . "</div>\n"; break; case 'area': echo "<div id=\"q_" . ($ex_no + 1) . "_1\""; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; } echo ">{$leadin}\n"; if ($exclusions->is_question_excluded($q_id)) { echo excludeButton($ex_no, $q_id, '1', 1, 1); } else { echo excludeButton($ex_no, $q_id, '0', 1, 1); } echo "</div><p>" . display_media($q_media, $q_media_width, $q_media_height, '#7F9DB9') . "</p>\n"; if (!isset($freq_log[$q_id][1]['correct'])) { $freq_log[$q_id][1]['correct'] = 0; } if (!isset($freq_log[$q_id][1]['partial'])) { $freq_log[$q_id][1]['partial'] = 0; } if (!isset($freq_log[$q_id][1]['incorrect'])) { $freq_log[$q_id][1]['incorrect'] = 0; } if (!isset($top_log[$q_id][1]['correct'])) { $top_log[$q_id][1]['correct'] = 0; } if (!isset($top_log[$q_id][1]['partial'])) { $top_log[$q_id][1]['partial'] = 0; } if (!isset($top_log[$q_id][1]['incorrect'])) { $top_log[$q_id][1]['incorrect'] = 0; } if (!isset($bottom_log[$q_id][1]['correct'])) { $bottom_log[$q_id][1]['correct'] = 0; } if (!isset($bottom_log[$q_id][1]['partial'])) { $bottom_log[$q_id][1]['partial'] = 0; } if (!isset($bottom_log[$q_id][1]['incorrect'])) { $bottom_log[$q_id][1]['incorrect'] = 0; } echo "<table>\n"; $t = $user_total != 0 ? number_format($freq_log[$q_id][1]['correct'] / $user_total * 100, 0) : 0; $u = $candidate_no != 0 ? number_format($top_log[$q_id][1]['correct'] / $candidate_no * 100, 0) : 0; $l = $candidate_no != 0 ? number_format($bottom_log[$q_id][1]['correct'] / $candidate_no * 100, 0) : 0; echo "<tr style=\"font-weight:bold\"><td>t={$t}%</td><td>u={$u}%</td><td>l={$l}%</td><td>" . $string['FullMarks'] . "</td></tr>\n"; $partial_t = $user_total != 0 ? number_format($freq_log[$q_id][1]['partial'] / $user_total * 100, 0) : 0; $partial_u = $candidate_no != 0 ? number_format($top_log[$q_id][1]['partial'] / $candidate_no * 100, 0) : 0; $partial_l = $candidate_no != 0 ? number_format($bottom_log[$q_id][1]['partial'] / $candidate_no * 100, 0) : 0; echo "<tr><td>t={$partial_t}%</td><td>u={$partial_u}%</td><td>l={$partial_l}%</td><td>" . $string['PartialMarks'] . "</td></tr>\n"; $incorrect_t = $user_total != 0 ? number_format($freq_log[$q_id][1]['incorrect'] / $user_total * 100, 0) : 0; $incorrect_u = $candidate_no != 0 ? number_format($top_log[$q_id][1]['incorrect'] / $candidate_no * 100, 0) : 0; $incorrect_l = $candidate_no != 0 ? number_format($bottom_log[$q_id][1]['incorrect'] / $candidate_no * 100, 0) : 0; echo "<tr><td>t={$incorrect_t}%</td><td>u={$incorrect_u}%</td><td>l={$incorrect_l}%</td><td>" . $string['Incorrect'] . "</td></tr>\n"; echo "</table>\n"; echo "<table>\n"; if (!isset($freq_log[$q_id]) or !isset($freq_log[$q_id]['totalpos']) or $freq_log[$q_id]['totalpos'] == 0) { $p = 0; } else { $p = $freq_log[$q_id]['mark'] / $freq_log[$q_id]['totalpos']; } $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], 1, 'correct'); echo "<tr><td>" . pStats($p, $q_id, 1) . "</td><td colspan=\"3\">" . dStats($d, $q_id, 1) . "</td></tr>\n"; break; case 'blank': echo '<br />'; $blank_details = explode('[blank', $options[0]); $array_size = count($blank_details); if ($score_method == 'Mark per Question') { if ($exclusions->is_question_part_excluded($q_id, 0)) { echo excludeButton($ex_no, $q_id, str_repeat('1', $array_size - 1), 1, $array_size - 1); } else { echo excludeButton($ex_no, $q_id, str_repeat('0', $array_size - 1), 1, $array_size - 1); } } $options[0] = preg_replace("| mark=\"([0-9]{1,3})\"|", "", $options[0]); $options[0] = preg_replace("| size=\"([0-9]{1,3})\"|", "", $options[0]); $blank_count = 0; echo $blank_details[0]; while ($blank_count < $array_size) { if (strpos($blank_details[$blank_count], '[/blank]') !== false) { $end_start_tag = strpos($blank_details[$blank_count], ']'); $start_end_tag = strpos($blank_details[$blank_count], '[/blank]'); $cut_length = $start_end_tag - $end_start_tag - 1; $blank_options = substr($blank_details[$blank_count], $end_start_tag + 1, $cut_length); $remainder = substr($blank_details[$blank_count], $start_end_tag + 8); if ($exclusions->is_question_excluded($q_id)) { $tmp_exclude = $exclusions->get_exclusion_part_by_qid($q_id, $blank_count - 1); } else { $tmp_exclude = ''; } if ($display_method == 'dropdown') { $options_array = explode(',', $blank_options); $i = 0; foreach ($options_array as $individual_blank_option) { $individual_blank_option = trim($individual_blank_option); if (!isset($log[$q_id][$blank_count + 1][$individual_blank_option])) { $log[$q_id][$blank_count + 1][$individual_blank_option] = 0; } if ($i == 0) { echo ' <strong>' . chr($blank_count + 64) . '.</strong> <select><option value="">' . $individual_blank_option . '</option></select>'; } $i++; } } else { $tmp_parts = explode(',', $blank_options); echo ' <strong>' . chr($blank_count + 64) . '.</strong> <input type="text" size="20" value="' . $tmp_parts[0] . '" />'; } echo $remainder; } $blank_count++; } echo "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\" style=\"margin-left:20px\">\n"; for ($i = 1; $i < count($blank_details); $i++) { $end_start_tag = strpos($blank_details[$i], ']'); $start_end_tag = strpos($blank_details[$i], '[/blank]'); $cut_length = $start_end_tag - $end_start_tag - 1; $blank_options = substr($blank_details[$i], $end_start_tag + 1, $cut_length); $blank_options = explode(',', $blank_options); $tmp_correct_no = 0; $tmp_top_no = 0; $tmp_bottom_no = 0; if ($display_method == 'dropdown') { $blank_word = strtolower(trim($blank_options[0])); if (isset($freq_log[$q_id][$i + 1][$blank_word])) { $tmp_correct_no += $freq_log[$q_id][$i + 1][$blank_word]; } if (isset($top_log[$q_id][$i + 1][$blank_word])) { $tmp_top_no += $top_log[$q_id][$i + 1][$blank_word]; } if (isset($bottom_log[$q_id][$i + 1][$blank_word])) { $tmp_bottom_no += $bottom_log[$q_id][$i + 1][$blank_word]; } $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], $i + 1, $blank_word); } else { $unique_blank_options = array_intersect_key($blank_options, array_unique(array_map('strtolower', $blank_options))); $unique_blank_options = array_map('strtolower', $unique_blank_options); // Merge the same option on its own and with spaces (e.g. 'cat' and ' cat'). $new_blank_options = array(); foreach ($unique_blank_options as $blank_option) { $new_blank_options[] = strtolower(trim($blank_option)); } $unique_blank_options = array_unique($new_blank_options); foreach ($unique_blank_options as $blank_option) { if (isset($freq_log[$q_id][$i + 1][$blank_option])) { $tmp_correct_no += $freq_log[$q_id][$i + 1][$blank_option]; } if (isset($top_log[$q_id][$i + 1][$blank_option])) { $tmp_top_no += $top_log[$q_id][$i + 1][$blank_option]; } if (isset($bottom_log[$q_id][$i + 1][$blank_option])) { $tmp_bottom_no += $bottom_log[$q_id][$i + 1][$blank_option]; } } $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], $i + 1, $unique_blank_options); } $t = $user_total != 0 ? number_format($tmp_correct_no / $user_total * 100, 0) : 0; $d_no++; $d_total += $d; $html = ''; $u = $candidate_no != 0 ? number_format($tmp_top_no / $candidate_no * 100, 0) : 0; $l = $candidate_no != 0 ? number_format($tmp_bottom_no / $candidate_no * 100, 0) : 0; echo "<tr><td>" . chr($i + 64) . ".</td>"; if ($score_method == 'Mark per Option') { if ($exclusions->is_question_excluded($q_id)) { $tmp_part = $exclusions->get_exclusion_part_by_qid($q_id, $i - 1); echo '<td>' . excludeButton($ex_no, $q_id, $tmp_part, 1, 1) . '</td>'; } else { echo '<td>' . excludeButton($ex_no, $q_id, 0, 1, 1) . '</td>'; } } $p = $user_total != 0 ? $tmp_correct_no / $user_total : 0; echo "<td>" . pStats($p, $q_id, $i) . "</td><td>" . dStats($d, $q_id, $i) . "</td><td>t={$t}%</td><td>u={$u}%</td><td>l={$l}%</td>"; if (isset($tmp_std_array[$i - 1])) { echo '<td class="std">' . $tmp_std_array[$i - 1] . '</td>'; } echo "<td id=\"q_" . $ex_no . "_1\""; if ($exclusions->is_question_excluded($q_id) and $exclusions->get_exclusion_part_by_qid($q_id, $i - 1) == '1' and $score_method == 'Mark per Option') { echo ' class="excluded"'; } echo ">"; if ($display_method == 'dropdown') { $html = $blank_options[0]; } else { foreach ($blank_options as $blank_option) { if ($html == '') { $html = $blank_option; } else { $html .= ', ' . $blank_option; } } } echo "{$html}</td>"; if ($display_method == 'textboxes') { echo "<td><input type=\"button\" onclick=\"blankCorrect({$q_id}, {$i})\" value=\"" . $string['Correct'] . "\" /></td>"; } echo "</tr>"; } echo "</table>\n"; break; case 'dichotomous': if ($score_method == 'Mark per Question') { if ($exclusions->is_question_excluded($q_id)) { echo excludeButton($ex_no, $q_id, str_repeat('1', count($options)), 1, count($options)); } else { echo excludeButton($ex_no, $q_id, str_repeat('0', count($options)), 1, count($options)); } } $i = 0; $std_part = 0; foreach ($options as $individual_option) { $i++; if (!isset($log[$q_id][$i]['t'])) { $log[$q_id][$i]['t'] = 0; } if (!isset($log[$q_id][$i]['f'])) { $log[$q_id][$i]['f'] = 0; } if (!isset($freq_log[$q_id][$i]['t'])) { $freq_log[$q_id][$i]['t'] = 0; } if (!isset($freq_log[$q_id][$i]['f'])) { $freq_log[$q_id][$i]['f'] = 0; } if (!isset($bottom_log[$q_id][$i]['t'])) { $bottom_log[$q_id][$i]['t'] = 0; } if (!isset($bottom_log[$q_id][$i]['f'])) { $bottom_log[$q_id][$i]['f'] = 0; } if (!isset($top_log[$q_id][$i]['t'])) { $top_log[$q_id][$i]['t'] = 0; } if (!isset($top_log[$q_id][$i]['f'])) { $top_log[$q_id][$i]['f'] = 0; } if (!isset($tmp_std_array[$std_part])) { $tmp_std_array[$std_part] = ''; } if ($exclusions->is_question_excluded($q_id)) { $tmp_exclude = $exclusions->get_exclusion_part_by_qid($q_id, $i - 1); } else { $tmp_exclude = ''; } echo "<tr><td>"; if ($score_method == 'Mark per Option') { echo excludeButton($ex_no, $q_id, $tmp_exclude, 1, 1); } echo "</td>"; if ($correct_buf[$i - 1] == 't') { $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], $i, 't'); $p = (isset($freq_log[$q_id]) and $user_total != 0) ? $freq_log[$q_id][$i]['t'] / $user_total : 0; $ptop = (isset($top_log[$q_id]) and $candidate_no != 0) ? $top_log[$q_id][$i]['t'] / $candidate_no : 0; $pbottom = (isset($bottom_log[$q_id]) and $candidate_no != 0) ? $bottom_log[$q_id][$i]['t'] / $candidate_no : 0; $text = $string['True']; } else { $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], $i, 'f'); $p = (isset($freq_log[$q_id]) and $user_total != 0) ? $freq_log[$q_id][$i]['f'] / $user_total : 0; $ptop = (isset($top_log[$q_id]) and $candidate_no != 0) ? $top_log[$q_id][$i]['f'] / $candidate_no : 0; $pbottom = (isset($bottom_log[$q_id]) and $candidate_no != 0) ? $bottom_log[$q_id][$i]['f'] / $candidate_no : 0; $text = $string['False']; } echo "<td>" . pStats($p, $q_id, $i) . "</td><td>" . dStats($d, $q_id, $i) . "</td><td>t=" . number_format($p * 100, 0) . "%</td><td>u=" . number_format($ptop * 100, 0) . "%</td><td>l=" . number_format($pbottom * 100, 0) . "%</td><td><span class=\"std\">" . $tmp_std_array[$std_part] . "</span></td><td><strong>" . $text . "</strong></td>"; $std_part++; echo "<td id=\"q_" . $ex_no . "_1\""; if ($score_method == 'Mark per Option' and $exclusions->is_question_excluded($q_id) and $exclusions->get_exclusion_part_by_qid($q_id, $i - 1) == '1') { echo ' class="excluded"'; } echo ">{$individual_option}</td></tr>\n"; } break; case 'enhancedcalc': if (!isset($freq_log[$q_id][1]['correct'])) { $freq_log[$q_id][1]['correct'] = ''; } $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], 1, 'correct'); if (isset($freq_log[$q_id][1]['correct']) and $user_total != 0) { $t = number_format($freq_log[$q_id][1]['correct'] / $user_total * 100, 0); } else { $t = 0; } if (isset($top_log[$q_id][1]['correct']) and $candidate_no != 0) { $u = number_format($top_log[$q_id][1]['correct'] / $candidate_no * 100, 0); } else { $u = 0; } if (isset($bottom_log[$q_id][1]['correct']) and $candidate_no != 0) { $l = number_format($bottom_log[$q_id][1]['correct'] / $candidate_no * 100, 0); } else { $l = 0; } if ($exclusions->is_question_excluded($q_id)) { $tmp_exclude = $exclusions->get_exclusions_by_qid($q_id); } else { $tmp_exclude = ''; } echo "<p>\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; echo "<tr><td>" . excludeButton($ex_no, $q_id, $tmp_exclude, 1, 1) . "</td><td style=\"width:60px\"><strong>t=" . $t . "%</strong></td><td><strong>u=" . $u . "%</strong></td><td><strong>l=" . $l . "%</strong></td><td><span class=\"std\">" . $std . "</span></td><td id=\"q_" . $ex_no . "_1\""; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; } echo ">{$leadin}</td>"; echo "<td><input type=\"button\" onclick=\"return clacCorrect({$q_id}, {$i})\" value=\"" . $string['Correct'] . "\" /></td>"; echo "</tr>\n"; echo "<tr><td colspan=\"7\"> </td></tr>"; $p = (isset($freq_log[$q_id]) and $user_total != 0) ? $freq_log[$q_id][1]['correct'] / $user_total : 0; echo "<tr><td></td><td>" . pStats($p, $q_id, 1) . "</td><td colspan=\"5\">" . dStats($d, $q_id, 1) . "</td></tr>"; break; case 'true_false': if (!isset($log[$q_id][1]['t'])) { $log[$q_id][1]['t'] = 0; } if (!isset($log[$q_id][1]['f'])) { $log[$q_id][1]['f'] = 0; } if (!isset($freq_log[$q_id][1]['t'])) { $freq_log[$q_id][1]['t'] = 0; } if (!isset($freq_log[$q_id][1]['f'])) { $freq_log[$q_id][1]['f'] = 0; } if (!isset($bottom_log[$q_id][1]['t'])) { $bottom_log[$q_id][1]['t'] = 0; } if (!isset($bottom_log[$q_id][1]['f'])) { $bottom_log[$q_id][1]['f'] = 0; } if (!isset($top_log[$q_id][1]['t'])) { $top_log[$q_id][1]['t'] = 0; } if (!isset($top_log[$q_id][1]['f'])) { $top_log[$q_id][1]['f'] = 0; } if ($exclusions->is_question_excluded($q_id)) { echo "<tr><td colspan=\"4\">" . excludeButton($ex_no, $q_id, '11', 2, 2) . "</td></tr>\n"; } else { echo "<tr><td colspan=\"4\">" . excludeButton($ex_no, $q_id, '00', 2, 2) . "</td></tr>\n"; } $ptrue = (isset($freq_log[$q_id]) and $user_total != 0) ? $freq_log[$q_id][1]['t'] / $user_total : 0; $ptoptrue = (isset($top_log[$q_id]) and $candidate_no != 0) ? $top_log[$q_id][1]['t'] / $candidate_no : 0; $pbottomtrue = (isset($bottom_log[$q_id]) and $candidate_no != 0) ? $bottom_log[$q_id][1]['t'] / $candidate_no : 0; echo "<tr><td>t=" . number_format($ptrue * 100, 0) . "%</td><td>u=" . number_format($ptoptrue * 100, 0) . "%</td><td>l=" . number_format($pbottomtrue * 100, 0) . "%</td>"; $temp_td = "<td id=\"q_" . $ex_no . "_1\""; if ($exclusions->is_question_excluded($q_id)) { $temp_td .= ' class="excluded"'; } $temp_td .= '>'; if ($correct_buf[0] == 't') { $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], 1, 't'); $p = $ptrue; echo '<td><span class="std">' . $std . '</span></td>' . $temp_td . '<strong>' . $string['True'] . '</strong>'; } else { echo '<td></td>' . $temp_td . $string['True']; } echo "</td></tr>\n"; $pfalse = (isset($freq_log[$q_id]) and $user_total != 0) ? $freq_log[$q_id][1]['f'] / $user_total : 0; $ptopfalse = (isset($top_log[$q_id]) and $candidate_no != 0) ? $top_log[$q_id][1]['f'] / $candidate_no : 0; $pbottomfalse = (isset($bottom_log[$q_id]) and $candidate_no != 0) ? $bottom_log[$q_id][1]['f'] / $candidate_no : 0; echo "<tr><td>t=" . number_format($pfalse * 100, 0) . "%</td><td>u=" . number_format($ptopfalse * 100, 0) . "%</td><td>l=" . number_format($pbottomfalse * 100, 0) . "%</td>"; $temp_td = "<td id=\"q_" . $ex_no . "_2\""; if ($exclusions->is_question_excluded($q_id)) { $temp_td .= ' class="excluded"'; } $temp_td .= '>'; if ($correct_buf[0] == 'f') { $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], 1, 'f'); $p = $pfalse; echo '<td><span class="std">' . $std . '</span></td>' . $temp_td . '<strong>' . $string['False'] . '</strong>'; } else { echo '<td></td>' . $temp_td . $string['False']; } echo "</td></tr>\n"; echo "<tr><td colspan=\"4\"> </td></tr>\n"; echo "<tr><td>" . pStats($p, $q_id, 1) . "</td><td colspan=\"3\">" . dStats($d, $q_id, 1) . "</td></tr>\n"; break; case 'labelling': if ($score_method == 'Mark per Question') { if ($exclusions->is_question_excluded($q_id)) { echo excludeButton($ex_no, $q_id, str_repeat('1', count_labels($correct)), 1, count_labels($correct)); } else { echo excludeButton($ex_no, $q_id, str_repeat('0', count_labels($correct)), 1, count_labels($correct)); } } $std_part = 0; $max_col1 = 0; $max_col2 = 0; $tmp_first_split = explode(';', $correct); $tmp_second_split = explode('|', $tmp_first_split[11]); foreach ($tmp_second_split as $ind_label) { $label_parts = explode('$', $ind_label); if (isset($label_parts[4]) and trim($label_parts[4]) != '') { if ($label_parts[0] < 10) { $max_col1 = $label_parts[0]; } else { $max_col2 = $label_parts[0]; } } } $max_col2 -= 10; $max_label = max($max_col1, $max_col2); $tmp_height = $q_media_height; if ($tmp_height < $max_label * 55) { $tmp_height = $max_label * 55; } require_once '../classes/configobject.class.php'; if ($configObject->get('cfg_interactive_qs') == 'html5') { //<!-- ======================== HTML5 part rep disc ================= --> echo "<canvas id='canvas" . $q_no . "' width='" . ($q_media_width + 220) . "' height='" . $tmp_height . "'></canvas>\n"; echo "<br /><div style='width:100%;text-align: left;' id='canvasbox'></div>\n"; echo "<script>\n"; echo "setUpQuestion(" . $q_no . ", 'flash" . $q_no . "', '" . $language . "', '../media/" . $q_media . "', '" . trim($correct) . "', '', '','#FFC0C0','labelling','analysis');\n"; echo "</script>\n"; //<!-- ==================================================== --> } else { echo "<script>\n"; echo "function swfLoaded" . $q_no . "(message) {\n"; echo "var num = message.substring(5,message.length);\n"; echo "setUpFlash(num, message, '" . $language . "', '" . $q_media . "', '" . trim($correct) . "', '','#FFC0C0');}\n"; echo "write_string('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" id=\"flash" . $q_no . "\" width=\"" . ($q_media_width + 250) . "\" height=\"" . $tmp_height . "\" align=\"middle\">');\n"; echo "write_string('<param name=\"allowScriptAccess\" value=\"always\" />');\n"; echo "write_string('<param name=\"movie\" value=\"/reports/label_analysis.swf\" />');\n"; echo "write_string('<param name=\"quality\" value=\"high\" />');\n"; echo "write_string('<param name=\"bgcolor\" value=\"#ffffff\" />');\n"; echo "write_string('<embed src=\"/reports/label_analysis.swf\" quality=\"high\" bgcolor=\"#ffffff\" width=\"" . ($q_media_width + 250) . "\" height=\"" . $tmp_height . "\" swliveconnect=\"true\" id=\"flash" . $q_no . "\" name=\"flash" . $q_no . "\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" />');\n"; echo "write_string('</object>');\n"; echo "</script>\n"; } ?> <br /> <?php echo "<p>\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; $i = 1; foreach ($correct_buf as $individual_coord) { echo "<tr><td>" . chr($i + 64) . ".</td>"; $option_no = 1; foreach ($options as $individual_option) { $first_part = explode('|', $individual_option); $individual_option = trim($first_part[0]); $tmp_parts = explode('~', $individual_option); $text_only = $tmp_parts[0]; if ($individual_coord == $first_part[1] . 'x' . $first_part[2]) { $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], $individual_coord, $text_only); if (isset($tmp_std_array[$std_part])) { $std_rating = $tmp_std_array[$std_part]; } else { $std_rating = ''; } $tmp_correct_no = isset($freq_log[$q_id][$individual_coord][$text_only]) ? $freq_log[$q_id][$individual_coord][$text_only] : 0; $tmp_top_no = isset($top_log[$q_id][$individual_coord][$text_only]) ? $top_log[$q_id][$individual_coord][$text_only] : 0; $tmp_bottom_no = isset($bottom_log[$q_id][$individual_coord][$text_only]) ? $bottom_log[$q_id][$individual_coord][$text_only] : 0; $p = $user_total != 0 ? $tmp_correct_no / $user_total : 0; $ptop = $candidate_no != 0 ? $tmp_top_no / $candidate_no : 0; $pbottom = $candidate_no != 0 ? $tmp_bottom_no / $candidate_no : 0; if ($score_method == 'Mark per Option') { if ($exclusions->is_question_excluded($q_id)) { $tmp_exclude = $exclusions->get_exclusion_part_by_qid($q_id, $i - 1); echo "<td>" . excludeButton($ex_no, $q_id, $tmp_exclude, 1, 1) . "</td><td>" . pStats($p, $q_id, $i) . "</td><td>" . dStats($d, $q_id, $i) . "</td><td>t=" . number_format($p * 100, 0) . "%</td><td>u=" . number_format($ptop * 100, 0) . "%</td><td>l=" . number_format($pbottom * 100, 0) . "%</td><td><span class=\"std\">{$std_rating}</span></td><td id=\"q_" . $ex_no . "_1\""; } else { echo "<td>" . excludeButton($ex_no, $q_id, '', 1, 1) . "</td><td>" . pStats($p, $q_id, $i) . "</td><td>" . dStats($d, $q_id, $i) . "</td><td>t=" . number_format($p * 100, 0) . "%</td><td>u=" . number_format($ptop * 100, 0) . "%</td><td>l=" . number_format($pbottom * 100, 0) . "%</td><td><span class=\"std\">{$std_rating}</span></td><td id=\"q_" . $ex_no . "_1\""; } if ($exclusions->is_question_excluded($q_id) and $exclusions->get_exclusion_part_by_qid($q_id, $i - 1) == '1') { echo ' class="excluded"'; } } else { echo "<td></td><td>" . pStats($p, $q_id, $i) . "</td><td>" . dStats($d, $q_id, $i) . "</td><td>t=" . number_format($p * 100, 0) . "%</td><td>u=" . number_format($ptop * 100, 0) . "%</td><td>l=" . number_format($pbottom * 100, 0) . "%</td><td><span class=\"std\">{$std_rating}</span></td><td"; } echo ">"; if (strpos(strtolower($individual_option), '.jpg') !== false or strpos(strtolower($individual_option), '.jpeg') !== false or strpos(strtolower($individual_option), '.gif') !== false or strpos(strtolower($individual_option), '.png') !== false) { $image_parts = explode('~', $individual_option); echo "<img src=\"../media/" . $image_parts[0] . "\" width=\"" . $image_parts[1] . "\" height=\"" . $image_parts[2] . "\" alt=\"\" border=\"1\" />"; } else { echo "<strong>{$individual_option}</strong>"; } echo "</td></tr>\n"; $std_part++; } $option_no++; } $i++; } break; case 'flash': if ($exclusions->is_question_excluded($q_id)) { echo excludeButton($ex_no, $q_id, 1, 1, 1); } else { echo excludeButton($ex_no, $q_id, 0, 1, 1); } echo $leadin; ?> <script> var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1; function flash<?php echo $q_no; ?> _DoFSCommand(command, args) { var flash<?php echo $q_no; ?> Obj = isInternetExplorer ? document.all.flash<?php echo $q_no; ?> : document.flash<?php echo $q_no; ?> ; //document.questions.q<?php echo $q_no; ?> .value = args; } if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) { document.write('<script language=\"VBScript\"\>\n'); document.write('On Error Resume Next\n'); document.write('Sub flash<?php echo $q_no; ?> _FSCommand(ByVal command, ByVal args)\n'); document.write(' Call flash<?php echo $q_no; ?> _DoFSCommand(command, args)\n'); document.write('End Sub\n'); document.write('</script\>\n'); } </script> <div style="text-align:center"> <script> write_string('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="flash<?php echo $q_no; ?> " width="<?php echo $q_media_width; ?> " height="<?php echo $q_media_height; ?> " align="middle">'); write_string('<param name="allowScriptAccess" value="sameDomain" />'); write_string('<param name="movie" value="../media/<?php echo $q_media; ?> " />'); write_string('<param name="quality" value="high" />'); write_string('<param name="bgcolor" value="#ffffff" />'); <?php if ($scenario != '') { echo 'write_string(\'<param name="FlashVars" value="' . $scenario . '">\')'; } echo 'write_string(\'<embed src="../media/' . $q_media . '"'; if ($scenario != '') { echo ' FlashVars="' . $scenario . '"'; } echo ' quality="high" bgcolor="#ffffff" width="' . $q_media_width . '" height="' . $q_media_height . '" swLiveConnect=true id="flash' . $q_no . '" name="flash' . $q_no . '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" />\');'; ?> write_string('</object>'); </script> </div> <?php break; case 'hotspot': $layers = explode('|', $correct); $std_parts = explode(',', $std); if ($score_method == 'Mark per Question') { if ($exclusions->is_question_excluded($q_id)) { echo excludeButton($ex_no, $q_id, str_repeat('1', count($layers)), 1, count($layers)); } else { echo excludeButton($ex_no, $q_id, str_repeat('0', count($layers)), 1, count($layers)); } } $layers = explode('|', $correct); $coords = ''; for ($i = 1; $i <= count($layers); $i++) { if (isset($freq_log[$q_id][$i]['coords'])) { $coords .= $freq_log[$q_id][$i]['coords'] . '|'; } else { $coords .= '|'; } } $coords = rtrim($coords, '|'); $tmp_correct = str_replace("'", "\\'", trim($correct)); $tmp_correct = str_replace(" ", " ", $tmp_correct); $tmp_correct = preg_replace('/\\r\\n/', '', $tmp_correct); require_once '../classes/configobject.class.php'; $configObject = Config::get_instance(); if ($configObject->get('cfg_interactive_qs') == 'html5') { //<!-- ======================== HTML5 part rep disc ================= --> echo "<canvas id='canvas" . $q_no . "' width='" . ($q_media_width + 302) . "' height='" . ($q_media_height + 25) . "'></canvas>\n"; echo "<br /><div style='width:100%;text-align: left;' id='canvasbox'></div>\n"; echo "<script>\n"; echo "setUpQuestion(" . $q_no . ", 'flash" . $q_no . "', '" . $language . "', '../media/" . $q_media . "', '" . $tmp_correct . "', '" . $coords . "', '0','#FFC0C0','hotspot','analysis');\n"; echo "</script>\n"; //<!-- ==================================================== --> } else { echo "<script>\n"; echo "function swfLoaded" . $q_no . "(message) {\n"; echo "var num = message.substring(5,message.length);\n"; echo "setUpFlash(num, message, '" . $language . "', '" . $q_media . "', '" . $tmp_correct . "', '" . $coords . "','0','#FFC0C0');}\n"; echo "write_string('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" id=\"flash" . $q_no . "\" width=\"" . ($q_media_width + 302) . "\" height=\"" . ($q_media_height + 25) . "\" align=\"middle\">');\n"; echo "write_string('<param name=\"allowScriptAccess\" value=\"always\" />');\n"; echo "write_string('<param name=\"movie\" value=\"hotspot_analysis.swf\" />');\n"; echo "write_string('<param name=\"quality\" value=\"high\" />');\n"; echo "write_string('<param name=\"bgcolor\" value=\"#ffffff\" />');\n"; echo "write_string('<embed src=\"hotspot_analysis.swf\" quality=\"high\" bgcolor=\"#ffffff\" width=\"" . ($q_media_width + 302) . "\" height=\"" . ($q_media_height + 25) . "\" swliveconnect=\"true\" id=\"flash" . $q_no . "\" name=\"flash" . $q_no . "\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" />');\n"; echo "write_string('</object>');\n"; echo "</script>\n"; } echo "<p><table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; for ($i = 1; $i <= count($layers); $i++) { echo "<tr><td>" . chr($i + 64) . ".</td>"; $label = substr($layers[$i - 1], 0, strpos($layers[$i - 1], '~')); $std_rating = isset($std_parts[$i - 1]) ? $std_parts[$i - 1] : ''; $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], $i, 1); $tmp_correct_no = isset($freq_log[$q_id][$i][1]) ? $freq_log[$q_id][$i][1] : 0; $tmp_top_no = isset($top_log[$q_id][$i][1]) ? $top_log[$q_id][$i][1] : 0; $tmp_bottom_no = isset($bottom_log[$q_id][$i][1]) ? $bottom_log[$q_id][$i][1] : 0; $p = $user_total != 0 ? $tmp_correct_no / $user_total : 0; $ptop = $candidate_no != 0 ? $tmp_top_no / $candidate_no : 0; $pbottom = $candidate_no != 0 ? $tmp_bottom_no / $candidate_no : 0; if ($exclusions->is_question_excluded($q_id)) { echo "<td>"; if ($score_method == 'Mark per Option') { echo excludeButton($ex_no, $q_id, $exclusions->get_exclusion_part_by_qid($q_id, $i - 1), 1, 1); } echo "</td><td>" . pStats($p, $q_id, $i) . "</td><td>" . dStats($d, $q_id, $i) . "</td><td>t=" . number_format($p * 100, 0) . "%</td><td>u=" . number_format($ptop * 100, 0) . "%</td><td>l=" . number_format($pbottom * 100, 0) . "%</td><td><span class=\"std\">{$std_rating}</span></td><td"; if ($score_method == 'Mark per Option') { echo " id=\"q_" . $ex_no . "_1\""; } } else { echo "<td>"; if ($score_method == 'Mark per Option') { echo excludeButton($ex_no, $q_id, '', 1, 1); } echo "</td><td>" . pStats($p, $q_id, $i) . "</td><td>" . dStats($d, $q_id, $i) . "</td><td>t=" . number_format($p * 100, 0) . "%</td><td>u=" . number_format($ptop * 100, 0) . "%</td><td>l=" . number_format($pbottom * 100, 0) . "%</td><td><span class=\"std\">{$std_rating}</span></td><td"; if ($score_method == 'Mark per Option') { echo " id=\"q_" . $ex_no . "_1\""; } } if ($score_method == 'Mark per Option' and $exclusions->is_question_excluded($q_id) and $exclusions->get_exclusion_part_by_qid($q_id, $i - 1) == '1') { echo ' class="excluded"'; } echo "><strong>{$label}</strong></td></tr>\n"; } break; case 'likert': $scale = explode('|', $display_method); echo "<tr>\n"; for ($i = 0; $i < count($scale) - 1; $i++) { echo "<td>" . $scale[$i] . "</td>"; } echo "</tr>\n"; echo "<tr>\n"; for ($i = 1; $i < count($scale); $i++) { if (isset($freq_log[$q_id][1][$i]) and $user_total != 0) { $t = number_format($freq_log[$q_id][1][$i] / $user_total * 100, 0); } else { $t = 0; } echo "<td style=\"text-align:center\">t=" . $t . "%</td>"; } echo "</tr>\n"; break; case 'mcq': if ($exclusions->is_question_excluded($q_id)) { $tmp_exclude = $exclusions->get_exclusions_by_qid($q_id); } else { $tmp_exclude = ''; } echo "<tr><td colspan=\"3\">" . excludeButton($ex_no, $q_id, $tmp_exclude, count($options), 1) . "</td></tr>\n"; $i = 0; foreach ($options as $individual_option) { $i++; if (isset($freq_log[$q_id][1][$i]) and $user_total != 0) { $t = number_format($freq_log[$q_id][1][$i] / $user_total * 100, 0); } else { $t = 0; } if (isset($top_log[$q_id][1][$i]) and $candidate_no != 0) { $u = number_format($top_log[$q_id][1][$i] / $candidate_no * 100, 0); } else { $u = 0; } if (isset($bottom_log[$q_id][1][$i]) and $candidate_no != 0) { $l = number_format($bottom_log[$q_id][1][$i] / $candidate_no * 100, 0); } else { $l = 0; } if ($correct == $i) { $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], 1, $i); $tmp_correct_no = isset($freq_log[$q_id][1][$i]) ? $freq_log[$q_id][1][$i] : 0; echo "<tr style=\"font-weight:bold\"><td>t=" . $t . "%</td><td>u=" . $u . "%</td><td>l=" . $l . "%</td><td><span class=\"std\">{$std}</span></td>"; } else { echo "<tr><td class=\"grey\">t=" . $t . "%</td><td class=\"grey\">u=" . $u . "%</td><td class=\"grey\">l=" . $l . "%</td><td></td>"; } echo "<td id=\"q_" . $ex_no . "_" . $i . "\""; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; } echo ">"; if ($individual_option != '') { echo "{$individual_option}\n"; } if (is_array($o_media[$i - 1])) { echo '<br />'; echo display_media($o_media[$i - 1][0], $o_media[$i - 1][1], $o_media[$i - 1][2], ''); } echo "</td></tr>\n"; } if (isset($freq_log[$q_id][1]['a']) and $user_total != 0) { $t = number_format($freq_log[$q_id][1]['a'] / $user_total * 100, 0); } else { $t = 0; } if (isset($top_log[$q_id][1]['a']) and $candidate_no != 0) { $u = number_format($top_log[$q_id][1]['a'] / $candidate_no * 100, 0); } else { $u = 0; } if (isset($bottom_log[$q_id][1]['a']) and $candidate_no != 0) { $l = number_format($bottom_log[$q_id][1]['a'] / $candidate_no * 100, 0); } else { $l = 0; } echo "<tr><td class=\"grey\">t=" . $t . "%</td><td class=\"grey\">u=" . $u . "%</td><td class=\"grey\">l=" . $l . "%</td><td></td><td style=\"color:#C00000\"><abstain></td></tr>\n"; echo "<tr><td colspan=\"3\"> </td></tr>\n"; $p = $user_total != 0 ? $tmp_correct_no / $user_total : 0; echo "<tr><td>" . pStats($p, $q_id, 1) . "</td><td colspan=\"2\">" . dStats($d, $q_id, 1) . "</td></tr>\n"; break; case 'mrq': if ($exclusions->is_question_excluded($q_id)) { $tmp_exclude = $exclusions->get_exclusions_by_qid($q_id); } else { $tmp_exclude = ''; } echo "<tr><td colspan=\"3\">" . excludeButton($ex_no, $q_id, $tmp_exclude, count($options), count($options)) . "</td></tr>\n"; $i = 0; $std_part = 0; foreach ($options as $individual_option) { $i++; if (!isset($log[$q_id][$i]['y'])) { $log[$q_id][$i]['y'] = 0; } if (isset($freq_log[$q_id][$i]['y']) and $user_total != 0) { $t = number_format($freq_log[$q_id][$i]['y'] / $user_total * 100, 0); } else { $t = 0; } if (isset($top_log[$q_id][$i]['y']) and $candidate_no != 0) { $u = number_format($top_log[$q_id][$i]['y'] / $candidate_no * 100, 0); } else { $u = 0; } if (isset($bottom_log[$q_id][$i]['y']) and $candidate_no != 0) { $l = number_format($bottom_log[$q_id][$i]['y'] / $candidate_no * 100, 0); } else { $l = 0; } if ($correct_buf[$i - 1] == 'y') { if (isset($tmp_std_array[$i - 1])) { $tmp_std = $tmp_std_array[$i - 1]; } else { $tmp_std = ''; } echo "<tr style=\"font-weight:bold\"><td>t=" . $t . "%</td><td>u=" . $u . "%</td><td>l=" . $l . "%</td><td><span class=\"std\">" . $tmp_std . "</span></td><td id=\"q_" . $ex_no . "_" . $i . "\""; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; } $std_part++; } else { echo "<tr><td class=\"grey\">t=" . $t . "%</td><td class=\"grey\">u=" . $t . "%</td><td class=\"grey\">l=" . $l . "%</td><td></td><td id=\"q_" . $ex_no . "_" . $i . "\""; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; } } echo ">{$individual_option}"; if (is_array($o_media[$i - 1])) { echo '<br />'; echo display_media($o_media[$i - 1][0], $o_media[$i - 1][1], $o_media[$i - 1][2], ''); } echo "</td></tr>\n"; } // Abstain if (isset($freq_log[$q_id]['a']) and $user_total != 0) { $t = number_format($freq_log[$q_id]['a'] / $user_total * 100, 0); } else { $t = 0; } if (isset($top_log[$q_id]['a']) and $candidate_no != 0) { $u = number_format($top_log[$q_id]['a'] / $candidate_no * 100, 0); } else { $u = 0; } if (isset($bottom_log[$q_id]['a']) and $candidate_no != 0) { $l = number_format($bottom_log[$q_id]['a'] / $candidate_no * 100, 0); } else { $l = 0; } echo "<tr><td class=\"grey\">t=" . $t . "%</td><td class=\"grey\">u=" . $t . "%</td><td class=\"grey\">l=" . $l . "%</td><td></td><td id=\"q_" . $ex_no . "_abstain\"><span style=\"color:#C00000\"><" . $string['abstain'] . "></span></td></tr>\n"; if (empty($top_log[$q_id]['totalpos']) or empty($bottom_log[$q_id]['totalpos'])) { $d = 0; } else { $d = $top_log[$q_id]['mark'] / $top_log[$q_id]['totalpos'] - $bottom_log[$q_id]['mark'] / $bottom_log[$q_id]['totalpos']; } echo "<tr><td colspan=\"3\"> </td></tr>\n"; $tmp_pstat = (isset($freq_log[$q_id]['mark']) and isset($freq_log[$q_id]['totalpos']) and $freq_log[$q_id]['totalpos'] > 0) ? $freq_log[$q_id]['mark'] / $freq_log[$q_id]['totalpos'] : 0; echo "<tr><td>" . pStats($tmp_pstat, $q_id, 1) . "</td><td colspan=\"2\">" . dStats($d, $q_id, 1) . "</td></tr>\n"; break; case 'rank': $rank_no = 0; foreach ($correct_buf as $individual_correct) { if ($individual_correct > $rank_no and $individual_correct != 0) { $rank_no = $individual_correct; } } $i = 0; if ($exclusions->is_question_excluded($q_id)) { $tmp_exclude = $exclusions->get_exclusions_by_qid($q_id); } else { $tmp_exclude = ''; } echo "<tr><td colspan=\"4\">" . excludeButton($ex_no, $q_id, $tmp_exclude, count($options), count($options) + 1) . "</td></tr>\n"; foreach ($options as $individual_option) { echo "<tr><td id=\"q_" . $ex_no . "_" . ($i + 1) . "\" colspan=\"6\""; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; } echo ">{$individual_option}</td></tr>\n"; for ($rank_position = 1; $rank_position <= $rank_no; $rank_position++) { if (isset($top_log[$q_id][$i][$rank_position])) { $u = number_format($top_log[$q_id][$i][$rank_position] / $candidate_no * 100, 0); } else { $u = 0; } if (isset($bottom_log[$q_id][$i][$rank_position])) { $l = number_format($bottom_log[$q_id][$i][$rank_position] / $candidate_no * 100, 0); } else { $l = 0; } if (!isset($log[$q_id][$i][$rank_position])) { $log[$q_id][$i][$rank_position] = 0; } if ($correct_buf[$i] == $rank_position) { if (isset($tmp_std_array[$i])) { $tmp_std = $tmp_std_array[$i]; } elseif (isset($tmp_std_array[0]) and !isset($tmp_std)) { // This is the first displayed option in a ranking with the Mark per question marking method. $tmp_std = $tmp_std_array[0]; } else { $tmp_std = ''; } echo "<tr><td><strong>u=" . $u . "%</strong></td><td><strong>l=" . $l . "%</strong></td><td><span class=\"std\">" . $tmp_std . "</span></td><td style=\"font-weight:bold\">{$rank_position}"; if ($rank_position == 1) { echo 'st'; } elseif ($rank_position == 2) { echo 'nd'; } elseif ($rank_position == 3) { echo 'rd'; } else { echo 'th'; } echo "</td><td> </td></tr>\n"; } else { echo "<tr><td class=\"grey\">u=" . $u . "%</td><td class=\"grey\">l=" . $l . "%</td><td></td><td>{$rank_position}"; if ($rank_position == 1) { echo 'st'; } elseif ($rank_position == 2) { echo 'nd'; } elseif ($rank_position == 3) { echo 'rd'; } else { echo 'th'; } echo "</td><td style=\"width:50%\"> </td></tr>\n"; } } echo "<tr><td colspan=\"4\"> </td></tr>\n"; $i++; } if (empty($top_log[$q_id]['totalpos']) or empty($bottom_log[$q_id]['totalpos'])) { $d = 0; } else { $d = $top_log[$q_id]['mark'] / $top_log[$q_id]['totalpos'] - $bottom_log[$q_id]['mark'] / $bottom_log[$q_id]['totalpos']; } $std_val = isset($tmp_std_array[$i]) ? $tmp_std_array[$i] : ''; $tmp_correct_no = isset($top_log[$q_id]['all_correct']) ? $top_log[$q_id]['all_correct'] : 0; $tmp_bottom_no = isset($bottom_log[$q_id]['all_correct']) ? $bottom_log[$q_id]['all_correct'] : 0; echo "<tr><td><strong>u=" . number_format($tmp_correct_no / $candidate_no * 100, 0) . "%</strong></td><td><strong>l=" . number_format($tmp_bottom_no / $candidate_no * 100, 0) . "%</strong></td><td><span class=\"std\">" . $std_val . "</span></td><td style=\"font-weight:bold\">" . $string['AllItemsCorrect'] . "</td></tr>\n"; $p = (isset($freq_log[$q_id]) and $freq_log[$q_id]['totalpos'] != 0) ? $freq_log[$q_id]['mark'] / $freq_log[$q_id]['totalpos'] : 0; echo "<tr><td>" . pStats($p, $q_id, 1) . "</td><td colspan=\"3\">" . dStats($d, $q_id, 1) . "</td></tr>\n"; break; case 'sct': if ($exclusions->is_question_excluded($q_id)) { $tmp_exclude = $exclusions->get_exclusions_by_qid($q_id); } else { $tmp_exclude = ''; } echo "<tr><td colspan=\"3\">" . excludeButton($ex_no, $q_id, $tmp_exclude, count($options), 1) . "</td></tr>\n"; $i = 0; foreach ($options as $individual_option) { $i++; $tmp_correct_no = isset($freq_log[$q_id][1][$i]) ? $freq_log[$q_id][1][$i] : 0; $tmp_top_no = isset($top_log[$q_id][1][$i]) ? $top_log[$q_id][1][$i] : 0; $tmp_bottom_no = isset($bottom_log[$q_id][1][$i]) ? $bottom_log[$q_id][1][$i] : 0; $max_correct = 0; $correct_answer_no = 0; $answer_no = 1; foreach ($correct_buf as $tmp_correct) { if ($tmp_correct > $max_correct) { $max_correct = $tmp_correct; $correct_answer_no = $answer_no; } $answer_no++; } $correct_class = $correct_answer_no == $i ? ' correct' : ''; $percent_correct = $user_total != 0 ? $tmp_correct_no / $user_total : 0; $percent_top = $candidate_no != 0 ? $tmp_top_no / $candidate_no : 0; $percent_bottom = $candidate_no != 0 ? $tmp_bottom_no / $candidate_no : 0; echo "<tr class=\"grey{$correct_class}\"><td>t=" . number_format($percent_correct * 100, 0) . "%</td><td>u=" . number_format($percent_top * 100, 0) . "%</td><td>l=" . number_format($percent_bottom * 100, 0) . "%</td><td></td>"; echo "<td id=\"q_" . $ex_no . "_" . $i . "\""; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; } echo ">{$individual_option}</td></tr>\n"; } echo "<tr><td colspan=\"3\"> </td></tr>\n"; if (empty($top_log[$q_id]['totalpos']) or empty($bottom_log[$q_id]['totalpos'])) { $d = 0; } else { $d = $top_log[$q_id]['mark'] / $top_log[$q_id]['totalpos'] - $bottom_log[$q_id]['mark'] / $bottom_log[$q_id]['totalpos']; } $p = (isset($freq_log[$q_id]) and $freq_log[$q_id]['totalpos'] > 0) ? $freq_log[$q_id]['mark'] / $freq_log[$q_id]['totalpos'] : 0; echo "<tr><td>" . pStats($p, $q_id, 1) . "</td><td colspan=\"3\">" . dStats($d, $q_id, 1) . "</td></tr>\n"; break; } if ($q_type != 'info' and $q_type != 'blank' and $q_type != 'flash') { echo "</table></p>\n"; } } elseif ($q_type == 'textbox') { echo "<td class=\"q_no\">{$q_no}. </td><td><div "; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; $tmp_exclude = $exclusions->get_exclusions_by_qid($q_id); } else { $tmp_exclude = ''; } echo "id=\"q_" . ($ex_no + 1) . "_1\">" . excludeButton($ex_no, $q_id, $tmp_exclude, 1, 1) . " {$leadin}</div>"; echo "<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"; $sortby = 'used'; $ordering = 'ASC'; $top_words = array(); if (isset($top_log[$q_id]['words'])) { $i = 0; foreach ($top_log[$q_id]['words'] as $word => $used) { $top_words[$i]['word'] = $word; $top_words[$i]['used'] = $used; $i++; } } $top_words = array_csort($top_words, $sortby, $ordering); $bottom_words = array(); if (isset($bottom_log[$q_id]['words'])) { $i = 0; foreach ($bottom_log[$q_id]['words'] as $word => $used) { $bottom_words[$i]['word'] = $word; $bottom_words[$i]['used'] = $used; $i++; } } $bottom_words = array_csort($bottom_words, $sortby, $ordering); echo "<tr><td colspan=\"2\"><strong>" . $string['TopGroup'] . ":</strong></td><td colspan=\"2\"><strong>" . $string['BottomGroup'] . ":</strong></td></tr>\n"; $mean_word_count_top = (isset($top_log[$q_id]) and $candidate_no != 0) ? $top_log[$q_id]['word_count'] / $candidate_no : 0; $mean_word_count_bottom = (isset($bottom_log[$q_id]) and $candidate_no != 0) ? $bottom_log[$q_id]['word_count'] / $candidate_no : 0; echo "<tr><td colspan=\"2\">(" . $string['meanWordCount'] . " = " . round($mean_word_count_top) . ")</td><td colspan=\"2\">(" . $string['meanWordCount'] . " = " . round($mean_word_count_bottom) . ")</td></tr>"; for ($i = 0; $i < 40; $i++) { if (isset($top_words[$i]['word']) or isset($bottom_words[$i]['word'])) { echo "<tr>"; if (isset($top_words[$i]['word'])) { echo "<td>" . $top_words[$i]['used'] . "</td><td>" . $top_words[$i]['word'] . "</td>"; } else { echo "<td></td><td></td>"; } if (isset($bottom_words[$i]['word'])) { echo "<td>" . $bottom_words[$i]['used'] . "</td><td>" . $bottom_words[$i]['word'] . "</td>"; } else { echo "<td></td><td></td>"; } echo "</tr>"; } } if (empty($top_log[$q_id]['totalpos']) or empty($bottom_log[$q_id]['totalpos'])) { $d = 0; } else { $d = $top_log[$q_id]['mark'] / $top_log[$q_id]['totalpos'] - $bottom_log[$q_id]['mark'] / $bottom_log[$q_id]['totalpos']; } echo "<tr><td colspan=\"4\"> </td></tr>\n"; if (isset($freq_log[$q_id]['unmarked']) and $freq_log[$q_id]['unmarked'] > 0) { echo "<tr><td>p=<img src=\"../artwork/small_yellow_warning_icon.gif\" width=\"12\" height=\"11\" alt=\"Warning\" /></td><td>d=<img src=\"../artwork/small_yellow_warning_icon.gif\" width=\"12\" height=\"11\" alt=\"Warning\" /></td><td colspan=\"2\"><img src=\"../artwork/small_yellow_warning_icon.gif\" width=\"12\" height=\"11\" alt=\"Warning\" /> " . sprintf($string['unmarkedscripts'], $freq_log[$q_id]['unmarked']) . "</td></tr>\n"; } else { if (empty($freq_log[$q_id]['totalpos'])) { $p = 0; } else { $p = $freq_log[$q_id]['mark'] / $freq_log[$q_id]['totalpos']; } echo "<tr><td>" . pStats($p, $q_id, 1) . "</td><td colspan=\"3\">" . dStats($d, $q_id, 1) . "</td></tr>\n"; } echo "</table></td></tr>\n"; } elseif ($q_type == 'matrix') { $tmp_media_array = explode('|', $q_media); $tmp_media_width_array = explode('|', $q_media_width); $tmp_media_height_array = explode('|', $q_media_height); $tmp_ext_scenarios = explode('|', $scenario); $tmp_answers_array = explode('|', $correct_buf[0]); echo "<tr><td class=\"q_no\">{$q_no}. </td><td><div"; if ($score_method == 'Mark per Question') { echo ' id="q_' . ($ex_no + 1) . '_1"'; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; } } echo ">{$leadin}</div>"; if ($score_method == 'Mark per Question') { if ($exclusions->is_question_excluded($q_id)) { echo excludeButton($ex_no, $q_id, str_repeat('1', count($options)), 1, count($options)); } else { echo excludeButton($ex_no, $q_id, str_repeat('0', count($options)), 1, count($options)); } } echo "<p>\n<table cellpadding=\"2\" cellspacing=\"0\" border=\"1\" class=\"matrix\">\n"; $cols = 6; if ($score_method == 'Mark per Option') { $cols++; } $std_on = false; for ($i = 0; $i < count($options); $i++) { if (isset($tmp_std_array[$i])) { $std_on = true; } } if ($std_on) { $cols++; } echo "<tr><td colspan=\"{$cols}\"> </td><td> </td>"; for ($i = 0; $i < count($options); $i++) { echo '<td>' . $options[$i] . '</td>'; } echo "</tr>\n"; for ($i = 1; $i <= substr_count($scenario, '|') + 1; $i++) { if ($tmp_ext_scenarios[$i - 1] != '') { echo "<tr>\n"; $option_no = 1; foreach ($options as $individual_option) { if ($option_no == 1) { $correct_answer = $tmp_answers_array[$i - 1]; $d = calcDiscrimination($candidate_no, $top_log[$q_id], $bottom_log[$q_id], $i, $correct_answer); if ($exclusions->is_question_excluded($q_id)) { $tmp_exclude = $exclusions->get_exclusion_part_by_qid($q_id, $i - 1); } else { $tmp_exclude = ''; } $tmp_correct_no = isset($freq_log[$q_id][$i][$correct_answer]) ? $freq_log[$q_id][$i][$correct_answer] : 0; $tmp_top_no = isset($top_log[$q_id][$i][$correct_answer]) ? $top_log[$q_id][$i][$correct_answer] : 0; $tmp_bottom_no = isset($bottom_log[$q_id][$i][$correct_answer]) ? $bottom_log[$q_id][$i][$correct_answer] : 0; if ($score_method == 'Mark per Option') { echo '<td>' . excludeButton($ex_no, $q_id, $tmp_exclude, 1, 1) . '</td>'; } $p = $user_total != 0 ? $tmp_correct_no / $user_total : 0; $ptop = $candidate_no != 0 ? $tmp_top_no / $candidate_no : 0; $pbottom = $candidate_no != 0 ? $tmp_bottom_no / $candidate_no : 0; echo "<td>" . chr($i + 64) . ".</td>"; echo "<td style=\"font-weight:bold\">" . pStats($p, $q_id, $i) . "</td>"; echo "<td style=\"font-weight:bold\">" . dStats($d, $q_id, $i) . "</td>"; echo "<td style=\"font-weight:bold\">t=" . number_format($p * 100, 0) . "%</td>"; echo "<td style=\"font-weight:bold\">u=" . number_format($ptop * 100, 0) . "%</td>"; echo "<td style=\"font-weight:bold\">l=" . number_format($pbottom * 100, 0) . "%</td>"; if (isset($tmp_std_array[$i - 1])) { echo '<td class="std"><strong>' . $tmp_std_array[$i - 1] . '</strong></td>'; } echo "<td "; if ($exclusions->is_question_excluded($q_id) and $exclusions->get_exclusion_part_by_qid($q_id, $i - 1) == '1' and $score_method != 'Mark per Question') { echo ' class="excluded"'; } if ($score_method == 'Mark per Option') { echo "id=\"q_" . $ex_no . "_1\""; } echo ">" . $tmp_ext_scenarios[$i - 1] . "</td>"; } if ($tmp_answers_array[$i - 1] == $option_no) { echo "<td style=\"text-align:center; background-color:#C0FFC0\"><input type=\"radio\" name=\"q" . $q_id . "_" . $i . "\" checked /></td>"; } else { echo "<td style=\"text-align:center\"><input type=\"radio\" name=\"q" . $q_id . "_" . $i . "\" /></td>"; } $option_no++; } echo "</tr>\n"; } } echo "</table>\n</td></tr>\n"; } elseif ($q_type == 'extmatch') { $matching_scenarios = array(); $matching_scenarios = explode('|', $scenario); $tmp_media_array = explode('|', $q_media); $tmp_media_width_array = explode('|', $q_media_width); $tmp_media_height_array = explode('|', $q_media_height); $tmp_ext_scenarios = explode('|', $scenario); $tmp_answers_array = explode('|', $correct_buf[0]); $tmp_text_no = 0; for ($part_id = 0; $part_id < 10; $part_id++) { if (isset($matching_scenarios[$part_id]) and trim(strip_tags($matching_scenarios[$part_id])) != '') { $tmp_text_no++; } } $tmp_media_no = 0; for ($part_id = 1; $part_id <= 10; $part_id++) { if (isset($tmp_media_array[$part_id]) and $tmp_media_array[$part_id] != '') { $tmp_media_no++; } } $total_scenarios = max($tmp_text_no, $tmp_media_no); echo "<tr><td class=\"q_no\">{$q_no}. </td><td><div"; if ($score_method == 'Mark per Question') { echo " id=\"q_" . ($ex_no + 1) . "_1\""; if ($exclusions->is_question_excluded($q_id)) { echo ' class="excluded"'; } } echo ">{$leadin}</div>\n"; if ($score_method == 'Mark per Question') { if ($exclusions->is_question_excluded($q_id)) { echo excludeButton($ex_no, $q_id, str_repeat('1', $total_scenarios), 1, $total_scenarios); } else { echo excludeButton($ex_no, $q_id, str_repeat('0', $total_scenarios), 1, $total_scenarios); } } echo "<ol class=\"extmatch\">"; if ($tmp_media_array[0] != '') { echo "<p align=\"center\">" . display_media($tmp_media_array[0], $tmp_media_width_array[0], $tmp_media_height_array[0], '') . "</p>\n"; } $std_part = 0; $section = 0; for ($i = 1; $i <= $total_scenarios; $i++) { $tmp_correct_no = 0; $correct_stems = 0; echo "<li>\n"; if (isset($tmp_media_array[$i]) and $tmp_media_array[$i] != '') { echo "<p>" . display_media($tmp_media_array[$i], $tmp_media_width_array[$i], $tmp_media_height_array[$i], '') . "</p>\n"; } if (isset($tmp_ext_scenarios[$i - 1])) { echo "<div>" . $tmp_ext_scenarios[$i - 1] . "</div>\n"; } $option_no = 1; foreach ($options as $individual_option) { $specific_answers = array(); $specific_answers = explode('$', $tmp_answers_array[$i - 1]); $answer_match = false; $count_specific_answers = count($specific_answers); for ($x = 0; $x < $count_specific_answers; $x++) { if ($option_no == $specific_answers[$x]) { $answer_match = true; } } if ($answer_match == true) { $correct_stems++; } $option_no++; } if ($exclusions->is_question_excluded($q_id)) { $tmp_exclude = $exclusions->get_exclusion_part_by_qid($q_id, $section); } else { $tmp_exclude = ''; } if ($score_method == 'Mark per Option') { echo "<div>" . excludeButton($ex_no, $q_id, $tmp_exclude, count($options), $correct_stems) . "</div>"; } echo "<div><table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"; $sub_d = 0; $sub_d_no = 0; $option_no = 1; $correct_stems = 0; foreach ($options as $individual_option) { $specific_answers = explode('$', $tmp_answers_array[$i - 1]); $answer_match = false; $count_specific_answers = count($specific_answers); for ($x = 0; $x < $count_specific_answers; $x++) { if ($option_no == $specific_answers[$x]) { $answer_match = true; } } if ($answer_match == true) { if (isset($top_log[$q_id][$i][$option_no]) and $candidate_no != 0) { $t = $top_log[$q_id][$i][$option_no] / $candidate_no; } else { $t = 0; } if (isset($bottom_log[$q_id][$i][$option_no]) and $candidate_no != 0) { $l = $bottom_log[$q_id][$i][$option_no] / $candidate_no; } else { $l = 0; } $sub_d += $t - $l; $sub_d_no++; if (isset($freq_log[$q_id][$i][$option_no]) and $user_total != 0) { $t = number_format($freq_log[$q_id][$i][$option_no] / $user_total * 100, 0); } else { $t = 0; } if (isset($top_log[$q_id][$i][$option_no]) and $candidate_no != 0) { $u = number_format($top_log[$q_id][$i][$option_no] / $candidate_no * 100, 0); } else { $u = 0; } if (isset($bottom_log[$q_id][$i][$option_no]) and $candidate_no != 0) { $l = number_format($bottom_log[$q_id][$i][$option_no] / $candidate_no * 100, 0); } else { $l = 0; } if (isset($tmp_std_array[$std_part])) { $tmp_std = $tmp_std_array[$std_part]; } else { $tmp_std = ''; } echo "<tr style=\"font-weight:bold\"><td>t=" . $t . "%</td><td>u=" . $u . "%</td><td>l=" . $l . "%</td><td><span class=\"std\">" . $tmp_std . "</span></td><td class=\"correct"; if ($score_method == 'Mark per Option' and $exclusions->is_question_excluded($q_id) and $exclusions->get_exclusion_part_by_qid($q_id, $section) == '1') { echo ' excluded'; } echo "\""; if ($score_method == 'Mark per Option') { echo " id=\"q_" . $ex_no . "_" . $option_no . "\""; } echo ">" . chr($option_no + 64) . ". {$individual_option}</td></tr>\n"; $correct_stems++; if (isset($freq_log[$q_id][$i][$option_no])) { $tmp_correct_no += $freq_log[$q_id][$i][$option_no]; } $std_part++; } else { if (isset($freq_log[$q_id][$i][$option_no]) and $user_total != 0) { $t = number_format($freq_log[$q_id][$i][$option_no] / $user_total * 100, 0); } else { $t = 0; } if (isset($top_log[$q_id][$i][$option_no]) and $candidate_no != 0) { $u = number_format($top_log[$q_id][$i][$option_no] / $candidate_no * 100, 0); } else { $u = 0; } if (isset($bottom_log[$q_id][$i][$option_no]) and $candidate_no != 0) { $l = number_format($bottom_log[$q_id][$i][$option_no] / $candidate_no * 100, 0); } else { $l = 0; } echo "<tr><td class=\"grey\">t=" . $t . "%</td><td class=\"grey\">u=" . $u . "%</td><td class=\"grey\">l=" . $l . "%</td><td></td><td"; if ($score_method == 'Mark per Option' and $exclusions->is_question_excluded($q_id) and $exclusions->get_exclusion_part_by_qid($q_id, $section) == '1') { echo ' class="excluded"'; } if ($score_method == 'Mark per Option') { echo " id=\"q_" . $ex_no . "_" . $option_no . "\""; } echo ">" . chr($option_no + 64) . ". {$individual_option}</td></tr>\n"; } $option_no++; } $section = $std_part; $d = $sub_d / $sub_d_no; $d_no++; $d_total += $d; echo "<tr><td colspan=\"4\"> </td></tr>"; echo "<tr><td>" . pStats($tmp_correct_no / ($correct_stems * $user_total), $q_id, $i) . "</td><td colspan=\"3\">" . dStats($d, $q_id, $i) . "</td></tr>"; if ($i < $total_scenarios) { echo "<tr><td colspan=\"4\"> </td></tr>"; } echo "</table></div></li>\n"; } echo "</ol>\n"; } echo "</td></tr>\n"; echo "<tr><td colspan=\"2\"> </td></tr>\n"; }
echo '<tr><td class="q_no">' . $question_no . '. </td><td valign="top">' . $scenario . '<br /><br />'; $li_set = 1; } if ($q_media != '' and $q_media != NULL and $q_type != 'hotspot' and $q_type != 'labelling' and $q_type != 'flash' and $q_type != 'extmatch') { if (substr($q_media, -4) == '.gif' or substr($q_media, -4) == '.jpg' or substr($q_media, -4) == 'jpeg' or substr($q_media, -4) == '.png') { if ($li_set == 0) { echo '<tr><td class="q_no">' . $question_no . '. </td><td>'; } $li_set = 1; echo "<p align=\"center\">" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } else { if ($li_set == 0) { echo '<tr><td class="q_no">' . $question_no . '. </td><td>'; } $li_set = 1; echo "<p>" . display_media($q_media, $q_media_width, $q_media_height, '') . "</p>\n"; } } if ($q_type != 'likert' and $q_type != 'calculation' and $q_type != 'info') { if ($li_set == 0) { echo '<tr><td class="q_no">' . $question_no . '. </td><td>'; } $li_set = 1; echo $leadin; } if ($q_type == 'info') { if ($li_set == 0) { echo '<tr><td colspan="2" style="padding-left:20px; padding-right:20px">' . $leadin; } $li_set = 1; $question_no--;
$li_set = 0; } elseif ($q_type != 'info' and $li_set == 0) { $q_no++; echo "<tr style=\"background-color:{$tmp_color}\"><td class=\"q_no\">"; echo "<a name=\"q{$q_no}\">{$q_no}. </a>"; } if ($li_set == 0) { echo "</td><td style=\"background-color:{$tmp_color}\">"; } if ($q_media != '' and $q_media != NULL) { $media_list = explode('|', $q_media); $media_list_width = explode('|', $q_media_width); $media_list_height = explode('|', $q_media_height); for ($i = 0; $i < count($media_list); $i++) { if ($media_list[$i] != '') { echo '<p align="center">' . display_media($media_list[$i], $media_list_width[$i], $media_list_height[$i], '') . "</p>\n"; } } } echo "{$leadin}</td></tr>\n"; if ($q_type != 'info') { echo "<tr style=\"background-color:{$tmp_color}\"><td></td><td class=\"mk\"><br />({$marks_correct} " . $string['marks'] . ")</td></tr>\n"; echo "<tr style=\"background-color:{$tmp_color}\"><td> </td><td class=\"fback\"><br />" . nl2br($correct_fback) . "</td></tr>\n"; } } $old_q_id = $q_id; $old_screen = $screen; } echo "</table></td></tr>\n<tr><td valign=\"bottom\">\n<br />\n"; ?> </div>