if ($rs = F_db_query($sqls, $db)) { while ($ms = F_db_fetch_array($rs)) { $subject_id = $ms['subject_id']; $subject_name = $ms['subject_name']; $subject_description = F_decode_tcecode($ms['subject_description']); //$subject_enabled = F_getBoolean($ms['subject_enabled']); // --- start page data --- $pdf->AddPage(); // set barcode $pdf->setBarcode($subject_id); $pdf->SetFillColor(204, 204, 204); $pdf->SetLineWidth(0.1); $pdf->SetDrawColor(0, 0, 0); // print document name (title) $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA * K_TITLE_MAGNIFICATION); $pdf->Cell(0, $main_cell_height * K_TITLE_MAGNIFICATION, $doc_title, 1, 1, 'C', 1); $pdf->Ln(5); // --- display subject info --- $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA * HEAD_MAGNIFICATION); $pdf->Cell($page_width, $data_cell_height * HEAD_MAGNIFICATION, '' . $module_name . ' :: ' . $subject_name . '', 1, 1, $defalign, 1); $pdf->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA); $pdf->writeHTMLCell(0, $data_cell_height, PDF_MARGIN_LEFT, $pdf->GetY(), $subject_description, 1, 1); // --- end subject info --- $pdf->Ln(5); // ---- questions $sqlq = 'SELECT * FROM ' . K_TABLE_QUESTIONS . ' WHERE question_subject_id=' . $subject_id . ' ORDER BY question_enabled DESC, question_position, question_description'; if ($rq = F_db_query($sqlq, $db)) { $pdf->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // data to be printed as QR-Code to be later used as input from scanner/image $barcode_test_data = array(); $barcode_test_data[0] = $test_id; // --- start page data --- $pdf->AddPage(); $test_ref = $test_id . ':' . $item . ':' . date(K_TIMESTAMP_FORMAT); // set barcode $pdf->setBarcode($test_ref); $pdf->SetFillColor(204, 204, 204); $pdf->SetLineWidth(0.1); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0); // print document name (title) $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA * K_TITLE_MAGNIFICATION); $pdf->Cell(0, $main_cell_height * K_TITLE_MAGNIFICATION, $doc_title, 1, 1, 'C', 1); $pdf->SetTextColor(255, 0, 0); $pdf->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA); $pdf->Cell(0, 5, '[' . $test_ref . ']', 0, 1, 'C', false, '', 0, false, 'T', 'M'); $pdf->SetTextColor(0, 0, 0); //$pdf->Ln(5); // display user info input boxes // calculate some sizes $user_elements = 4; $user_data_cell_width = round($page_width / $user_elements, 2); // print table headings $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_lastname'], 1, 0, 'C', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_firstname'], 1, 0, 'C', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_code'], 1, 0, 'C', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_score'], 1, 1, 'C', 1);
F_display_db_error(); } $test_end_time = $m['test_end_time']; // Set backlink QR-Code $pdf->setTCExamBackLink(K_PATH_URL . 'admin/code/tce_show_result_user.php?testuser_id=' . $testuser_id . '&test_id=' . $test_id . '&user_id=' . $user_id); // ------------------------------------------------------------ // --- start page data --- $pdf->AddPage(); // set barcode $pdf->setBarcode($test_id . ':' . $user_id . ':' . $test_start_time); $pdf->SetFillColor(204, 204, 204); $pdf->SetLineWidth(0.1); $pdf->SetDrawColor(0, 0, 0); // print document name (title) $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA * K_TITLE_MAGNIFICATION); $pdf->Cell(0, $main_cell_height * K_TITLE_MAGNIFICATION, $doc_title, 1, 1, 'C', 1); $pdf->Ln(5); // display user info // add a bookmark //$pdf->Bookmark($user_lastname.' '.$user_firstname.' ('.$user_name.'), '.$test_score.' '.F_formatPdfPercentage($test_score / $test_max_score), 0, 0); // calculate some sizes $user_elements = 4; $user_data_cell_width = round($page_width / $user_elements, 2); // print table headings $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_lastname'], 'LTRB', 0, 'C', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_firstname'], 'LTRB', 0, 'C', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_user'], 'LTRB', 0, 'C', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_score'], 'LTRB', 1, 'C', 1); $pdf->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA); // minimum required score to pass the exam
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->setLanguageArray($l); //set language items if (defined('K_DIGSIG_ENABLE') and K_DIGSIG_ENABLE) { // set document signature $pdf->setSignature(K_DIGSIG_CERTIFICATE, K_DIGSIG_PRIVATE_KEY, K_DIGSIG_PASSWORD, K_DIGSIG_EXTRA_CERTS, K_DIGSIG_CERT_TYPE, array('Name' => K_DIGSIG_NAME, 'Location' => K_DIGSIG_LOCATION, 'Reason' => K_DIGSIG_REASON, 'ContactInfo' => K_DIGSIG_CONTACT)); } $pdf->SetFillColor(204, 204, 204); $pdf->SetLineWidth(0.1); $pdf->SetDrawColor(0, 0, 0); if ($mode != 3) { $pdf->AddPage(); // print document name (title) $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA * K_TITLE_MAGNIFICATION); $pdf->Cell(0, 0, $doc_title, 1, 1, 'C', 1); $pdf->Ln(5); // print test stats table $pdf->printTestResultStat($ts, $pubmode, $display_mode); if ($show_graph) { // display graph $pdf->Ln(5); $pdf->printSVGStatsGraph($ts['svgpoints']); } if ($display_mode > 1) { // print question $pdf->Bookmark($l['w_statistics']); $pdf->printQuestionStats($ts['qstats'], $display_mode); } } if ($mode > 2) {
$test_start_time = $m['testuser_creation_time']; $test_end_time = $m['testuser_end_time']; // Set backlink QR-Code $pdf->setTCExamBackLink(K_PATH_URL . 'admin/code/tce_show_result_user.php?testuser_id=' . $testuser_id . '&test_id=' . $test_id . '&user_id=' . $user_id); } // ------------------------------------------------------------ // --- start page data --- $pdf->AddPage(); // set barcode $pdf->setBarcode($test_id . ':' . $user_id . ':' . $test_start_time); $pdf->SetFillColor(204, 204, 204); $pdf->SetLineWidth(0.1); $pdf->SetDrawColor(0, 0, 0); // print document name (title) $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA * K_TITLE_MAGNIFICATION); $pdf->Cell(0, $main_cell_height * K_TITLE_MAGNIFICATION, $doc_title, 1, 1, 'C', 1); $pdf->Ln(5); // display user info if ($_REQUEST['mode'] >= 3) { // add a bookmark $pdf->Bookmark($user_lastname . ' ' . $user_firstname . ' (' . $user_name . '), ' . $test_score . ' ' . F_formatPdfPercentage($test_score / $test_max_score), 0, 0); // calculate some sizes $user_elements = 4; $user_data_cell_width = round($page_width / $user_elements, 2); // print table headings $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_lastname'], 1, 0, 'C', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_firstname'], 1, 0, 'C', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_user'], 1, 0, 'C', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_score'], 1, 1, 'C', 1); $pdf->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA);
$data_cell_height = round($cell_height_ratio * PDF_FONT_SIZE_DATA / $pdf->getScaleFactor(), 2); $main_cell_height = round($cell_height_ratio * PDF_FONT_SIZE_MAIN / $pdf->getScaleFactor(), 2); $data_cell_width = round($page_width / $page_elements, 2); $data_cell_width_third = round($data_cell_width / 3, 2); $data_cell_width_half = round($data_cell_width / 2, 2); // ------------------------------------------------------------ // --- start page data --- $pdf->AddPage(); // set barcode $pdf->setBarcode($user_id . ':' . date('YmdHis')); $pdf->SetFillColor(204, 204, 204); $pdf->SetLineWidth(0.1); $pdf->SetDrawColor(0, 0, 0); // print document name (title) $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA * K_TITLE_MAGNIFICATION); $pdf->Cell(0, $main_cell_height * K_TITLE_MAGNIFICATION, $doc_title, 1, 1, 'C', 1); $pdf->Ln(5); // display user info // calculate some sizes $user_elements = 5; $user_data_cell_width = round($page_width / $user_elements, 2); // print table headings $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_lastname'], 1, 0, 'C', true, '', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_firstname'], 1, 0, 'C', true, '', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_user'], 1, 0, 'C', true, '', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_time_begin'], 1, 0, 'C', true, '', 1); $pdf->Cell($user_data_cell_width, $data_cell_height, $l['w_time_end'], 1, 1, 'C', true, '', 1); $pdf->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA); $sqlu = 'SELECT user_lastname, user_firstname, user_name FROM ' . K_TABLE_USERS . '