function writeQuestionStats($i_questionid) { global $g_db, $i_counter, $lngstr, $srv_settings; $i_questionid = (int) $i_questionid; $i_rSet1 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "questions WHERE questionid=" . $i_questionid, 1); if (!$i_rSet1) { showDBError(__FILE__, 1); } else { if (!$i_rSet1->EOF) { $i_question_text = $i_rSet1->fields["question_text"]; $i_question_type = $i_rSet1->fields["question_type"]; } $i_rSet1->Close(); } $i_answers_text = array(); $i_answercount = 0; $i_answers_correct = array(); $answers_clicks = array(); $answers_clicks_total = 0; $question_views_total = 0; $question_correct = 0; $question_incorrect = 0; $question_partially = 0; $question_undefined = 0; $i_rSet2 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "answers WHERE questionid=" . $i_questionid . " ORDER BY answerid"); if (!$i_rSet2) { showDBError(__FILE__, 2); } else { while (!$i_rSet2->EOF) { $i_answercount++; $i_answers_text[$i_answercount] = $i_rSet2->fields["answer_text"]; $i_answers_correct[$i_answercount] = $i_rSet2->fields["answer_correct"]; $answers_clicks[$i_answercount] = 0; $i_rSet2->MoveNext(); } $i_rSet2->Close(); } $i_rSet3 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "results_answers WHERE questionid=" . $i_questionid . " ORDER BY result_answerid"); if (!$i_rSet2) { showDBError(__FILE__, 3); } else { switch ($i_question_type) { case QUESTION_TYPE_MULTIPLECHOICE: case QUESTION_TYPE_TRUEFALSE: while (!$i_rSet3->EOF) { $answers_clicks[(int) $i_rSet3->fields["result_answer_text"]]++; switch ($i_rSet3->fields["result_answer_iscorrect"]) { case IGT_ANSWER_IS_INCORRECT: $question_incorrect++; break; case IGT_ANSWER_IS_PARTIALLYCORRECT: $question_partially++; break; case IGT_ANSWER_IS_CORRECT: $question_correct++; break; } $answers_clicks_total++; $question_views_total++; $i_rSet3->MoveNext(); } break; case QUESTION_TYPE_MULTIPLEANSWER: while (!$i_rSet3->EOF) { if ($i_rSet3->fields["result_answer_text"]) { $i_answers_given = explode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $i_rSet3->fields["result_answer_text"]); foreach ($i_answers_given as $i_answer_given) { $answers_clicks[(int) $i_answer_given]++; $answers_clicks_total++; } } switch ($i_rSet3->fields["result_answer_iscorrect"]) { case IGT_ANSWER_IS_INCORRECT: $question_incorrect++; break; case IGT_ANSWER_IS_PARTIALLYCORRECT: $question_partially++; break; case IGT_ANSWER_IS_CORRECT: $question_correct++; break; } $question_views_total++; $i_rSet3->MoveNext(); } break; case QUESTION_TYPE_FILLINTHEBLANK: $i_fillintheblank_text = array(); $i_fillintheblank_clicks = array(); $i_fillintheblank_count = 0; while (!$i_rSet3->EOF) { $i_found = array_search($i_rSet3->fields["result_answer_text"], $i_fillintheblank_text); if (!$i_found) { $i_fillintheblank_count++; $i_fillintheblank_text[$i_fillintheblank_count] = $i_rSet3->fields["result_answer_text"]; $i_fillintheblank_clicks[$i_fillintheblank_count] = 1; } else { $i_fillintheblank_clicks[$i_found]++; } switch ($i_rSet3->fields["result_answer_iscorrect"]) { case IGT_ANSWER_IS_INCORRECT: $question_incorrect++; break; case IGT_ANSWER_IS_PARTIALLYCORRECT: $question_partially++; break; case IGT_ANSWER_IS_CORRECT: $question_correct++; break; } $answers_clicks_total++; $question_views_total++; $i_rSet3->MoveNext(); } break; case QUESTION_TYPE_ESSAY: while (!$i_rSet3->EOF) { switch ($i_rSet3->fields["result_answer_iscorrect"]) { case IGT_ANSWER_IS_INCORRECT: $question_incorrect++; break; case IGT_ANSWER_IS_PARTIALLYCORRECT: $question_partially++; break; case IGT_ANSWER_IS_CORRECT: $question_correct++; break; case IGT_ANSWER_IS_UNDEFINED: $question_undefined++; break; } $answers_clicks_total++; $question_views_total++; $i_rSet3->MoveNext(); } break; } $i_rSet3->Close(); } switch ($i_question_type) { case QUESTION_TYPE_MULTIPLECHOICE: case QUESTION_TYPE_TRUEFALSE: case QUESTION_TYPE_MULTIPLEANSWER: case QUESTION_TYPE_ESSAY: echo '<tr id=tr_' . $i_counter . ' class=rowone>'; echo '<td rowspan=' . ($i_answercount + 5 + ($i_question_type == QUESTION_TYPE_ESSAY ? 1 : 0)) . ' align=right>' . $i_questionid . '</td>'; echo '<td colspan=4><b>' . getTruncatedHTML($i_question_text, SYSTEM_TRUNCATED_LENGTH_LONG) . '</b></td>'; echo '<td rowspan=' . ($i_answercount + 5 + ($i_question_type == QUESTION_TYPE_ESSAY ? 1 : 0)) . ' align=center><a href="question-bank.php?questionid=' . $i_questionid . '&action=editq"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_question_edit'] . '"></a></td>'; echo '</tr>'; foreach ($i_answers_text as $key => $val) { echo '<tr class=rowone>'; echo '<td>' . getTruncatedHTML($val, SYSTEM_TRUNCATED_LENGTH_LONG) . '</td>'; if ($answers_clicks_total != 0) { $i_answers_clicks_percentage = $answers_clicks[(int) $key] * 100 / $answers_clicks_total; echo '<td>' . getGauge($i_answers_clicks_percentage) . '</td>'; echo '<td align=right>' . $answers_clicks[(int) $key] . '</td>'; echo '<td align=right>' . sprintf("%.2f", $i_answers_clicks_percentage) . '%</td>'; } else { echo '<td colspan=3 align=center class=gray>' . $lngstr['label_notapplicable'] . '</td>'; } echo '</tr>'; } break; case QUESTION_TYPE_FILLINTHEBLANK: $i_sort_order_1 = SORT_DESC; $i_sort_type_1 = SORT_NUMERIC; $i_sort_order_2 = SORT_ASC; $i_sort_type_2 = SORT_STRING; array_multisort($i_fillintheblank_clicks, $i_sort_order_1, $i_sort_type_1, $i_fillintheblank_text, $i_sort_order_2, $i_sort_type_2); $i_answercount = min(sizeof($i_fillintheblank_clicks), MAX_STATS_ANSWERS_FILLINTHEBLANK) + 1; echo '<tr id=tr_' . $i_counter . ' class=rowone>'; echo '<td rowspan=' . ($i_answercount + 5) . ' align=right>' . $i_questionid . '</td>'; echo '<td colspan=4><b>' . getTruncatedHTML($i_question_text, SYSTEM_TRUNCATED_LENGTH_LONG) . '</b></td>'; echo '<td rowspan=' . ($i_answercount + 5) . ' align=center><a href="question-bank.php?questionid=' . $i_questionid . '&action=editq"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_question_edit'] . '"></a></td>'; echo '</tr>'; $i = 0; $i_others_clicks = 0; $i_others_count = 0; foreach ($i_fillintheblank_clicks as $key => $val) { $i++; if ($i <= MAX_STATS_ANSWERS_FILLINTHEBLANK) { echo '<tr class=rowone>'; echo '<td>' . getTruncatedHTML($i_fillintheblank_text[$key], SYSTEM_TRUNCATED_LENGTH_LONG) . '</td>'; if ($answers_clicks_total != 0) { $i_answers_clicks_percentage = $val * 100 / $answers_clicks_total; echo '<td>' . getGauge($i_answers_clicks_percentage) . '</td>'; echo '<td align=right>' . $val . '</td>'; echo '<td align=right>' . sprintf("%.2f", $i_answers_clicks_percentage) . '%</td>'; } else { echo '<td colspan=3 align=center class=gray>' . $lngstr['label_notapplicable'] . '</td>'; } echo '</tr>'; } else { $i_others_clicks += $val; $i_others_count++; } } echo '<tr class=rowone>'; echo '<td>' . sprintf($lngstr['page_questionstats_fillintheblank_others'], $i_others_count) . '</td>'; if ($answers_clicks_total != 0) { $i_answers_clicks_percentage = $i_others_clicks * 100 / $answers_clicks_total; echo '<td>' . getGauge($i_answers_clicks_percentage) . '</td>'; echo '<td align=right>' . $i_others_clicks . '</td>'; echo '<td align=right>' . sprintf("%.2f", $i_answers_clicks_percentage) . '%</td>'; } else { echo '<td colspan=3 align=center class=gray>' . $lngstr['label_notapplicable'] . '</td>'; } echo '</tr>'; break; case QUESTION_TYPE_RANDOM: echo '<tr id=tr_' . $i_counter . ' class=rowone>'; echo '<td rowspan=5 align=right>' . $i_questionid . '</td>'; echo '<td colspan=4><b></b></td>'; echo '<td rowspan=5 align=center><a href="question-bank.php?questionid=' . $i_questionid . '&action=editq"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_question_edit'] . '"></a></td>'; echo '</tr>'; break; } echo '<tr class=rowone><td colspan=4><img src="images/1x1.gif" width=1 height=5></td></tr>'; echo '<tr class=rowone>'; echo '<td>' . $lngstr['page_questionstats_correct_count'] . '</td>'; if ($question_views_total != 0) { $question_correct_percentage = $question_correct * 100 / $question_views_total; echo '<td>' . getGauge($question_correct_percentage, 'green') . '</td>'; echo '<td align=right>' . $question_correct . '</td>'; echo '<td align=right>' . sprintf("%.2f", $question_correct_percentage) . '%</td>'; } else { echo '<td colspan=3 align=center class=gray>' . $lngstr['label_notapplicable'] . '</td>'; } echo '</tr>'; echo '<tr class=rowone>'; echo '<td>' . $lngstr['page_questionstats_partially_count'] . '</td>'; if ($question_views_total != 0) { $question_partially_percentage = $question_partially * 100 / $question_views_total; echo '<td>' . getGauge($question_partially_percentage, 'yellow') . '</td>'; echo '<td align=right>' . $question_partially . '</td>'; echo '<td align=right>' . sprintf("%.2f", $question_partially_percentage) . '%</td>'; } else { echo '<td colspan=3 align=center class=gray>' . $lngstr['label_notapplicable'] . '</td>'; } echo '</tr>'; echo '<tr class=rowone>'; echo '<td>' . $lngstr['page_questionstats_incorrect_count'] . '</td>'; if ($question_views_total != 0) { $question_incorrect_percentage = $question_incorrect * 100 / $question_views_total; echo '<td>' . getGauge($question_incorrect_percentage, 'red') . '</td>'; echo '<td align=right>' . $question_incorrect . '</td>'; echo '<td align=right>' . sprintf("%.2f", $question_incorrect_percentage) . '%</td>'; } else { echo '<td colspan=3 align=center class=gray>' . $lngstr['label_notapplicable'] . '</td>'; } echo '</tr>'; if ($i_question_type == QUESTION_TYPE_ESSAY) { echo '<tr class=rowone>'; echo '<td>' . $lngstr['page_questionstats_undefined_count'] . '</td>'; if ($question_views_total != 0) { $question_undefined_percentage = $question_undefined * 100 / $question_views_total; echo '<td>' . getGauge($question_undefined_percentage, 'gray') . '</td>'; echo '<td align=right>' . $question_undefined . '</td>'; echo '<td align=right>' . sprintf("%.2f", $question_undefined_percentage) . '%</td>'; } else { echo '<td colspan=3 align=center class=gray>' . $lngstr['label_notapplicable'] . '</td>'; } echo '</tr>'; } }
echo '<td width=32><a href="groups.php?pageno=' . $i_pageno_count . $i_url_pages_addon . '"><img src="images/button-last-big.gif" border=0 title="' . $lngstr['button_last_page'] . '"></a></td>'; } else { echo '<td width=32><img src="images/button-next-big-inactive.gif" border=0 title="' . $lngstr['button_next_page'] . '"></td>'; echo '<td width=32><img src="images/button-last-big-inactive.gif" border=0 title="' . $lngstr['button_last_page'] . '"></td>'; } } echo '<td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>'; echo '</td></tr><tr><td>'; echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">'; echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>'; writeQryTableHeaders('groups.php?action=' . $i_url_limit_addon, $i_tablefields, $i_order_no, $i_direction); echo '<td class=rowhdr1 colspan=2>' . $lngstr['label_hdr_action'] . '</td></tr>'; //9917 $i_rSet1 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "groups" . $i_sql_order_addon, $i_limitcount, $i_limitfrom); if (!$i_rSet1) { showDBError(__FILE__, 1); } else { $i_counter = 0; while (!$i_rSet1->EOF) { $rowname = $i_counter % 2 ? "rowone" : "rowtwo"; echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22' . ($i_rSet1->fields["groupid"] > SYSTEM_GROUP_MAX_INDEX ? '' : ' class=system') . '><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_groups[] value="' . $i_rSet1->fields["groupid"] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet1->fields["groupid"] . '</td><td>' . getTruncatedHTML($i_rSet1->fields["group_name"]) . '</td><td>' . $i_rSet1->fields["group_description"] . '</td>'; echo '<td align=center width=22><a href="groups.php?groupid=' . $i_rSet1->fields["groupid"] . $i_order_addon . $i_url_limit_addon . '&action=edit"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_group_edit'] . '"></a></td><td align=center width=22>' . ($i_rSet1->fields["groupid"] > SYSTEM_GROUP_MAX_INDEX ? '<a href="groups.php?groupid=' . $i_rSet1->fields["groupid"] . $i_order_addon . $i_url_limit_addon . '&action=delete" onclick="return confirmMessage(this, \'' . $lngstr['qst_delete_group'] . '\')"><img width=20 height=20 border=0 src="images/button-cross.gif" title="' . $lngstr['label_action_group_delete'] . '"></a>' : '<img width=20 height=20 border=0 src="images/button-cross-inactive.gif">') . '</td></tr>'; $i_counter++; $i_pagewide_id++; $i_rSet1->MoveNext(); } $i_rSet1->Close(); } echo '</table>'; echo '</td></tr></table></form>'; displayTemplate('_footer');
function getAdvancedReportPDF($resultid) { global $g_db, $G_SESSION, $DOCUMENT_FPDF, $lngstr, $srv_settings, $i_rSet2, $i_rSet3, $i_rSet4, $i_rSet5, $i_rSet6; ob_start(); include_once $DOCUMENT_FPDF . 'html2fpdf.php'; $i_pdf = false; $i_can_access = false; if ($G_SESSION['access_reportsmanager'] > 1) { $i_can_access = true; } else { $i_rSet1 = $g_db->Execute("SELECT resultid FROM " . $srv_settings['table_prefix'] . "results WHERE id=" . $G_SESSION['id'] . " AND resultid=" . $resultid); if (!$i_rSet1) { showDBError(__FILE__, 1); } else { $i_can_access = $i_rSet1->RecordCount() > 0; } } $i_isok = $i_can_access; if ($i_isok) { $i_isok = $i_rSet2 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "results WHERE resultid=" . $resultid, 1); } if ($i_isok) { $i_isok = !$i_rSet2->EOF; } if ($i_isok) { $i_isok = $i_rSet3 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "tests WHERE testid=" . $i_rSet2->fields['testid'], 1); } if ($i_isok) { $i_isok = !$i_rSet3->EOF; } if ($i_isok) { $i_isok = $i_rSet3->fields['rtemplateid'] > 0 && ($i_rSet3->fields['test_reportgradecondition'] == 0 || $i_rSet3->fields['test_reportgradecondition'] >= $i_rSet2->fields['gscale_gradeid']); } if ($i_isok) { $i_isok = $i_rSet6 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "users WHERE id=" . $i_rSet2->fields['id'], 1); } if ($i_isok) { $i_isok = !$i_rSet6->EOF; } $i_result_detailed_1_items = array(); $i_result_detailed_2_items = array(); $i_result_detailed_3_items = array(); $i_result_detailed_4_items = array(); if ($i_isok) { $i_isok = $i_rSet7 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "results_answers, " . $srv_settings['table_prefix'] . "questions WHERE resultid=" . $resultid . " AND " . $srv_settings['table_prefix'] . "results_answers.questionid=" . $srv_settings['table_prefix'] . "questions.questionid ORDER BY result_answerid"); } if ($i_isok) { $i_questionno = 0; while (!$i_rSet7->EOF) { $i_questionno++; $i_answers = array(); $i_rSet5 = $g_db->Execute("SELECT answer_text, answer_correct FROM " . $srv_settings['table_prefix'] . "answers WHERE questionid=" . $i_rSet7->fields['questionid'] . " ORDER BY answerid"); if (!$i_rSet5) { showDBError(__FILE__, 5); } else { $i_answerno = 1; while (!$i_rSet5->EOF) { $i_answers[$i_answerno] = $i_rSet5->fields['answer_text']; $i_answers_correct[$i_answerno] = $i_rSet5->fields['answer_correct']; $i_answerno++; $i_rSet5->MoveNext(); } $i_rSet5->Close(); } $i_detailed_correct = $i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT; $i_result_detailed_3_items[$i_questionno] = $i_questionno . '. ' . getTruncatedHTML($i_rSet7->fields['question_text'], 0); $i_result_detailed_1_items[$i_questionno] = $i_result_detailed_3_items[$i_questionno] . '<br />'; $i_result_detailed_1_items[$i_questionno] .= $lngstr['email_answer_iscorrect'] . ($i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_UNDEFINED ? $lngstr['label_undefined'] : ($i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT ? $lngstr['label_yes'] : ($i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_PARTIALLYCORRECT ? $lngstr['label_partially'] : $lngstr['label_no']))) . '<br />'; $i_result_detailed_1_items[$i_questionno] .= $lngstr['email_answer_points'] . $i_rSet7->fields['result_answer_points'] . '<br />'; if (!$i_detailed_correct) { $i_result_detailed_2_items[$i_questionno] = $i_result_detailed_1_items[$i_questionno]; } $i_result_detailed_3_items[$i_questionno] = '<tr><td>' . $i_result_detailed_3_items[$i_questionno] . '</td></tr>'; for ($i = 1; $i < $i_answerno; $i++) { switch ($i_rSet7->fields['question_type']) { case QUESTION_TYPE_MULTIPLECHOICE: case QUESTION_TYPE_TRUEFALSE: $i_answers_given = (int) $i_rSet7->fields['result_answer_text']; $i_result_detailed_3_items[$i_questionno] .= '<tr><td><img src="images/button-checkbox-' . ($i_answers_correct[$i] ? '2' : ($i == $i_answers_given ? '4' : '0')) . '.gif" width=13 height=13> ' . $i_answers[$i] . '</tr>'; break; case QUESTION_TYPE_MULTIPLEANSWER: $i_answers_given = explode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $i_rSet7->fields['result_answer_text']); $i_result_detailed_3_items[$i_questionno] .= '<tr><td><img src="images/button-checkbox-' . ($i_answers_correct[$i] ? '2' : (in_array($i, $i_answers_given) ? '4' : '0')) . '.gif" width=13 height=13> ' . $i_answers[$i] . '</tr>'; break; case QUESTION_TYPE_FILLINTHEBLANK: $i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . nl2br($i_answers[$i]) . '</td></tr>'; break; } } if ($i_rSet7->fields['question_type'] == QUESTION_TYPE_ESSAY) { $i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . nl2br($i_rSet7->fields['result_answer_text']) . '</td></tr>'; } $i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . $lngstr['email_answer_points'] . $i_rSet7->fields['result_answer_points'] . '</td></tr>'; if (!$i_detailed_correct) { $i_result_detailed_4_items[$i_questionno] = $i_result_detailed_3_items[$i_questionno]; } $i_rSet7->MoveNext(); } $i_rSet7->Close(); $i_result_detailed_1_text = implode('<br />', $i_result_detailed_1_items); $i_result_detailed_2_text = implode('<br />', $i_result_detailed_2_items); $i_result_detailed_3_text = '<table cellpadding=0 cellspacing=0 border=0 width="100%">' . implode("\n", $i_result_detailed_3_items) . '</table>'; $i_result_detailed_4_text = '<table cellpadding=0 cellspacing=0 border=0 width="100%">' . implode("\n", $i_result_detailed_4_items) . '</table>'; $i_result_detailed_5_text = ''; $i_result_detailed_6_text = ''; $i_pdf = eventOnQueryCustomReportPDF(); if (empty($i_pdf)) { $i_pdf = new HTML2FPDF(); $i_pdf->AddPage(); $i_pdf->SetFont('Arial', '', 11); $i_pdf->SetTextColor(0, 0, 0); $g_vars['page']['grade'] = getGradeData($i_rSet2->fields['gscaleid'], $i_rSet2->fields['gscale_gradeid']); $g_vars['page']['subjects'] = getTestResultSubjectsData($resultid); $i_template_body = getReportTemplate(array('rtemplateid' => $i_rSet3->fields['rtemplateid'], 'username' => $i_rSet6->fields['username'], 'email' => $i_rSet6->fields['email'], 'title' => $i_rSet6->fields['user_title'], 'firstname' => $i_rSet6->fields['user_firstname'], 'lastname' => $i_rSet6->fields['user_lastname'], 'middlename' => $i_rSet6->fields['user_middlename'], 'address' => $i_rSet6->fields['user_address'], 'city' => $i_rSet6->fields['user_city'], 'state' => $i_rSet6->fields['user_state'], 'zip' => $i_rSet6->fields['user_zip'], 'country' => $i_rSet6->fields['user_country'], 'phone' => $i_rSet6->fields['user_phone'], 'fax' => $i_rSet6->fields['user_fax'], 'mobile' => $i_rSet6->fields['user_mobile'], 'pager' => $i_rSet6->fields['user_pager'], 'ipphone' => $i_rSet6->fields['user_ipphone'], 'webpage' => $i_rSet6->fields['user_webpage'], 'icq' => $i_rSet6->fields['user_icq'], 'msn' => $i_rSet6->fields['user_msn'], 'aol' => $i_rSet6->fields['user_aol'], 'gender' => $i_rSet6->fields['user_gender'], 'birthday' => $i_rSet6->fields['user_birthday'], 'husbandwife' => $i_rSet6->fields['user_husbandwife'], 'children' => $i_rSet6->fields['user_children'], 'trainer' => $i_rSet6->fields['user_trainer'], 'photo' => $i_rSet6->fields['user_photo'], 'company' => $i_rSet6->fields['user_company'], 'cposition' => $i_rSet6->fields['user_cposition'], 'department' => $i_rSet6->fields['user_department'], 'coffice' => $i_rSet6->fields['user_coffice'], 'caddress' => $i_rSet6->fields['user_caddress'], 'ccity' => $i_rSet6->fields['user_ccity'], 'cstate' => $i_rSet6->fields['user_cstate'], 'czip' => $i_rSet6->fields['user_czip'], 'ccountry' => $i_rSet6->fields['user_ccountry'], 'cphone' => $i_rSet6->fields['user_cphone'], 'cfax' => $i_rSet6->fields['user_cfax'], 'cmobile' => $i_rSet6->fields['user_cmobile'], 'cpager' => $i_rSet6->fields['user_cpager'], 'cipphone' => $i_rSet6->fields['user_cipphone'], 'cwebpage' => $i_rSet6->fields['user_cwebpage'], 'cphoto' => $i_rSet6->fields['user_cphoto'], 'ufield1' => $i_rSet6->fields['user_ufield1'], 'ufield2' => $i_rSet6->fields['user_ufield2'], 'ufield3' => $i_rSet6->fields['user_ufield3'], 'ufield4' => $i_rSet6->fields['user_ufield4'], 'ufield5' => $i_rSet6->fields['user_ufield5'], 'ufield6' => $i_rSet6->fields['user_ufield6'], 'ufield7' => $i_rSet6->fields['user_ufield7'], 'ufield8' => $i_rSet6->fields['user_ufield8'], 'ufield9' => $i_rSet6->fields['user_ufield9'], 'ufield10' => $i_rSet6->fields['user_ufield10'], 'test_name' => $i_rSet3->fields['test_name'], 'result_id' => $resultid, 'result_date' => getDateLocal($lngstr['language']['date_format_full'], $i_rSet2->fields['result_datestart']), 'result_time_spent' => getTimeFormatted($i_rSet2->fields['result_timespent']), 'result_time_exceeded' => $i_rSet2->fields['result_timeexceeded'] > 0 ? $lngstr['label_yes'] : $lngstr['label_no'], 'result_points_scored' => $i_rSet2->fields['result_points'], 'result_points_possible' => $i_rSet2->fields['result_pointsmax'], 'result_percents' => $i_rSet2->fields['result_pointsmax'] > 0 ? round($i_rSet2->fields['result_points'] * 100 / $i_rSet2->fields['result_pointsmax']) : 0, 'result_grade' => $g_vars['page']['grade']['name'], 'result_grade_feedback' => $g_vars['page']['grade']['feedback'], 'result_subjects' => $g_vars['page']['subjects'], 'result_detailed_1' => $i_result_detailed_1_text, 'result_detailed_2' => $i_result_detailed_2_text, 'result_detailed_3' => $i_result_detailed_3_text, 'result_detailed_4' => $i_result_detailed_4_text, 'result_detailed_5' => $i_result_detailed_5_text, 'result_detailed_6' => $i_result_detailed_6_text)); $i_pdf->WriteHTML($i_template_body); } } else { $i_pdf = false; } ob_end_clean(); return $i_pdf; }
echo '<td width=32><a href="test-manager.php?action=edits&testid=' . $f_testid . '&pageno=' . min($i_pageno + 1, $i_pageno_count) . $i_url_limitto_addon . $i_order_addon . '"><img src="images/button-next-big.gif" border=0 title="' . $lngstr['button_next_page'] . '"></a></td>'; echo '<td width=32><a href="test-manager.php?action=edits&testid=' . $f_testid . '&pageno=' . $i_pageno_count . $i_url_limitto_addon . $i_order_addon . '"><img src="images/button-last-big.gif" border=0 title="' . $lngstr['button_last_page'] . '"></a></td>'; } else { echo '<td width=32><img src="images/button-next-big-inactive.gif" border=0 title="' . $lngstr['button_next_page'] . '"></td>'; echo '<td width=32><img src="images/button-last-big-inactive.gif" border=0 title="' . $lngstr['button_last_page'] . '"></td>'; } } echo '<td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>'; echo '</td></tr><tr><td>'; echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">'; echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>'; writeQryTableHeaders('test-manager.php?action=edits&testid=' . $f_testid . $i_url_limit_addon, $i_tablefields, $i_order_no, $i_direction); echo '<td class=rowhdr1 colspan=2>' . $lngstr['label_hdr_action'] . '</td></tr>'; $i_rSet1 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "sections WHERE 1=1" . $i_sql_order_addon, $i_limitcount, $i_limitfrom); if (!$i_rSet1) { showDBError(__FILE__, 1); } else { $i_counter = 0; while (!$i_rSet1->EOF) { $rowname = $i_counter % 2 ? "rowone" : "rowtwo"; echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_sections[] value="' . $i_rSet1->fields["sectionid"] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet1->fields["sectionid"] . '</td><td>' . getTruncatedHTML($i_rSet1->fields["section_name"]) . '</td><td>' . $i_rSet1->fields["section_description"] . '</td>'; echo '<td align=center width=22><a href="test-manager.php?action=edits2&testid=' . $f_testid . '§ionid=' . $i_rSet1->fields["sectionid"] . $i_order_addon . $i_url_limit_addon . '"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['page-sections']['action_section_edit'] . '"></a></td><td align=center width=22><a href="test-manager.php?action=deletes&testid=' . $f_testid . '§ionid=' . $i_rSet1->fields["sectionid"] . $i_order_addon . $i_url_limit_addon . '" onclick="return confirmMessage(this, \'' . $lngstr['page-sections']['qst_section_delete'] . '\')"><img width=20 height=20 border=0 src="images/button-cross.gif" title="' . $lngstr['page-sections']['action_section_delete'] . '"></a></td></tr>'; $i_counter++; $i_pagewide_id++; $i_rSet1->MoveNext(); } $i_rSet1->Close(); } echo '</table>'; echo '</td></tr></table></form>'; displayTemplate('_footer');
echo '<td width=32><img src="images/button-last-big-inactive.gif" border=0 title="' . $lngstr['button_last_page'] . '"></td>'; } } echo '<td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>'; echo '</td></tr><tr><td>'; echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">'; echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>'; writeQryTableHeaders('users.php?action=groups' . $i_ids_addon . $i_order_addon . $i_2_url_limit_addon, $i_2_tablefields, $i_2_order_no, $i_2_direction, '2'); echo '<td class=rowhdr1 title="' . $lngstr['label_managegroups_hdr_member_of_hint'] . '" vAlign=top>' . $lngstr['label_managegroups_hdr_member_of'] . '</td>'; echo '<td class=rowhdr1 colspan=2>' . $lngstr['label_hdr_action'] . '</td></tr>'; //9917 $i_rSet2 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "groups" . $i_2_sql_order_addon, $i_2_limitcount, $i_2_limitfrom); if (!$i_rSet2) { showDBError(__FILE__, 2); } else { $i_counter = 0; while (!$i_rSet2->EOF) { //9917//9917 $i_member_count = getRecordCount($srv_settings['table_prefix'] . 'groups_users', ($f_ids ? "id IN (" . implode(',', $f_ids) . ") AND " : "") . "groupid=" . $i_rSet2->fields["groupid"]); $rowname = $i_counter % 2 ? "rowone" : "rowtwo"; echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22' . ($i_rSet2->fields["groupid"] > SYSTEM_GROUP_MAX_INDEX ? '' : ' class=system') . '><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_groups[] value="' . $i_rSet2->fields["groupid"] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet2->fields["groupid"] . '</td><td>' . getTruncatedHTML($i_rSet2->fields["group_name"]) . '</td><td>' . $i_rSet2->fields["group_description"] . '</td><td align=center><a href="users.php?action=memberof&groupid=' . $i_rSet2->fields["groupid"] . $i_order_addon . $i_ids_addon . $i_2_order_addon . $i_2_url_limit_addon . '&set=' . ($i_member_count >= sizeof($f_ids) ? '0"><img src="images/button-checkbox-2.gif" width=13 height=13 border=0 title="' . $lngstr['label_yes'] . '">' : ($i_member_count > 0 ? '1"><img src="images/button-checkbox-1.gif" width=13 height=13 border=0 title="' . $lngstr['label_partially'] . '">' : '1"><img src="images/button-checkbox-0.gif" width=13 height=13 border=0 title="' . $lngstr['label_no'] . '">')) . '</a></td>'; echo '<td align=center width=22><a href="groups.php?groupid=' . $i_rSet2->fields["groupid"] . '&action=edit"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_group_edit'] . '"></a></td><td align=center width=22>' . ($i_rSet2->fields["groupid"] > SYSTEM_GROUP_MAX_INDEX ? '<a href="groups.php?groupid=' . $i_rSet2->fields["groupid"] . '&action=delete" onclick="return confirmMessage(this, \'' . $lngstr['qst_delete_group'] . '\')"><img width=20 height=20 border=0 src="images/button-cross.gif" title="' . $lngstr['label_action_group_delete'] . '"></a>' : '<img width=20 height=20 border=0 src="images/button-cross-inactive.gif">') . '</td></tr>'; $i_counter++; $i_pagewide_id++; $i_rSet2->MoveNext(); } $i_rSet2->Close(); } echo '</table>'; echo '</td></tr></table></form>'; displayTemplate('_footer');
$i_result_detailed_1_items[$i_questionno] = $i_result_detailed_3_items[$i_questionno]; $i_result_detailed_1_items[$i_questionno] .= $lngstr['email_answer_iscorrect'] . ($i_rSet3->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_UNDEFINED ? $lngstr['label_undefined'] : ($i_rSet3->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT ? $lngstr['label_yes'] : ($i_rSet3->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_PARTIALLYCORRECT ? $lngstr['label_partially'] : $lngstr['label_no']))) . "\n"; $i_result_detailed_1_items[$i_questionno] .= $lngstr['email_answer_points'] . $i_rSet3->fields['result_answer_points'] . "\n"; if (!$i_detailed_correct) { $i_result_detailed_2_items[$i_questionno] = $i_result_detailed_1_items[$i_questionno]; } for ($i = 1; $i < $i_answerno; $i++) { switch ($i_rSet3->fields['question_type']) { case QUESTION_TYPE_MULTIPLECHOICE: case QUESTION_TYPE_TRUEFALSE: $i_answers_given = (int) $i_rSet3->fields['result_answer_text']; $i_result_detailed_3_items[$i_questionno] .= '[' . ($i_answers_correct[$i] ? 'v' : ($i == $i_answers_given ? 'x' : ' ')) . '] ' . getTruncatedHTML($i_answers[$i], 0) . "\n"; break; case QUESTION_TYPE_MULTIPLEANSWER: $i_answers_given = explode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $i_rSet3->fields['result_answer_text']); $i_result_detailed_3_items[$i_questionno] .= '[' . ($i_answers_correct[$i] ? 'v' : (in_array($i, $i_answers_given) ? 'x' : ' ')) . '] ' . getTruncatedHTML($i_answers[$i], 0) . "\n"; break; case QUESTION_TYPE_FILLINTHEBLANK: $i_result_detailed_3_items[$i_questionno] .= '"' . nl2br($i_answers[$i]) . '"' . "\n"; break; } } $i_result_detailed_3_items[$i_questionno] .= $lngstr['email_answer_points'] . $i_rSet3->fields['result_answer_points'] . "\n"; if (!$i_detailed_correct) { $i_result_detailed_4_items[$i_questionno] = $i_result_detailed_3_items[$i_questionno]; } $i_rSet3->MoveNext(); } $i_rSet3->Close(); } $i_result_detailed_1_text = implode("\n", $i_result_detailed_1_items);
$g_vars['page']['questionindicator_hint'] = sprintf($lngstr['page_test']['questionindicator_hint'], $G_SESSION['yt_questionno_current'], $G_SESSION['yt_questioncount']); $g_vars['page']['questionindicator'] = sprintf($lngstr['page_test']['questionindicator'], $G_SESSION['yt_questionno_current'], $G_SESSION['yt_questioncount']); $g_vars['page']['testid'] = $G_SESSION['testid']; $g_vars['page']['test_name'] = convertTextValue($G_SESSION['yt_name']); $g_vars['page']['content_protection'] = $G_SESSION['yt_contentprotection']; if (!isset($G_SESSION['questionid'])) { $nQuestionNoReal = $G_SESSION['yt_questions'][$G_SESSION['yt_questionno_current'] - 1]; $G_SESSION['questionid'] = $G_SESSION['yt_questionids'][$nQuestionNoReal]; $G_SESSION['yt_questionstart'] = time(); } $g_vars['page']['has_feedback'] = $G_SESSION['yt_state'] == TEST_STATE_QFEEDBACK; readTestQuestion($G_SESSION['yt_questionno_current'], $G_SESSION['questionid']); $G_SESSION['yt_page_hasfeedback'] = $g_vars['page']['has_feedback']; if ($g_vars['page']['errors_fatal'] && $G_SESSION['yt_state'] != TEST_STATE_QFEEDBACK) { unregisterTestData(); } $g_vars['page']['variables']['yt_questionno'] = $G_SESSION['yt_questionno']; $g_vars['page']['variables']['yt_questionno_current'] = $G_SESSION['yt_questionno_current']; $g_vars['page']['variables']['yt_questioncount'] = $G_SESSION['yt_questioncount']; $g_vars['page']['variables']['yt_state'] = $G_SESSION['yt_state']; $g_vars['page']['review']['mode'] = $G_SESSION['yt_canreview']; if ($G_SESSION['yt_canreview'] == IGT_TEST_REVIEW_ALLOWED) { for ($nQuestionNo = 1; $nQuestionNo <= min($G_SESSION['yt_questionno'], $G_SESSION['yt_questioncount']); $nQuestionNo++) { $nQuestionNoReal = $G_SESSION['yt_questions'][$nQuestionNo - 1]; $nQuestionID = $G_SESSION['yt_questionids'][$nQuestionNoReal]; $g_vars['page']['review']['question'][$nQuestionNo]['text_truncated'] = getTruncatedHTML(getRecordItem($srv_settings['table_prefix'] . 'questions', 'question_text', 'questionid=' . $nQuestionID)); } } $g_smarty->assign('g_questionno', $G_SESSION['yt_questionno_current']); $g_smarty->assign('g_vars', $g_vars); displayTemplate('test-question');
echo '<td width=32><a href="grades.php?action=edit&gscaleid=' . $f_gscaleid . '&pageno=' . min($i_pageno + 1, $i_pageno_count) . $i_url_limitto_addon . $i_order_addon . '"><img src="images/button-next-big.gif" border=0 title="' . $lngstr['button_next_page'] . '"></a></td>'; echo '<td width=32><a href="grades.php?action=edit&gscaleid=' . $f_gscaleid . '&pageno=' . $i_pageno_count . $i_url_limitto_addon . $i_order_addon . '"><img src="images/button-last-big.gif" border=0 title="' . $lngstr['button_last_page'] . '"></a></td>'; } else { echo '<td width=32><img src="images/button-next-big-inactive.gif" border=0 title="' . $lngstr['button_next_page'] . '"></td>'; echo '<td width=32><img src="images/button-last-big-inactive.gif" border=0 title="' . $lngstr['button_last_page'] . '"></td>'; } } echo '<td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>'; echo '</td></tr><tr><td>'; echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">'; echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>'; writeQryTableHeaders('grades.php?action=edit&gscaleid=' . $f_gscaleid . $i_url_limit_addon, $i_tablefields, $i_order_no, $i_direction); echo '<td class=rowhdr1 colspan=3>' . $lngstr['label_hdr_action'] . '</td></tr>'; $i_rSet1 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "gscales_grades WHERE gscaleid=" . $f_gscaleid . $i_sql_order_addon, $i_limitcount, $i_limitfrom); if (!$i_rSet1) { showDBError(__FILE__, 1); } else { $i_counter = 0; while (!$i_rSet1->EOF) { $rowname = $i_counter % 2 ? "rowone" : "rowtwo"; echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_gradescales[] value="' . $i_rSet1->fields["gscale_gradeid"] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet1->fields["gscale_gradeid"] . '</td><td align=right>' . sprintf("%.2f", $i_rSet1->fields["grade_from"]) . '%</td><td align=right>' . sprintf("%.2f", $i_rSet1->fields["grade_to"] == 100 || $i_rSet1->fields["grade_to"] == 0 ? $i_rSet1->fields["grade_to"] : $i_rSet1->fields["grade_to"] - 0.01) . '%</td><td>' . getTruncatedHTML($i_rSet1->fields["grade_name"]) . '</td><td>' . $i_rSet1->fields["grade_description"] . '</td>'; echo '<td align=center width=22><a href="grades.php?gscaleid=' . $f_gscaleid . '&gscale_gradeid=' . $i_rSet1->fields["gscale_gradeid"] . '&action=edits"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_gradescale_edit'] . '"></a></td><td align=center width=22><a href="grades.php?gscaleid=' . $f_gscaleid . '&gscale_gradeid=' . $i_rSet1->fields["gscale_gradeid"] . '&action=moveup"><img width=20 height=10 border=0 src="images/button-up.gif" title="' . $lngstr['label_action_grade_moveup'] . '"></a><br><a href="grades.php?gscaleid=' . $f_gscaleid . '&gscale_gradeid=' . $i_rSet1->fields["gscale_gradeid"] . '&action=movedown"><img width=20 height=10 border=0 src="images/button-down.gif" title="' . $lngstr['label_action_grade_movedown'] . '"></a></td><td align=center width=22><a href="grades.php?gscaleid=' . $f_gscaleid . '&gscale_gradeid=' . $i_rSet1->fields["gscale_gradeid"] . $i_url_limit_addon . '&action=deletes" onclick="return confirmMessage(this, \'' . $lngstr['qst_delete_gradescale'] . '\')"><img width=20 height=20 border=0 src="images/button-cross.gif" title="' . $lngstr['label_action_gradescale_delete'] . '"></a></td></tr>'; $i_counter++; $i_pagewide_id++; $i_rSet1->MoveNext(); } $i_rSet1->Close(); } echo '</table>'; echo '</td></tr></table></form>'; displayTemplate('_footer');
echo '<td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>'; echo '</td></tr><tr><td>'; echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">'; echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>'; writeQryTableHeaders('test-manager.php?action=editt&testid=' . $f_testid . $i_subjectid_addon . $i_order_addon . $i_url_limit_addon . $i_2_subjectid_addon . $i_2_url_limit_addon, $i_2_tablefields, $i_2_order_no, $i_2_direction, '2'); echo '<td class=rowhdr1 colspan=3>' . $lngstr['label_hdr_action'] . '</td></tr>'; $i_rSet2 = $g_db->SelectLimit("SELECT " . $srv_settings['table_prefix'] . "questions.questionid, " . $srv_settings['table_prefix'] . "questions.subjectid, " . $srv_settings['table_prefix'] . "questions.question_text, " . $srv_settings['table_prefix'] . "questions.question_time, " . $srv_settings['table_prefix'] . "questions.question_type, " . $srv_settings['table_prefix'] . "questions.question_points, " . $srv_settings['table_prefix'] . "subjects.subject_name FROM " . $srv_settings['table_prefix'] . "questions, " . $srv_settings['table_prefix'] . "subjects WHERE " . $i_2_sql_where_addon . "" . $srv_settings['table_prefix'] . "questions.subjectid=" . $srv_settings['table_prefix'] . "subjects.subjectid" . $i_2_sql_order_addon, $i_2_limitcount, $i_2_limitfrom); if (!$i_rSet2) { showDBError(__FILE__, 2); } else { $i_counter = 0; while (!$i_rSet2->EOF) { $rowname = $i_counter % 2 ? 'rowone' : 'rowtwo'; $i_rowtitle = ''; if (!in_array($i_rSet2->fields['questionid'], $i_questionids_in_the_test) || $i_rSet2->fields['question_type'] == QUESTION_TYPE_RANDOM) { echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' title="' . $i_rowtitle . '" onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_questions[] value="' . $i_rSet2->fields['questionid'] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet2->fields['questionid'] . '</td><td><a href="test-manager.php?testid=' . $f_testid . (isset($_GET['subjectid2']) && $_GET['subjectid2'] != '' ? '' : '&subjectid2=' . $i_rSet2->fields['subjectid']) . $i_subjectid_addon . $i_order_addon . $i_url_limit_addon . $i_2_order_addon . $i_2_url_limit_addon . '&action=editt">' . convertTextValue($i_rSet2->fields['subject_name']) . '</a></td><td>' . getTruncatedHTML($i_rSet2->fields['question_text']) . '</td><td>'; switch ($i_rSet2->fields['question_type']) { case QUESTION_TYPE_MULTIPLECHOICE: echo $lngstr['label_atype_multiple_choice']; break; case QUESTION_TYPE_TRUEFALSE: echo $lngstr['label_atype_truefalse']; break; case QUESTION_TYPE_MULTIPLEANSWER: echo $lngstr['label_atype_multiple_answer']; break; case QUESTION_TYPE_FILLINTHEBLANK: echo $lngstr['label_atype_fillintheblank']; break; case QUESTION_TYPE_ESSAY: echo $lngstr['label_atype_essay'];
function getTestAnswerDetails($resultid, $output_format = 'html') { global $g_db, $lngstr, $srv_settings; $i_result = array(); $i_result_detailed_1_text = ''; $i_result_detailed_2_text = ''; $i_result_detailed_3_text = ''; $i_result_detailed_4_text = ''; $i_result_detailed_5_text = ''; $i_result_detailed_6_text = ''; $i_result_detailed_1_items = array(); $i_result_detailed_2_items = array(); $i_result_detailed_3_items = array(); $i_result_detailed_4_items = array(); $i_rSet7 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "results_answers, " . $srv_settings['table_prefix'] . "questions WHERE resultid=" . $resultid . " AND " . $srv_settings['table_prefix'] . "results_answers.questionid=" . $srv_settings['table_prefix'] . "questions.questionid ORDER BY result_answerid"); if (!$i_rSet7) { } else { $i_questionno = 0; while (!$i_rSet7->EOF) { $i_questionno++; $i_answers = array(); $i_rSet5 = $g_db->Execute("SELECT answer_text, answer_correct FROM " . $srv_settings['table_prefix'] . "answers WHERE questionid=" . $i_rSet7->fields['questionid'] . " ORDER BY answerid"); if (!$i_rSet5) { } else { $i_answerno = 1; while (!$i_rSet5->EOF) { $i_answers[$i_answerno] = $i_rSet5->fields['answer_text']; $i_answers_correct[$i_answerno] = $i_rSet5->fields['answer_correct']; $i_answerno++; $i_rSet5->MoveNext(); } $i_rSet5->Close(); } $i_detailed_correct = $i_rSet7->fields['result_answer_iscorrect'] == 2; $i_result_detailed_3_items[$i_questionno] = $i_questionno . '. ' . getTruncatedHTML($i_rSet7->fields['question_text'], 0); $i_result_detailed_1_items[$i_questionno] = $i_result_detailed_3_items[$i_questionno] . '<br />'; $i_result_detailed_1_items[$i_questionno] .= $lngstr['email_answer_iscorrect'] . ($i_rSet7->fields['result_answer_iscorrect'] == 3 ? $lngstr['label_undefined'] : ($i_rSet7->fields['result_answer_iscorrect'] == 2 ? $lngstr['label_yes'] : ($i_rSet7->fields['result_answer_iscorrect'] == 1 ? $lngstr['label_partially'] : $lngstr['label_no']))) . '<br />'; $i_result_detailed_1_items[$i_questionno] .= $lngstr['email_answer_points'] . $i_rSet7->fields['result_answer_points'] . '<br />'; if (!$i_detailed_correct) { $i_result_detailed_2_items[$i_questionno] = $i_result_detailed_1_items[$i_questionno]; } $i_result_detailed_3_items[$i_questionno] = '<tr><td>' . $i_result_detailed_3_items[$i_questionno] . '</td></tr>'; for ($i = 1; $i < $i_answerno; $i++) { switch ($i_rSet7->fields['question_type']) { case QUESTION_TYPE_MULTIPLECHOICE: case QUESTION_TYPE_TRUEFALSE: $i_answers_given = (int) $i_rSet7->fields['result_answer_text']; $i_result_detailed_3_items[$i_questionno] .= '<tr><td><img src="images/button-checkbox-' . ($i_answers_correct[$i] ? '2' : ($i == $i_answers_given ? '4' : '0')) . '.gif" width=13 height=13> ' . $i_answers[$i] . '</tr>'; break; case QUESTION_TYPE_MULTIPLEANSWER: $i_answers_given = explode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $i_rSet7->fields['result_answer_text']); $i_result_detailed_3_items[$i_questionno] .= '<tr><td><img src="images/button-checkbox-' . ($i_answers_correct[$i] ? '2' : (in_array($i, $i_answers_given) ? '4' : '0')) . '.gif" width=13 height=13> ' . $i_answers[$i] . '</tr>'; break; case QUESTION_TYPE_FILLINTHEBLANK: $i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . nl2br($i_answers[$i]) . '</td></tr>'; break; } } if ($i_rSet7->fields['question_type'] == QUESTION_TYPE_ESSAY) { $i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . nl2br($i_rSet7->fields['result_answer_text']) . '</td></tr>'; } $i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . $lngstr['email_answer_points'] . $i_rSet7->fields['result_answer_points'] . '</td></tr>'; $i_result_detailed_3_items[$i_questionno] .= '<tr><td><img src="images/1x1.gif" width=1 height=7></td></tr>'; if (!$i_detailed_correct) { $i_result_detailed_4_items[$i_questionno] = $i_result_detailed_3_items[$i_questionno]; } $i_rSet7->MoveNext(); } $i_rSet7->Close(); $i_result_detailed_1_text = implode('<br />', $i_result_detailed_1_items); $i_result_detailed_2_text = implode('<br />', $i_result_detailed_2_items); $i_result_detailed_3_text = '<table cellpadding=0 cellspacing=0 border=0 width="100%">' . implode("\n", $i_result_detailed_3_items) . '</table>'; $i_result_detailed_4_text = '<table cellpadding=0 cellspacing=0 border=0 width="100%">' . implode("\n", $i_result_detailed_4_items) . '</table>'; } $i_result['result_detailed_1'] = $i_result_detailed_1_text; $i_result['result_detailed_2'] = $i_result_detailed_2_text; $i_result['result_detailed_3'] = $i_result_detailed_3_text; $i_result['result_detailed_4'] = $i_result_detailed_4_text; $i_result['result_detailed_5'] = $i_result_detailed_5_text; $i_result['result_detailed_6'] = $i_result_detailed_6_text; return $i_result; }
} } echo '<td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>'; echo '</td></tr><tr><td>'; echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">'; echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>'; writeQryTableHeaders('question-bank.php?action=' . $i_subjectid_addon . $i_url_limit_addon, $i_tablefields, $i_order_no, $i_direction); echo '<td class=rowhdr1 colspan=3>' . $lngstr['label_hdr_action'] . '</td></tr>'; $i_rSet1 = $g_db->SelectLimit("SELECT " . $srv_settings['table_prefix'] . "questions.questionid, " . $srv_settings['table_prefix'] . "questions.subjectid, " . $srv_settings['table_prefix'] . "questions.question_text, " . $srv_settings['table_prefix'] . "questions.question_time, " . $srv_settings['table_prefix'] . "questions.question_type, " . $srv_settings['table_prefix'] . "questions.question_points, " . $srv_settings['table_prefix'] . "subjects.subject_name FROM " . $srv_settings['table_prefix'] . "questions, " . $srv_settings['table_prefix'] . "subjects WHERE " . $i_sql_where_addon . "" . $srv_settings['table_prefix'] . "questions.subjectid=" . $srv_settings['table_prefix'] . "subjects.subjectid" . $i_sql_order_addon, $i_limitcount, $i_limitfrom); if (!$i_rSet1) { showDBError(__FILE__, 1); } else { $i_counter = 0; while (!$i_rSet1->EOF) { $rowname = $i_counter % 2 ? "rowone" : "rowtwo"; echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_questions[] value="' . $i_rSet1->fields["questionid"] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet1->fields["questionid"] . '</td><td><a href="question-bank.php?action=editt' . (isset($_GET["subjectid"]) && $_GET["subjectid"] != "" ? "" : '&subjectid=' . $i_rSet1->fields["subjectid"]) . $i_order_addon . $i_url_limit_addon . '">' . convertTextValue($i_rSet1->fields["subject_name"]) . '</a></td><td>' . getTruncatedHTML($i_rSet1->fields["question_text"]) . '</td><td>'; switch ($i_rSet1->fields["question_type"]) { case QUESTION_TYPE_MULTIPLECHOICE: echo $lngstr['label_atype_multiple_choice']; break; case QUESTION_TYPE_TRUEFALSE: echo $lngstr['label_atype_truefalse']; break; case QUESTION_TYPE_MULTIPLEANSWER: echo $lngstr['label_atype_multiple_answer']; break; case QUESTION_TYPE_FILLINTHEBLANK: echo $lngstr['label_atype_fillintheblank']; break; case QUESTION_TYPE_ESSAY: echo $lngstr['label_atype_essay'];