F_display_db_error(); } } // end while for topics } else { F_display_db_error(); } } // end while for module } else { F_display_db_error(); } $pdf->lastpage(true); $pdf->SetAutoPageBreak(false); $pdf->SetFont('helvetica', '', 5); $pdf->SetTextColor(0, 127, 255); $msg = "Powered by TCExam (www.tcexam.org)"; $lnk = "http://www.tcexam.org"; $pdf->SetXY(15, $pdf->getPageHeight(), true); $pdf->Cell(0, 0, $msg, 0, 0, 'R', 0, $lnk, 0, false, 'B', 'B'); // set PDF file name switch ($expmode) { case 1: $pdf_filename = 'tcexam_subject_' . $subject_id . '_' . date('YmdHi') . '.pdf'; break; case 2: $pdf_filename = 'tcexam_module_' . $module_id . '_' . date('YmdHi') . '.pdf'; break; case 3: $pdf_filename = 'tcexam_all_modules_' . date('YmdHi') . '.pdf'; break;
// NOTE: PDF tests are always random for ($item = 1; $item <= $test_num; $item++) { // generate $test_num tests $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);