$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); $pdf->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA); $pdf->Cell($user_data_cell_width, 1.5 * $data_cell_height, '', 1, 0, 'C', 0); $pdf->Cell($user_data_cell_width, 1.5 * $data_cell_height, '', 1, 0, 'C', 0); $pdf->Cell($user_data_cell_width, 1.5 * $data_cell_height, '', 1, 0, 'C', 0); $pdf->Cell($user_data_cell_width, 1.5 * $data_cell_height, '', 1, 1, 'C', 0); $pdf->Ln(5); // --- display test info --- $info_cell_width = round($page_width / 4, 2); $boxStartY = $pdf->GetY(); // store current Y position // test name $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA * HEAD_MAGNIFICATION); $pdf->Cell($page_width, $data_cell_height * HEAD_MAGNIFICATION, $l['w_test'] . ': ' . $testdata['test_name'], 1, 1, '', 1); $pdf->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA); $infoStartY = $pdf->GetY() + 2; // store current Y position $pdf->SetY($infoStartY); // test duration $pdf->Cell(1.5 * $data_cell_width, $data_cell_height, $l['w_test_time'] . ' [' . $l['w_minutes'] . ']: ', 0, 0, $dirlabel, 0); $pdf->Cell($data_cell_width, $data_cell_height, $testdata['test_duration_time'], 0, 1, $dirvalue, 0); // test start time (to be compiled by the user) $pdf->Cell(1.5 * $data_cell_width, $data_cell_height, $l['w_time_begin'] . ': ', 0, 0, $dirlabel, 0); $pdf->Cell($data_cell_width, $data_cell_height, '', 0, 1, $dirvalue, 0); // test end time (to be compiled by the user)
// --- 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); $itemcount = 1; while ($mq = F_db_fetch_array($rq)) { $question_disabled = 0; if (!F_getBoolean($mq['question_enabled'])) { $question_disabled = 1; }
$passmsg = ''; if ($test_score_threshold > 0) { if ($test_score >= $test_score_threshold) { $passmsg = ' - ' . $l['w_passed']; } else { $passmsg = ' - ' . $l['w_not_passed']; } } $pdf->Cell($user_data_cell_width, $data_cell_height, $user_lastname, 'LTRB', 0, 'C', 0); $pdf->Cell($user_data_cell_width, $data_cell_height, $user_firstname, 'LTRB', 0, 'C', 0); $pdf->Cell($user_data_cell_width, $data_cell_height, $user_name, 'LTRB', 0, 'C', 0); $pdf->Cell($user_data_cell_width, $data_cell_height, $test_score . ' ' . F_formatPdfPercentage($test_score / $test_max_score) . $passmsg, 'LTRB', 1, 'C', 0); $pdf->Ln(5); // --- display test info --- $info_cell_width = round($page_width / 4, 2); $boxStartY = $pdf->GetY(); // store current Y position // test name $pdf->SetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA * HEAD_MAGNIFICATION); $pdf->Cell($page_width, $data_cell_height * HEAD_MAGNIFICATION, $l['w_test'] . ': ' . $test_name, 1, 1, '', 1); $pdf->SetFont(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA); $infoStartY = $pdf->GetY() + 2; // store current Y position $pdf->SetY($infoStartY); $column_names_width = round($info_cell_width * 1.2, 2); // test start time $pdf->Cell($column_names_width, $data_cell_height, $l['w_time_begin'] . ': ', 0, 0, $dirlabel, 0); $pdf->Cell($info_cell_width, $data_cell_height, $test_start_time, 0, 1, $dirvalue, 0); // test end time $pdf->Cell($column_names_width, $data_cell_height, $l['w_time_end'] . ': ', 0, 0, $dirlabel, 0); $pdf->Cell($info_cell_width, $data_cell_height, $test_end_time, 0, 1, $dirvalue, 0);