AND testlog_id=' . $testlog_id . ' LIMIT 1'; } if ($sql) { if ($r = F_db_query($sql, $db)) { if ($m = F_db_fetch_array($r)) { $testlog_id = $m['testlog_id']; $test_id = $m['test_id']; $testlog_score = $m['testlog_score']; $testlog_comment = $m['testlog_comment']; $test_score_right = round($m['test_score_right'] * $m['question_difficulty'], 3); $test_score_wrong = round($m['test_score_wrong'] * $m['question_difficulty'], 3); $test_score_unanswered = round($m['test_score_unanswered'] * $m['question_difficulty'], 3); $question = F_decode_tcecode($m['question_description']); $explanation = F_decode_tcecode($m['question_explanation']); $answer = F_decode_tcecode($m['testlog_answer_text']); } else { $testlog_id = ''; $testlog_score = ''; $test_score_right = 1; $test_score_wrong = 0; $test_score_unanswered = 0; $question = ''; $explanation = ''; $answer = ''; $testlog_comment = ''; } } else { F_display_db_error(); } }
if ($subject_module_id > 0) { echo '<a href="tce_edit_module.php?module_id=' . $subject_module_id . '" title="' . $l['t_modules_editor'] . '" class="xmlbutton">< ' . $l['t_modules_editor'] . '</a>'; } echo '</span>' . K_NEWLINE; echo '<span class="right">' . K_NEWLINE; if (isset($subject_id) and $subject_id > 0) { echo '<a href="tce_edit_question.php?subject_module_id=' . $subject_module_id . '&question_subject_id=' . $subject_id . '" title="' . $l['t_questions_editor'] . '" class="xmlbutton">' . $l['t_questions_editor'] . ' ></a>'; } echo ' ' . K_NEWLINE; echo '</span>' . K_NEWLINE; echo ' ' . K_NEWLINE; // comma separated list of required fields echo '<input type="hidden" name="ff_required" id="ff_required" value="subject_name" />' . K_NEWLINE; echo '<input type="hidden" name="ff_required_labels" id="ff_required_labels" value="' . htmlspecialchars($l['w_name'], ENT_COMPAT, $l['a_meta_charset']) . '" />' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '<div class="row"><hr /></div>' . K_NEWLINE; echo '<div class="rowl" title="' . $l['h_preview'] . '">' . K_NEWLINE; echo $l['w_preview'] . K_NEWLINE; echo '<div class="preview">' . K_NEWLINE; echo F_decode_tcecode($subject_description); echo ' ' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '</form>' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '<div class="pagehelp">' . $l['hp_edit_subject'] . '</div>' . K_NEWLINE; echo '</div>' . K_NEWLINE; require_once '../code/tce_page_footer.php'; //============================================================+ // END OF FILE //============================================================+
} else { $pdf->Cell($data_cell_width_third, $data_cell_height, '', 1, 0, 'C', $answer_disabled); } if ($ma['answer_keyboard_key'] > 0) { $pdf->Cell($data_cell_width_third / 2, $data_cell_height, F_text_to_xml(chr($ma['answer_keyboard_key'])), 1, 0, 'C', $answer_disabled); } else { $pdf->Cell($data_cell_width_third / 2, $data_cell_height, '', 1, 0, 'C', $answer_disabled); } $pdf->Ln(); $pdf->writeHTMLCell(0, $data_cell_height, PDF_MARGIN_LEFT + 2 * $data_cell_width_third, $pdf->GetY(), F_decode_tcecode($ma['answer_description']), 1, 1, '', '', ''); if (K_ENABLE_ANSWER_EXPLANATION and !empty($ma['answer_explanation'])) { $pdf->Cell(2 * $data_cell_width_third, $data_cell_height, '', 0, 0, 'C', 0); $pdf->SetFont('', 'BIU'); $pdf->Cell(0, $data_cell_height, $l['w_explanation'], 'LTR', 1, '', 0, '', 0); $pdf->SetFont('', ''); $pdf->writeHTMLCell(0, $data_cell_height, PDF_MARGIN_LEFT + 2 * $data_cell_width_third, $pdf->GetY(), F_decode_tcecode($ma['answer_explanation']), 'LRB', 1, '', ''); } } } else { F_display_db_error(); } } // end $show_answers $pdf->Ln($data_cell_height); $itemcount++; } // end while for questions } else { F_display_db_error(); } }
$pdf->Cell(3 * $data_cell_width_third, $data_cell_height, '', 0, 0, 'C', 0); $pdf->SetFont('', 'BIU'); $pdf->Cell(0, $data_cell_height, $l['w_explanation'], 'LTR', 1, '', 0, '', 0); $pdf->SetFont('', ''); $pdf->writeHTMLCell(0, $data_cell_height, PDF_MARGIN_LEFT + 3 * $data_cell_width_third, $pdf->GetY(), F_decode_tcecode($ma['answer_explanation']), 'LRB', 1, '', ''); } } } else { F_display_db_error(); } } // end multiple answers if (strlen($mq['testlog_comment']) > 0) { // teacher / supervisor comment $pdf->SetTextColor(255, 0, 0); $pdf->writeHTMLCell(0, $data_cell_height, PDF_MARGIN_LEFT + 2 * $data_cell_width_third, $pdf->GetY(), F_decode_tcecode($mq['testlog_comment']), 1, 1); $pdf->SetTextColor(0, 0, 0); } $pdf->Ln($data_cell_height); $itemcount++; } } else { F_display_db_error(); } // start transaction $pdf->startTransaction(); $block_page = $pdf->getPage(); $print_block = 2; // 2 tries max while ($print_block > 0) { // print per-topic results
$pdf->startTransaction(); $block_page = $pdf->getPage(); $print_block = 2; // 2 tries max while ($print_block > 0) { // ------------------------------ $pdf->Cell(2 * $data_cell_width_third, $data_cell_height, '', 0, 0, 'C', 0); // print correct answer in hidden white color /* to display the correct results, from PDF viewer, go to "Accessibility" -> "Page Display preferences", check "Replace Document Colors", uncheck "Only change the color of black text or line art" */ $pdf->SetTextColor(255, 255, 255, false); $pdf->Cell($data_cell_width_third, $data_cell_height, $rightanswer, 1, 0, 'C', 0); $pdf->SetTextColor(0, 0, 0, false); $pdf->Cell($data_cell_width_third, $data_cell_height, $answ_id, 1, 0, 'R', 0); $pdf->writeHTMLCell(0, $data_cell_height, PDF_MARGIN_LEFT + $data_cell_width + $data_cell_width_third, $pdf->GetY(), F_decode_tcecode($ma['answer_description']), 1, 1); // ------------------------------ // do not split BLOCKS in multiple pages if ($pdf->getPage() == $block_page) { $print_block = 0; } else { // rolls back to the last (re)start $pdf = $pdf->rollbackTransaction(); $pdf->AddPage(); $block_page = $pdf->getPage(); --$print_block; } } // end while print_block } } else {
if (isset($question_subject_id) and $question_subject_id > 0) { echo '<a href="tce_edit_subject.php?subject_module_id=' . $subject_module_id . '&subject_id=' . $question_subject_id . '" title="' . $l['t_subjects_editor'] . '" class="xmlbutton">< ' . $l['t_subjects_editor'] . '</a>'; } echo '</span>' . K_NEWLINE; echo '<span class="right">' . K_NEWLINE; if (isset($question_id) and $question_id > 0) { echo '<a href="tce_edit_answer.php?subject_module_id=' . $subject_module_id . '&question_subject_id=' . $question_subject_id . '&answer_question_id=' . $question_id . '" title="' . $l['t_answers_editor'] . '" class="xmlbutton">' . $l['t_answers_editor'] . ' ></a>'; } echo ' ' . K_NEWLINE; echo '</span>' . K_NEWLINE; echo ' ' . K_NEWLINE; // comma separated list of required fields echo '<input type="hidden" name="ff_required" id="ff_required" value="question_description" />' . K_NEWLINE; echo '<input type="hidden" name="ff_required_labels" id="ff_required_labels" value="' . htmlspecialchars($l['w_description'], ENT_COMPAT, $l['a_meta_charset']) . '" />' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '<div class="row"><hr /></div>' . K_NEWLINE; echo '<div class="rowl" title="' . $l['h_preview'] . '">' . K_NEWLINE; echo $l['w_preview']; echo '<div class="preview">' . K_NEWLINE; echo F_decode_tcecode($question_description); echo ' ' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '</form>' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '<div class="pagehelp">' . $l['hp_edit_question'] . '</div>' . K_NEWLINE; echo '</div>' . K_NEWLINE; require_once '../code/tce_page_footer.php'; //============================================================+ // END OF FILE //============================================================+
/** * Converts tcecode text to a single XHTML string removing some objects. * @param $str (string) text to process * return string */ function F_tcecodeToLine($str) { $str = preg_replace("'\\[object\\](.*?)\\[/object([^\\]]*?)\\]'si", '[OBJ]', $str); $str = preg_replace("'\\[img([^\\]]*?)\\](.*?)\\[/img\\]'si", '[IMG]', $str); $str = preg_replace("'\\[code\\](.*?)\\[/code\\]'si", '\\1', $str); $str = preg_replace("'\\[li\\](.*?)\\[/li\\]'si", ' * \\1', $str); $str = preg_replace("'\\[\\*\\](.*?)\n'i", ' * \\1', $str); $str = preg_replace("'\\[ulist\\](.*?)\\[/ulist\\]'si", '\\1', $str); $str = preg_replace("'\\[olist([^\\]]*?)\\](.*?)\\[/olist\\]'si", '\\2', $str); $str = preg_replace("'\\[url([^\\]]*?)\\](.*?)\\[/url\\]'si", '\\2', $str); $str = preg_replace("'\\[tex\\](.*?)\\[/tex\\]'si", '[TEX]', $str); $str = F_compact_string($str); $str = F_decode_tcecode($str); $str = F_compact_string($str); if (strlen($str) > K_QUESTION_LINE_MAX_LENGTH) { $str = F_substrHTML($str, K_QUESTION_LINE_MAX_LENGTH, 20) . ' ...'; } return $str; }
echo F_decode_tcecode($ma['answer_description']); if (K_ENABLE_ANSWER_EXPLANATION and !empty($ma['answer_explanation'])) { echo '<br /><span class="explanation">' . $l['w_explanation'] . ':</span><br />' . F_decode_tcecode($ma['answer_explanation']) . '' . K_NEWLINE; } echo '</li>' . K_NEWLINE; } } else { F_display_db_error(); } echo '</ol>' . K_NEWLINE; } // end multiple answers // display teacher/supervisor comment to the question if (isset($m['testlog_comment']) and !empty($m['testlog_comment'])) { echo '<ul class="answer"><li class="comment">' . K_NEWLINE; echo F_decode_tcecode($m['testlog_comment']); echo ' </li></ul>' . K_NEWLINE; } echo '<br /><br />' . K_NEWLINE; echo '</li>' . K_NEWLINE; } echo '</ol>' . K_NEWLINE; } else { F_display_db_error(); } } echo '</div>' . K_NEWLINE; // print per-topic results echo '<div class="rowl">' . K_NEWLINE; echo '<hr />' . K_NEWLINE; echo '<h2>' . $l['w_subjects'] . '</h2>';
/** * Returns a formatted XHTML form code to handle the specified question.<br> * Form fields names are: answer_text, answer_id<br> * CSS classes:<ul> * <li>div.tcecontentbox</li> * <li>div.rowl</li> * <li>textarea.answertext</li> * </ul> * @param $test_id (int) test ID * @param $testlog_id (int) test log ID * @param $formname (string) form name (form ID) * @return string XHTML code */ function F_questionForm($test_id, $testlog_id, $formname) { require_once '../config/tce_config.php'; require_once '../../shared/code/tce_functions_tcecode.php'; global $db, $l, $examtime, $timeout_logout; $test_id = intval($test_id); $testlog_id = intval($testlog_id); $user_id = intval($_SESSION['session_user_id']); $aswkeys = array(); $str = ''; if (!isset($test_id) or $test_id == 0) { return; } $testdata = F_getTestData($test_id); $noanswer_hidden = ''; $noanswer_disabled = ''; if (!F_getBoolean($testdata['test_noanswer_enabled'])) { $noanswer_hidden = ' style="visibility:hidden;display:none;"'; $noanswer_disabled = ' readonly="readonly" disabled="disabled"'; } // select question for the first time if (!isset($testlog_id) or $testlog_id == 0) { //select first question $sql = 'SELECT testlog_id FROM ' . K_TABLE_TEST_USER . ', ' . K_TABLE_TESTS_LOGS . ' WHERE testlog_testuser_id=testuser_id AND testuser_test_id=' . $test_id . ' AND testuser_user_id=' . $user_id . ' ORDER BY testlog_id LIMIT 1'; if ($r = F_db_query($sql, $db)) { if ($m = F_db_fetch_array($r)) { $testlog_id = $m['testlog_id']; } else { return; } } else { F_display_db_error(); } } // build selection query for question to display $sql = 'SELECT * FROM ' . K_TABLE_QUESTIONS . ', ' . K_TABLE_TESTS_LOGS . ' WHERE question_id=testlog_question_id AND testlog_id=' . $testlog_id . ' LIMIT 1'; if ($r = F_db_query($sql, $db)) { if ($m = F_db_fetch_array($r)) { if (F_getBoolean($m['question_fullscreen'])) { // hide some section for fullscreen mode $str .= '<style>' . K_NEWLINE; $str .= '.header{visibility:hidden;display:none;}' . K_NEWLINE; $str .= '.infolink{visibility:hidden;display:none;}' . K_NEWLINE; $str .= 'h1{visibility:hidden;display:none;}' . K_NEWLINE; $str .= '.pagehelp{visibility:hidden;display:none;}' . K_NEWLINE; $str .= '.userbar{visibility:hidden;display:none;}' . K_NEWLINE; $str .= '.minibutton{visibility:hidden;display:none;}' . K_NEWLINE; $str .= '.navlink{visibility:hidden;display:none;}' . K_NEWLINE; $str .= '.testcomment{visibility:hidden;display:none;}' . K_NEWLINE; $str .= '#terminatetest{visibility:hidden;display:none;}' . K_NEWLINE; $str .= '</style>' . K_NEWLINE; } $str .= '<input type="hidden" name="testid" id="testid" value="' . $test_id . '" />' . K_NEWLINE; $str .= '<input type="hidden" name="testlogid" id="testlogid" value="' . $testlog_id . '" />' . K_NEWLINE; $str .= '<input type="hidden" name="testuser_id" id="testuser_id" value="' . $m['testlog_testuser_id'] . '" />' . K_NEWLINE; // get test data $test_data = F_getTestData($test_id); // store time information for interactive timer $examtime = F_getTestStartTime($m['testlog_testuser_id']) + $test_data['test_duration_time'] * K_SECONDS_IN_MINUTE; $str .= '<input type="hidden" name="examtime" id="examtime" value="' . $examtime . '" />' . K_NEWLINE; if (F_getBoolean($test_data['test_logout_on_timeout'])) { $str .= '<input type="hidden" name="timeout_logout" id="timeout_logout" value="1" />' . K_NEWLINE; } $str .= '<a name="questionsection" id="questionsection"></a>' . K_NEWLINE; $str .= '<div class="tcecontentbox">' . K_NEWLINE; //fieldset //$str .= '<legend>'; //$str .= $l['w_question']; //$str .= '</legend>'.K_NEWLINE; // display question description if ($m['question_type'] == 3) { $str .= '<label for="answertext">'; } $str .= F_decode_tcecode($m['question_description']) . K_NEWLINE; if ($m['question_type'] == 3) { $str .= '</label>'; } $str .= '<div class="row">' . K_NEWLINE; $str .= '<hr/>' . K_NEWLINE; $str .= '</div>' . K_NEWLINE; $str .= '<div class="rowl">' . K_NEWLINE; if ($m['question_type'] == 3) { // TEXT - free text question $str .= '<textarea cols="' . K_ANSWER_TEXTAREA_COLS . '" rows="' . K_ANSWER_TEXTAREA_ROWS . '" name="answertext" id="answertext" class="answertext">'; $str .= $m['testlog_answer_text']; $str .= '</textarea>' . K_NEWLINE; } else { // multiple-choice question $checked = false; if (F_getBoolean($m['question_inline_answers'])) { // inline display $str .= '<ol class="answer_inline">' . K_NEWLINE; } else { $str .= '<ol class="answer">' . K_NEWLINE; } if ($m['question_type'] == 4) { // get max positions for odering questions $max_position = F_count_rows(K_TABLE_LOG_ANSWER, 'WHERE logansw_testlog_id=' . $testlog_id . ''); } // display answer options $sqla = 'SELECT * FROM ' . K_TABLE_ANSWERS . ', ' . K_TABLE_LOG_ANSWER . ' WHERE logansw_answer_id=answer_id AND logansw_testlog_id=' . $testlog_id . ' ORDER BY logansw_order'; if ($ra = F_db_query($sqla, $db)) { while ($ma = F_db_fetch_array($ra)) { $str .= "<li>"; switch ($m['question_type']) { case 1: // MCSA - single-answer question $str .= '<input type="radio" name="answerid" id="answerid_' . $ma['answer_id'] . '" value="' . $ma['answer_id'] . '"'; if (intval($ma['logansw_selected']) == 1) { $str .= ' checked="checked"'; $checked = true; } if (F_getBoolean($m['question_auto_next'])) { $str .= " onclick=\"var submittime=new Date();document.getElementById('reaction_time').value=submittime.getTime()-document.getElementById('display_time').value;document.getElementById('autonext').value=1;document.getElementById('" . $formname . "').submit();\""; } $str .= ' /> '; $str .= '<label for="answerid_' . $ma['answer_id'] . '">'; $str .= F_decode_tcecode($ma['answer_description']); $str .= '</label>'; if ($ma['answer_keyboard_key'] > 0) { $aswkeys[$ma['answer_keyboard_key']] = 'answerid_' . $ma['answer_id']; } break; case 2: // MCMA - multiple-answer question if (F_getBoolean($testdata['test_mcma_radio'])) { // radiobuttons // no-answer option $str .= '<span style="background-color:#DDDDDD;"' . $noanswer_hidden . '> '; $str .= '<label for="answerid_' . $ma['answer_id'] . 'u" title="' . $l['m_unanswered'] . '">' . $l['w_unanswered_acronym'] . '</label>'; $str .= '<input type="radio"' . $noanswer_disabled . ' name="answerid[' . $ma['answer_id'] . ']" id="answerid_' . $ma['answer_id'] . 'u" value="-1" title="' . $l['m_unanswered'] . '"'; if (intval($ma['logansw_selected']) == -1) { $str .= ' checked="checked"'; } $str .= ' />'; $str .= '</span> '; // false option $str .= '<span style="background-color:#FFBBBB;"> '; $str .= '<label for="answerid_' . $ma['answer_id'] . 'f" title="' . $l['w_false'] . '">' . $l['w_false_acronym'] . '</label>'; $str .= '<input type="radio" name="answerid[' . $ma['answer_id'] . ']" id="answerid_' . $ma['answer_id'] . 'f" value="0"'; if (intval($ma['logansw_selected']) == 0) { $str .= ' checked="checked"'; } $str .= ' />'; $str .= '</span> '; // true option $str .= '<span style="background-color:#BBFFBB;"> '; $str .= '<label for="answerid_' . $ma['answer_id'] . 't" title="' . $l['w_true'] . '">' . $l['w_true_acronym'] . '</label>'; $str .= '<input type="radio" name="answerid[' . $ma['answer_id'] . ']" id="answerid_' . $ma['answer_id'] . 't" value="1"'; if (intval($ma['logansw_selected']) == 1) { $str .= ' checked="checked"'; } $str .= ' />'; $str .= '</span> '; if ($ma['answer_keyboard_key'] > 0) { $aswkeys[] = array($ma['answer_keyboard_key'] => 'answerid_' . $ma['answer_id'] . 't'); } $str .= F_decode_tcecode($ma['answer_description']); } else { // checkbox $str .= '<input type="checkbox" name="answerid[' . $ma['answer_id'] . ']" id="answerid_' . $ma['answer_id'] . '" value="1"'; if (intval($ma['logansw_selected']) == 1) { $str .= ' checked="checked"'; $checked = true; } $str .= ' /> '; $str .= '<label for="answerid_' . $ma['answer_id'] . '">'; $str .= F_decode_tcecode($ma['answer_description']); $str .= '</label>'; } break; case 4: // ORDER - ordering questions $str .= '<select name="answerid[' . $ma['answer_id'] . ']" id="answerid_' . $ma['answer_id'] . '" size="0">' . K_NEWLINE; if (F_getBoolean($testdata['test_noanswer_enabled'])) { $str .= '<option value="0"> </option>' . K_NEWLINE; } for ($pos = 1; $pos <= $max_position; $pos++) { $str .= '<option value="' . $pos . '"'; if ($pos == $ma['logansw_position']) { $str .= ' selected="selected"'; } $str .= '>' . $pos . '</option>' . K_NEWLINE; } $str .= '</select>' . K_NEWLINE; $str .= '<label for="answerid_' . $ma['answer_id'] . '">'; $str .= F_decode_tcecode($ma['answer_description']); $str .= '</label>'; break; } // end of switch $str .= '</li>' . K_NEWLINE; } // end of while } else { F_display_db_error(); } if ($m['question_type'] == 1) { // display default "unanswered" option for MCSA $str .= '<li' . $noanswer_hidden . '>'; $str .= '<input type="radio"' . $noanswer_disabled . ' name="answerid" id="answerid_0" value="0"'; if (!$checked) { $str .= ' checked="checked"'; } $str .= ' /> '; $str .= '<label for="answerid_0">'; $str .= $l['m_unanswered']; $str .= '</label>'; $str .= '</li>' . K_NEWLINE; } $str .= '</ol>' . K_NEWLINE; } // end multiple answers $str .= '</div>' . K_NEWLINE; $str .= '</div>' . K_NEWLINE; //fieldset // script to handle keyboard events $str .= '<script type="text/javascript">' . K_NEWLINE; $str .= '//<![CDATA[' . K_NEWLINE; $str .= 'function actionByChar(e){e=(e)?e:window.event;keynum=(e.keyCode)?e.keyCode:e.which;switch(keynum){' . K_NEWLINE; foreach ($aswkeys as $key => $fieldid) { $str .= 'case ' . $key . ':{document.getElementById(\'' . $fieldid . '\').checked=true;var submittime=new Date();document.getElementById(\'reaction_time\').value=submittime.getTime()-document.getElementById(\'display_time\').value;document.getElementById(\'autonext\').value=1;document.getElementById(\'' . $formname . '\').submit();break;}' . K_NEWLINE; } $str .= '}}' . K_NEWLINE; $str .= 'if (!document.all) {document.captureEvents(Event.KEYPRESS);}'; $str .= 'document.onkeypress=actionByChar;' . K_NEWLINE; if ($m['question_timer'] > 0) { // automatic submit form after specified amount of time $str .= "setTimeout('document.getElementById(\\'autonext\\').value=1;document.getElementById(\\'" . $formname . "\\').submit();', " . $m['question_timer'] * 1000 . ");" . K_NEWLINE; } $str .= '//]]>' . K_NEWLINE; $str .= '</script>' . K_NEWLINE; // display questions menu $str .= F_questionsMenu($testdata, $m['testlog_testuser_id'], $testlog_id, F_getBoolean($m['question_fullscreen'])); } if (empty($m['testlog_display_time'])) { // mark test as displayed: $sqlu = 'UPDATE ' . K_TABLE_TESTS_LOGS . ' SET testlog_display_time=\'' . date(K_TIMESTAMP_FORMAT) . '\' WHERE testlog_id=' . $testlog_id . ''; if (!($ru = F_db_query($sqlu, $db))) { F_display_db_error(); } } } else { F_display_db_error(); } return $str; }
if ($teststat['testinfo']['test_score_threshold'] > 0) { if (isset($teststat['testinfo']['user_score']) and $teststat['testinfo']['user_score'] >= $teststat['testinfo']['test_score_threshold']) { $passmsg = ' - ' . $l['w_passed']; } else { $passmsg = ' - ' . $l['w_not_passed']; } } if ($teststat['testinfo']['test_max_score'] > 0) { $score_all = $teststat['testinfo']['user_score'] . ' / ' . $teststat['testinfo']['test_max_score'] . ' (' . round(100 * $teststat['testinfo']['user_score'] / $teststat['testinfo']['test_max_score']) . '%)' . $passmsg; } else { $score_all = $teststat['testinfo']['user_score'] . $passmsg; } echo getFormDescriptionLine($l['w_score'] . ':', $l['h_score_total'], $score_all); $score_right_all = $teststat['qstats']['right'] . ' / ' . $teststat['qstats']['recurrence'] . ' (' . $teststat['qstats']['right_perc'] . '%)'; echo getFormDescriptionLine($l['w_answers_right'] . ':', $l['h_answers_right'], $score_right_all); echo getFormDescriptionLine($l['w_comment'] . ':', $l['h_testcomment'], F_decode_tcecode($teststat['testinfo']['user_comment'])); if (F_getBoolean($teststat['testinfo']['test_report_to_users'])) { echo '<div class="rowl">' . K_NEWLINE; echo F_printUserTestStat($testuser_id); echo '</div>' . K_NEWLINE; // print statistics for modules and subjects echo '<div class="rowl">' . K_NEWLINE; echo '<hr />' . K_NEWLINE; echo '<h2>' . $l['w_stats'] . '</h2>'; echo F_printTestStat($test_id, 0, $user_id, 0, 0, $testuser_id, $teststat, 1, true); echo '<hr />' . K_NEWLINE; echo '</div>' . K_NEWLINE; if (K_ENABLE_PUBLIC_PDF) { echo '<div class="row">' . K_NEWLINE; // PDF button echo '<a href="tce_pdf_results.php?mode=3&test_id=' . $test_id . '&user_id=' . $user_id . '&testuser_id=' . $testuser_id . '" class="xmlbutton" title="' . $l['h_pdf'] . '">' . $l['w_pdf'] . '</a> ';
// // License: // Copyright (C) 2004-2010 Nicola Asuni - Tecnick.com LTD // See LICENSE.TXT file for more information. //============================================================+ /** * @file * Renders TCExam code using popup headers. * @package com.tecnick.tcexam.admin * @author Nicola Asuni * @since 2002-01-30 */ /** */ require_once '../config/tce_config.php'; $pagelevel = K_AUTH_ADMIN_TCECODE; require_once '../../shared/code/tce_authorization.php'; $thispage_title = ''; require_once '../code/tce_page_header_popup.php'; require_once '../../shared/code/tce_functions_tcecode.php'; require_once '../../shared/code/tce_functions_form.php'; $tcexamcode = str_replace('+', '~#PLUS#~', $_REQUEST['tcexamcode']); $tcexamcode = stripslashes(urldecode($tcexamcode)); $tcexamcode = str_replace('~#PLUS#~', '+', $tcexamcode); echo F_decode_tcecode($tcexamcode); echo '<hr />' . K_NEWLINE; echo F_close_button(); require_once '../code/tce_page_footer_popup.php'; //============================================================+ // END OF FILE //============================================================+
} F_submit_button('clear', $l['w_clear'], $l['h_clear']); echo '</div>' . K_NEWLINE; echo '<div class="row">' . K_NEWLINE; echo '<span class="left">' . K_NEWLINE; echo ' ' . K_NEWLINE; if (isset($answer_question_id) and $answer_question_id > 0) { echo '<a href="tce_edit_question.php?subject_module_id=' . $subject_module_id . '&question_subject_id=' . $question_subject_id . '&question_id=' . $answer_question_id . '" title="' . $l['t_questions_editor'] . '" class="xmlbutton">< ' . $l['t_questions_editor'] . '</a>'; } echo '</span>' . K_NEWLINE; echo ' ' . K_NEWLINE; // comma separated list of required fields echo '<input type="hidden" name="ff_required" id="ff_required" value="answer_description" />' . K_NEWLINE; echo '<input type="hidden" name="ff_required_labels" id="ff_required_labels" value="' . htmlspecialchars($l['w_description'], ENT_COMPAT, $l['a_meta_charset']) . '" />' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '<div class="row"><hr /></div>' . K_NEWLINE; echo '<div class="rowl" title="' . $l['h_preview'] . '">' . K_NEWLINE; echo $l['w_preview']; echo '<div class="preview">' . K_NEWLINE; echo F_decode_tcecode($answer_description); echo ' ' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '</form>' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '<div class="pagehelp">' . $l['hp_edit_answer'] . '</div>' . K_NEWLINE; echo '</div>' . K_NEWLINE; require_once '../code/tce_page_footer.php'; //============================================================+ // END OF FILE //============================================================+
/** * Returns user test stats as HTML table * @param $testuser_id (int) test-user ID - if greater than zero, filter stats for the specified test-user. * return $data string containing HTML table. */ function F_printUserTestStat($testuser_id) { require_once '../config/tce_config.php'; require_once '../../shared/code/tce_functions_tcecode.php'; global $db, $l; $testuser_id = intval($testuser_id); $ret = ''; // display user questions $sql = 'SELECT * FROM ' . K_TABLE_QUESTIONS . ', ' . K_TABLE_TESTS_LOGS . ', ' . K_TABLE_SUBJECTS . ', ' . K_TABLE_MODULES . ' WHERE question_id=testlog_question_id AND testlog_testuser_id=' . $testuser_id . ' AND question_subject_id=subject_id AND subject_module_id=module_id ORDER BY testlog_id'; if ($r = F_db_query($sql, $db)) { $ret .= '<ol class="question">' . K_NEWLINE; while ($m = F_db_fetch_array($r)) { $ret .= '<li>' . K_NEWLINE; // display question stats $ret .= '<strong>[' . $m['testlog_score'] . ']' . K_NEWLINE; $ret .= ' ('; $ret .= 'IP:' . getIpAsString($m['testlog_user_ip']) . K_NEWLINE; if (isset($m['testlog_display_time']) and strlen($m['testlog_display_time']) > 0) { $ret .= ' | ' . substr($m['testlog_display_time'], 11, 8) . K_NEWLINE; } else { $ret .= ' | --:--:--' . K_NEWLINE; } if (isset($m['testlog_change_time']) and strlen($m['testlog_change_time']) > 0) { $ret .= ' | ' . substr($m['testlog_change_time'], 11, 8) . K_NEWLINE; } else { $ret .= ' | --:--:--' . K_NEWLINE; } if (isset($m['testlog_display_time']) and isset($m['testlog_change_time'])) { $ret .= ' | ' . date('i:s', strtotime($m['testlog_change_time']) - strtotime($m['testlog_display_time'])) . ''; } else { $ret .= ' | --:--' . K_NEWLINE; } if (isset($m['testlog_reaction_time']) and $m['testlog_reaction_time'] > 0) { $ret .= ' | ' . $m['testlog_reaction_time'] / 1000 . ''; } else { $ret .= ' | ------' . K_NEWLINE; } $ret .= ')</strong>' . K_NEWLINE; $ret .= '<br />' . K_NEWLINE; // display question description $ret .= F_decode_tcecode($m['question_description']) . K_NEWLINE; if (K_ENABLE_QUESTION_EXPLANATION and !empty($m['question_explanation'])) { $ret .= '<br /><span class="explanation">' . $l['w_explanation'] . ':</span><br />' . F_decode_tcecode($m['question_explanation']) . '' . K_NEWLINE; } if ($m['question_type'] == 3) { // TEXT $ret .= '<ul class="answer"><li>' . K_NEWLINE; $ret .= F_decode_tcecode($m['testlog_answer_text']); $ret .= ' </li></ul>' . K_NEWLINE; } else { $ret .= '<ol class="answer">' . K_NEWLINE; // display each answer option $sqla = 'SELECT * FROM ' . K_TABLE_LOG_ANSWER . ', ' . K_TABLE_ANSWERS . ' WHERE logansw_answer_id=answer_id AND logansw_testlog_id=\'' . $m['testlog_id'] . '\' ORDER BY logansw_order'; if ($ra = F_db_query($sqla, $db)) { while ($ma = F_db_fetch_array($ra)) { $ret .= '<li>'; if ($m['question_type'] == 4) { // ORDER if ($ma['logansw_position'] > 0) { if ($ma['logansw_position'] == $ma['answer_position']) { $ret .= '<acronym title="' . $l['h_answer_right'] . '" class="okbox">' . $ma['logansw_position'] . '</acronym>'; } else { $ret .= '<acronym title="' . $l['h_answer_wrong'] . '" class="nobox">' . $ma['logansw_position'] . '</acronym>'; } } else { $ret .= '<acronym title="' . $l['m_unanswered'] . '" class="offbox"> </acronym>'; } } elseif ($ma['logansw_selected'] > 0) { if (F_getBoolean($ma['answer_isright'])) { $ret .= '<acronym title="' . $l['h_answer_right'] . '" class="okbox">x</acronym>'; } else { $ret .= '<acronym title="' . $l['h_answer_wrong'] . '" class="nobox">x</acronym>'; } } elseif ($m['question_type'] == 1) { // MCSA $ret .= '<acronym title="-" class="offbox"> </acronym>'; } else { if ($ma['logansw_selected'] == 0) { if (F_getBoolean($ma['answer_isright'])) { $ret .= '<acronym title="' . $l['h_answer_wrong'] . '" class="nobox"> </acronym>'; } else { $ret .= '<acronym title="' . $l['h_answer_right'] . '" class="okbox"> </acronym>'; } } else { $ret .= '<acronym title="' . $l['m_unanswered'] . '" class="offbox"> </acronym>'; } } $ret .= ' '; if ($m['question_type'] == 4) { $ret .= '<acronym title="' . $l['w_position'] . '" class="onbox">' . $ma['answer_position'] . '</acronym>'; } elseif (F_getBoolean($ma['answer_isright'])) { $ret .= '<acronym title="' . $l['w_answers_right'] . '" class="onbox">®</acronym>'; } else { $ret .= '<acronym title="' . $l['w_answers_wrong'] . '" class="offbox"> </acronym>'; } $ret .= ' '; $ret .= F_decode_tcecode($ma['answer_description']); if (K_ENABLE_ANSWER_EXPLANATION and !empty($ma['answer_explanation'])) { $ret .= '<br /><span class="explanation">' . $l['w_explanation'] . ':</span><br />' . F_decode_tcecode($ma['answer_explanation']) . '' . K_NEWLINE; } $ret .= '</li>' . K_NEWLINE; } } else { F_display_db_error(); } $ret .= '</ol>' . K_NEWLINE; } // end multiple answers // display teacher/supervisor comment to the question if (isset($m['testlog_comment']) and !empty($m['testlog_comment'])) { $ret .= '<ul class="answer"><li class="comment">' . K_NEWLINE; $ret .= F_decode_tcecode($m['testlog_comment']); $ret .= ' </li></ul>' . K_NEWLINE; } $ret .= '<br /><br />' . K_NEWLINE; $ret .= '</li>' . K_NEWLINE; } $ret .= '</ol>' . K_NEWLINE; } else { F_display_db_error(); } return $ret; }
/** * print test details for the selected user * @param $data (array) Testuser data array. * @param $onlytext (boolean) If true print only text questions. */ public function printUserTestDetails($data, $onlytext = false) { require_once '../config/tce_config.php'; require_once '../../shared/code/tce_functions_test_stats.php'; require_once '../../shared/code/tce_functions_tcecode.php'; global $db, $l; $testuser_id = intval($data['id']); $qtype = array('S', 'M', 'T', 'O'); // question types $num_column = 7; $tce_data_cell_width = round($this->tce_page_width / $num_column, 2); $tce_data_cell_width_third = round($tce_data_cell_width / 3, 2); $tce_data_cell_width_half = round($tce_data_cell_width / 2, 2); $numberfont = 'courier'; // display user questions $sql = 'SELECT * FROM ' . K_TABLE_QUESTIONS . ', ' . K_TABLE_TESTS_LOGS . ', ' . K_TABLE_SUBJECTS . ', ' . K_TABLE_MODULES . ' WHERE question_id=testlog_question_id AND testlog_testuser_id=' . $testuser_id . ' AND question_subject_id=subject_id AND subject_module_id=module_id'; if ($onlytext) { // display only TEXT questions $sql .= ' AND question_type=3'; } $sql .= ' ORDER BY testlog_id'; if ($r = F_db_query($sql, $db)) { $this->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA); $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, '#', 1, 0, 'C', 1); $this->Cell($tce_data_cell_width, $this->tce_data_cell_height, $l['w_score'], 1, 0, 'C', 1); $this->Cell($tce_data_cell_width, $this->tce_data_cell_height, $l['w_ip'], 1, 0, 'C', 1); $this->Cell($tce_data_cell_width + $tce_data_cell_width_third, $this->tce_data_cell_height, $l['w_start'] . ' [' . $l['w_time_hhmmss'] . ']', 1, 0, 'C', 1); $this->Cell($tce_data_cell_width + $tce_data_cell_width_third, $this->tce_data_cell_height, $l['w_end'] . ' [' . $l['w_time_hhmmss'] . ']', 1, 0, 'C', 1); $this->Cell($tce_data_cell_width, $this->tce_data_cell_height, $l['w_time'] . ' [' . $l['w_time_mmss'] . ']', 1, 0, 'C', 1); $this->Cell($tce_data_cell_width, $this->tce_data_cell_height, $l['w_reaction'] . ' [sec]', 1, 1, 'C', 1); $this->Ln($this->tce_data_cell_height); // print table rows $this->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA); $itemcount = 1; while ($m = F_db_fetch_array($r)) { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, $itemcount . ' ' . $qtype[$m['question_type'] - 1], 1, 0, 'R', 0); $this->Cell($tce_data_cell_width, $this->tce_data_cell_height, $m['testlog_score'], 1, 0, 'C', 0); $this->Cell($tce_data_cell_width, $this->tce_data_cell_height, getIpAsString($m['testlog_user_ip']), 1, 0, 'C', 0); if (isset($m['testlog_display_time']) and strlen($m['testlog_display_time']) > 0) { $display_time = substr($m['testlog_display_time'], 11, 8); } else { $display_time = '--:--:--'; } if (isset($m['testlog_change_time']) and strlen($m['testlog_change_time']) > 0) { $change_time = substr($m['testlog_change_time'], 11, 8); } else { $change_time = '--:--:--'; } if (isset($m['testlog_display_time']) and isset($m['testlog_change_time'])) { $diff_time = date('i:s', strtotime($m['testlog_change_time']) - strtotime($m['testlog_display_time'])); } else { $diff_time = '--:--'; } if (isset($m['testlog_reaction_time']) and strlen($m['testlog_reaction_time']) > 0) { $reaction_time = $m['testlog_reaction_time'] / 1000; } else { $reaction_time = ''; } $this->Cell($tce_data_cell_width + $tce_data_cell_width_third, $this->tce_data_cell_height, $display_time, 1, 0, 'C', 0); $this->Cell($tce_data_cell_width + $tce_data_cell_width_third, $this->tce_data_cell_height, $change_time, 1, 0, 'C', 0); $this->Cell($tce_data_cell_width, $this->tce_data_cell_height, $diff_time, 1, 0, 'C', 0); $this->Cell($tce_data_cell_width, $this->tce_data_cell_height, $reaction_time, 1, 1, 'C', 0); $this->writeHTMLCell(0, $this->tce_data_cell_height, PDF_MARGIN_LEFT + $tce_data_cell_width_third, $this->GetY(), F_decode_tcecode($m['question_description']), 1, 1); if (K_ENABLE_QUESTION_EXPLANATION and !empty($m['question_explanation'])) { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, '', 0, 0, 'C', 0); $this->SetFont('', 'BIU'); $this->Cell(0, $this->tce_data_cell_height, $l['w_explanation'], 'LTR', 1, '', 0, '', 0); $this->SetFont('', ''); $this->writeHTMLCell(0, $this->tce_data_cell_height, PDF_MARGIN_LEFT + $tce_data_cell_width_third, $this->GetY(), F_decode_tcecode($m['question_explanation']), 'LRB', 1, '', ''); } if ($m['question_type'] == 3) { // free-text question - print user text answer $this->writeHTMLCell(0, $this->tce_data_cell_height, PDF_MARGIN_LEFT + 2 * $tce_data_cell_width_third, $this->GetY(), F_decode_tcecode($m['testlog_answer_text']), 1, 1); } else { // display each answer option $sqla = 'SELECT * FROM ' . K_TABLE_LOG_ANSWER . ', ' . K_TABLE_ANSWERS . ' WHERE logansw_answer_id=answer_id AND logansw_testlog_id=' . $m['testlog_id'] . ' ORDER BY logansw_order'; if ($ra = F_db_query($sqla, $db)) { $idx = 0; // count items while ($ma = F_db_fetch_array($ra)) { $posfill = 0; $idx++; $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, '', 0, 0, 'C', 0); if ($m['question_type'] == 4) { if ($ma['logansw_position'] > 0) { if ($ma['logansw_position'] == $ma['answer_position']) { $posfill = 1; $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, $ma['logansw_position'], 1, 0, 'C', 1); } else { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, $ma['logansw_position'], 1, 0, 'C', 0); } } else { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, ' ', 1, 0, 'C', 0); } } elseif ($ma['logansw_selected'] > 0) { // selected if (F_getBoolean($ma['answer_isright'])) { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, '+', 1, 0, 'C', 1); } else { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, '-', 1, 0, 'C', 1); } } elseif ($m['question_type'] == 1) { // MCSA $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, ' ', 1, 0, 'C', 0); } else { if ($ma['logansw_selected'] == 0) { // unselected if (F_getBoolean($ma['answer_isright'])) { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, '-', 1, 0, 'C', 0); } else { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, '+', 1, 0, 'C', 0); } } else { // no answer $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, ' ', 1, 0, 'C', 0); } } if ($m['question_type'] == 4) { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, $ma['answer_position'], 1, 0, 'C', $posfill); } elseif (F_getBoolean($ma['answer_isright'])) { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, $idx, 1, 0, 'C', 1); } else { $this->Cell($tce_data_cell_width_third, $this->tce_data_cell_height, $idx, 1, 0, 'C', 0); } $this->writeHTMLCell(0, $this->tce_data_cell_height, PDF_MARGIN_LEFT + $tce_data_cell_width, $this->GetY(), F_decode_tcecode($ma['answer_description']), 'LRTB', 1); if (K_ENABLE_ANSWER_EXPLANATION and !empty($ma['answer_explanation'])) { $this->Cell(3 * $tce_data_cell_width_third, $this->tce_data_cell_height, '', 0, 0, 'C', 0); $this->SetFont('', 'BIU'); $this->Cell(0, $this->tce_data_cell_height, $l['w_explanation'], 'LTR', 1, '', 0, '', 0); $this->SetFont('', ''); $this->writeHTMLCell(0, $this->tce_data_cell_height, PDF_MARGIN_LEFT + 3 * $tce_data_cell_width_third, $this->GetY(), F_decode_tcecode($ma['answer_explanation']), 'LRB', 1, '', ''); } } } else { F_display_db_error(); } } // end multiple answers if (strlen($m['testlog_comment']) > 0) { // teacher / supervisor comment $this->SetTextColor(255, 0, 0); $this->writeHTMLCell(0, $this->tce_data_cell_height, PDF_MARGIN_LEFT + 2 * $tce_data_cell_width_third, $this->GetY(), F_decode_tcecode($m['testlog_comment']), 'LRTB', 1); $this->SetTextColor(0, 0, 0); } $this->Ln($this->tce_data_cell_height); $itemcount++; } } else { F_display_db_error(); } $stats = F_getTestStat($data['test']['test_id'], 0, $data['user_id'], 0, 0, $data['id']); $this->printQuestionStats($stats['qstats'], 1); }
/** * Display a list of selected questions. * @author Nicola Asuni * @since 2005-07-06 * @param $wherequery (string) question selection query * @param $subject_module_id (string) module ID * @param $subject_id (string) topic ID * @param $order_field (string) order by column name * @param $orderdir (int) oreder direction * @param $firstrow (int) number of first row to display * @param $rowsperpage (int) number of rows per page * @param $hide_answers (boolean) if true hide answers * @return false in case of empty database, true otherwise */ function F_show_select_questions($wherequery, $subject_module_id, $subject_id, $order_field, $orderdir, $firstrow, $rowsperpage, $hide_answers = false) { global $l, $db; require_once '../config/tce_config.php'; require_once '../../shared/code/tce_functions_page.php'; $subject_module_id = intval($subject_module_id); $subject_id = intval($subject_id); $orderdir = intval($orderdir); $firstrow = intval($firstrow); $rowsperpage = intval($rowsperpage); if (empty($order_field) or !in_array($order_field, array('question_id', 'question_subject_id', 'question_description', 'question_explanation', 'question_type', 'question_difficulty', 'question_enabled', 'question_position', 'question_timer', 'question_fullscreen', 'question_inline_answers', 'question_auto_next', 'question_enabled DESC, question_position, CAST(question_description as varchar2(100))', 'question_enabled DESC, question_position, question_description'))) { $order_field = 'question_description'; } if ($orderdir == 0) { $nextorderdir = 1; $full_order_field = $order_field; } else { $nextorderdir = 0; $full_order_field = $order_field . ' DESC'; } if (!F_count_rows(K_TABLE_QUESTIONS)) { //if the table is void (no items) display message F_print_error('MESSAGE', $l['m_databasempty']); return FALSE; } if (empty($wherequery)) { $wherequery = 'WHERE question_subject_id=' . $subject_id . ''; } else { $wherequery = F_escape_sql($db, $wherequery); $wherequery .= ' AND question_subject_id=' . $subject_id . ''; } $sql = 'SELECT * FROM ' . K_TABLE_QUESTIONS . ' ' . $wherequery . ' ORDER BY ' . $full_order_field; if (K_DATABASE_TYPE == 'ORACLE') { $sql = 'SELECT * FROM (' . $sql . ') WHERE rownum BETWEEN ' . $firstrow . ' AND ' . ($firstrow + $rowsperpage) . ''; } else { $sql .= ' LIMIT ' . $rowsperpage . ' OFFSET ' . $firstrow . ''; } if ($r = F_db_query($sql, $db)) { $questlist = ''; $itemcount = $firstrow; while ($m = F_db_fetch_array($r)) { $itemcount++; $questlist .= '<li>' . K_NEWLINE; $questlist .= '<strong>' . $itemcount . '.</strong> '; $questlist .= '<input type="checkbox" name="questionid' . $itemcount . '" id="questionid' . $itemcount . '" value="' . $m['question_id'] . '" title="' . $l['w_select'] . '"'; if (isset($_REQUEST['checkall']) and $_REQUEST['checkall'] == 1) { $questlist .= ' checked="checked"'; } $questlist .= ' />'; // display question description if (F_getBoolean($m['question_enabled'])) { $questlist .= '<acronym class="onbox" title="' . $l['w_enabled'] . '">+</acronym>'; } else { $questlist .= '<acronym class="offbox" title="' . $l['w_disabled'] . '">-</acronym>'; } switch ($m['question_type']) { case 1: $questlist .= ' <acronym class="offbox" title="' . $l['w_single_answer'] . '">S</acronym>'; break; case 2: $questlist .= ' <acronym class="offbox" title="' . $l['w_multiple_answers'] . '">M</acronym>'; break; case 3: $questlist .= ' <acronym class="offbox" title="' . $l['w_free_answer'] . '">T</acronym>'; break; case 4: $questlist .= ' <acronym class="offbox" title="' . $l['w_ordering_answer'] . '">O</acronym>'; break; } $questlist .= ' <acronym class="offbox" title="' . $l['h_question_difficulty'] . '">' . $m['question_difficulty'] . '</acronym>'; if ($m['question_position'] > 0) { $questlist .= ' <acronym class="onbox" title="' . $l['h_position'] . '">' . intval($m['question_position']) . '</acronym>'; } else { $questlist .= ' <acronym class="offbox" title="' . $l['h_position'] . '"> </acronym>'; } if (F_getBoolean($m['question_fullscreen'])) { $questlist .= ' <acronym class="onbox" title="' . $l['w_fullscreen'] . ': ' . $l['w_enabled'] . '">F</acronym>'; } else { $questlist .= ' <acronym class="offbox" title="' . $l['w_fullscreen'] . ': ' . $l['w_disabled'] . '"> </acronym>'; } if (F_getBoolean($m['question_inline_answers'])) { $questlist .= ' <acronym class="onbox" title="' . $l['w_inline_answers'] . ': ' . $l['w_enabled'] . '">I</acronym>'; } else { $questlist .= ' <acronym class="offbox" title="' . $l['w_inline_answers'] . ': ' . $l['w_disabled'] . '"> </acronym>'; } if (F_getBoolean($m['question_auto_next'])) { $questlist .= ' <acronym class="onbox" title="' . $l['w_auto_next'] . ': ' . $l['w_enabled'] . '">A</acronym>'; } else { $questlist .= ' <acronym class="offbox" title="' . $l['w_auto_next'] . ': ' . $l['w_disabled'] . '"> </acronym>'; } if ($m['question_timer'] > 0) { $questlist .= ' <acronym class="onbox" title="' . $l['h_question_timer'] . '">' . intval($m['question_timer']) . '</acronym>'; } else { $questlist .= ' <acronym class="offbox" title="' . $l['h_question_timer'] . '"> </acronym>'; } $questlist .= ' <a href="tce_edit_question.php?subject_module_id=' . $subject_module_id . '&question_subject_id=' . $subject_id . '&question_id=' . $m['question_id'] . '" title="' . $l['t_questions_editor'] . ' [ID = ' . $m['question_id'] . ']" class="xmlbutton">' . $l['w_edit'] . '</a>'; $questlist .= '<br /><br />' . K_NEWLINE; $questlist .= '<div class="paddingleft">' . F_decode_tcecode($m['question_description']) . '</div>' . K_NEWLINE; if (K_ENABLE_QUESTION_EXPLANATION and !empty($m['question_explanation'])) { $questlist .= '<div class="paddingleft"><br /><span class="explanation">' . $l['w_explanation'] . ':</span><br />' . F_decode_tcecode($m['question_explanation']) . '</div>' . K_NEWLINE; } if (!$hide_answers) { // display alternative answers $sqla = 'SELECT * FROM ' . K_TABLE_ANSWERS . ' WHERE answer_question_id=\'' . $m['question_id'] . '\' ORDER BY answer_enabled DESC,answer_position,answer_isright DESC'; if ($ra = F_db_query($sqla, $db)) { $answlist = ''; while ($ma = F_db_fetch_array($ra)) { $answlist .= '<li>'; if (F_getBoolean($ma['answer_enabled'])) { $answlist .= '<acronym class="onbox" title="' . $l['w_enabled'] . '">+</acronym>'; } else { $answlist .= '<acronym class="offbox" title="' . $l['w_disabled'] . '">-</acronym>'; } if ($m['question_type'] != 4) { if (F_getBoolean($ma['answer_isright'])) { $answlist .= ' <acronym class="okbox" title="' . $l['h_answer_right'] . '">T</acronym>'; } else { $answlist .= ' <acronym class="nobox" title="' . $l['h_answer_wrong'] . '">F</acronym>'; } } if ($ma['answer_position'] > 0) { $answlist .= ' <acronym class="onbox" title="' . $l['h_position'] . '">' . intval($ma['answer_position']) . '</acronym>'; } else { $answlist .= ' <acronym class="offbox" title="' . $l['h_position'] . '"> </acronym>'; } if ($ma['answer_keyboard_key'] > 0) { $answlist .= ' <acronym class="onbox" title="' . $l['h_answer_keyboard_key'] . '">' . F_text_to_xml(chr($ma['answer_keyboard_key'])) . '</acronym>'; } else { $answlist .= ' <acronym class="offbox" title="' . $l['h_answer_keyboard_key'] . '"> </acronym>'; } $answlist .= ' <a href="tce_edit_answer.php?subject_module_id=' . $subject_module_id . '&question_subject_id=' . $subject_id . '&answer_question_id=' . $m['question_id'] . '&answer_id=' . $ma['answer_id'] . '" title="' . $l['t_answers_editor'] . ' [ID = ' . $ma['answer_id'] . ']" class="xmlbutton">' . $l['w_edit'] . '</a>'; //$answlist .= " "; //$answlist .= "".F_decode_tcecode($ma['answer_description']).""; $answlist .= '<br /><br />' . K_NEWLINE; $answlist .= '<div class="paddingleft">' . F_decode_tcecode($ma['answer_description']) . '</div>' . K_NEWLINE; if (K_ENABLE_ANSWER_EXPLANATION and !empty($ma['answer_explanation'])) { $answlist .= '<div class="paddingleft"><br /><span class="explanation">' . $l['w_explanation'] . ':</span><br />' . F_decode_tcecode($ma['answer_explanation']) . '</div>' . K_NEWLINE; } $answlist .= '</li>' . K_NEWLINE; } if (strlen($answlist) > 0) { $questlist .= "<ol class=\"answer\">\n" . $answlist . "</ol><br /><br />\n"; } } else { F_display_db_error(); } } // end if hide_answers $questlist .= '</li>' . K_NEWLINE; } if (strlen($questlist) > 0) { // display the list echo '<ul class="question">' . K_NEWLINE; echo $questlist; echo '</ul>' . K_NEWLINE; echo '<div class="row"><hr /></div>' . K_NEWLINE; // check/uncheck all options echo '<span dir="' . $l['a_meta_dir'] . '">'; echo '<input type="radio" name="checkall" id="checkall1" value="1" onclick="document.getElementById(\'form_selectquestions\').submit()" />'; echo '<label for="checkall1">' . $l['w_check_all'] . '</label> '; echo '<input type="radio" name="checkall" id="checkall0" value="0" onclick="document.getElementById(\'form_selectquestions\').submit()" />'; echo '<label for="checkall0">' . $l['w_uncheck_all'] . '</label>'; echo '</span>' . K_NEWLINE; echo ' '; if ($l['a_meta_dir'] == 'rtl') { $arr = '←'; } else { $arr = '→'; } // action options echo '<select name="menu_action" id="menu_action" size="0">' . K_NEWLINE; echo '<option value="0" style="color:gray">' . $l['m_with_selected'] . '</option>' . K_NEWLINE; echo '<option value="enable">' . $l['w_enable'] . '</option>' . K_NEWLINE; echo '<option value="disable">' . $l['w_disable'] . '</option>' . K_NEWLINE; echo '<option value="delete">' . $l['w_delete'] . '</option>' . K_NEWLINE; echo '<option value="copy">' . $l['w_copy'] . ' ' . $arr . '</option>' . K_NEWLINE; echo '<option value="move">' . $l['w_move'] . ' ' . $arr . '</option>' . K_NEWLINE; echo '</select>' . K_NEWLINE; // select new topic (for copy or move action) echo '<select name="new_subject_id" id="new_subject_id" size="0" title="' . $l['h_subject'] . '">' . K_NEWLINE; $sql = F_select_module_subjects_sql('module_enabled=\'1\' AND subject_enabled=\'1\''); if ($r = F_db_query($sql, $db)) { echo '<option value="0" style="color:gray">' . $l['w_subject'] . '</option>' . K_NEWLINE; $prev_module_id = 0; while ($m = F_db_fetch_array($r)) { if ($m['module_id'] != $prev_module_id) { $prev_module_id = $m['module_id']; echo '<option value="0" style="color:gray;font-weight:bold;" disabled="disabled">* ' . htmlspecialchars($m['module_name'], ENT_NOQUOTES, $l['a_meta_charset']) . '</option>' . K_NEWLINE; } echo '<option value="' . $m['subject_id'] . '"> ' . htmlspecialchars($m['subject_name'], ENT_NOQUOTES, $l['a_meta_charset']) . '</option>' . K_NEWLINE; } } else { echo '</select>' . K_NEWLINE; F_display_db_error(); } echo '</select>' . K_NEWLINE; // submit button F_submit_button("update", $l['w_update'], $l['h_update']); } // --------------------------------------------------------------- // -- page jumper (menu for successive pages) if ($rowsperpage > 0) { $sql = 'SELECT count(*) AS total FROM ' . K_TABLE_QUESTIONS . ' ' . $wherequery . ''; if (!empty($order_field)) { $param_array = '&order_field=' . urlencode($order_field) . ''; } if (!empty($orderdir)) { $param_array .= '&orderdir=' . $orderdir . ''; } if (!empty($hide_answers)) { $param_array .= '&hide_answers=' . intval($hide_answers) . ''; } $param_array .= '&subject_module_id=' . $subject_module_id . ''; $param_array .= '&subject_id=' . $subject_id . ''; $param_array .= '&submitted=1'; F_show_page_navigator($_SERVER['SCRIPT_NAME'], $sql, $firstrow, $rowsperpage, $param_array); } } else { F_display_db_error(); } return TRUE; }
} echo '<td class="numeric">' . $right_answers . ' ' . F_formatPercentage($perc) . '</td>' . K_NEWLINE; $perc = 0; if ($num_answers > 0) { $perc = round($wrong_answers / $num_answers); } echo '<td class="numeric">' . $wrong_answers . ' ' . F_formatPercentage($perc) . '</td>' . K_NEWLINE; $perc = 0; if ($num_answers > 0) { $perc = round($unanswered / $num_answers); } echo '<td class="numeric">' . $unanswered . ' ' . F_formatPercentage($perc) . '</td>' . K_NEWLINE; echo '<td colspan="2"> </td>' . K_NEWLINE; echo '</tr>' . K_NEWLINE; echo '<tr>' . K_NEWLINE; echo '<td colspan="8" align="' . $txtdir . '">' . F_decode_tcecode($ma['answer_description']) . '</td>' . K_NEWLINE; echo '</tr>' . K_NEWLINE; $answcount++; } } else { F_display_db_error(); } } } else { F_display_db_error(); } echo '</table>' . K_NEWLINE; echo '</div>' . K_NEWLINE; echo '<div class="row">' . K_NEWLINE; // show buttons by case if (isset($test_id) and $test_id > 0) {