/** * Draws the personalized header in a PDF * * @param unknown $pdf * @param unknown $stinfo * @param unknown $examname * @param unknown $pagenumber * @param unknown $fileimgpath * @param unknown $logofilepath * @param unknown $course * @param string $totalpages * @param string $bottomqr * @param string $isanswersheet * @param number $attemptid */ function emarking_draw_header($pdf, $stinfo, $examname, $pagenumber, $fileimgpath, $logofilepath, $course, $totalpages = null, $bottomqr = true, $isanswersheet = false, $attemptid = 0) { global $CFG; $pdf->SetAutoPageBreak(false); // If we have a log, it is drawn on the top left part if ($CFG->emarking_includelogo && $logofilepath) { $pdf->Image($logofilepath, 2, 8, 30); } // Exam name $left = 58; $top = 8; $pdf->SetFont('Helvetica', '', 12); $pdf->SetXY($left, $top); $pdf->Write(1, core_text::strtoupper($examname)); // Student name $pdf->SetFont('Helvetica', '', 9); $top += 5; $pdf->SetXY($left, $top); $pdf->Write(1, core_text::strtoupper(get_string('name') . ": " . $stinfo->name)); $top += 4; // Student idnumber if ($stinfo->idnumber && strlen($stinfo->idnumber) > 0) { $pdf->SetXY($left, $top); $pdf->Write(1, get_string('idnumber', 'mod_emarking') . ": " . $stinfo->idnumber); $top += 4; } // Course name $pdf->SetXY($left, $top); $pdf->Write(1, core_text::strtoupper(get_string('course') . ": " . $course->fullname)); $top += 4; if (file_exists($stinfo->picture)) { $pdf->Image($stinfo->picture, 35, 8, 15, 15, "PNG", null, "T", true); } // Page number and total pages if ($totalpages) { $totals = new stdClass(); $totals->identified = $pagenumber; $totals->total = $totalpages; $pdf->SetXY($left, $top); $pdf->Write(1, core_text::strtoupper(get_string('page') . ": " . get_string('aofb', 'mod_emarking', $totals))); } // Generate the QR images $qrstring = "{$stinfo->id}-{$course->id}-{$pagenumber}"; // If the page is an answer sheets (has bubbles), add the attemptid if ($isanswersheet && $attemptid > 0) { $qrstring .= '-' . $attemptid . '-BB'; } list($img, $imgrotated) = emarking_create_qr_image($fileimgpath, $qrstring, $stinfo, $pagenumber); $pdf->Image($img, 176, 3, 34); if ($bottomqr) { $pdf->Image($imgrotated, 0, $pdf->getPageHeight() - 35, 34); } // Delete QR images unlink($img); unlink($imgrotated); }
function emarking_draw_header($pdf, $stinfo, $examname, $pagenumber, $fileimgpath, $logofilepath, $course, $totalpages = null, $bottomqr = true, $isanswersheet = false, $attemptid = 0) { global $CFG; $pdf->SetAutoPageBreak(false); // For the QR string and get the images $qrstring = "{$stinfo->id}-{$course->id}-{$pagenumber}"; if ($isanswersheet && $attemptid > 0) { $qrstring .= '-' . $attemptid . '-BB'; } list($img, $imgrotated) = emarking_create_qr_image($fileimgpath, $qrstring, $stinfo, $pagenumber); if ($CFG->emarking_includelogo && $logofilepath) { $pdf->Image($logofilepath, 2, 8, 30); } $left = 38; $top = 8; $pdf->SetFont('times', '', 12); $pdf->SetXY($left, $top); $pdf->Write(1, core_text::strtoupper($examname)); $pdf->SetFont('times', '', 9); $top += 5; $pdf->SetXY($left, $top); $pdf->Write(1, core_text::strtoupper($stinfo->name)); $top += 4; if ($stinfo->idnumber && strlen($stinfo->idnumber) > 0) { $pdf->SetXY($left, $top); $pdf->Write(1, get_string('idnumber', 'mod_emarking') . ": " . $stinfo->idnumber); $top += 4; } $pdf->SetXY($left, $top); $pdf->Write(1, core_text::strtoupper($stinfo->group)); $top += 4; $pdf->SetXY($left, $top); $pdf->Write(1, core_text::strtoupper($course->fullname)); $pdf->Image($img, 176, 3, 34); // y antes era -2 if ($bottomqr) { $pdf->Image($imgrotated, 0, $pdf->getPageHeight() - 35, 34); } unlink($img); unlink($imgrotated); }