本文整理汇总了PHP中unknown::AddPage方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown::AddPage方法的具体用法?PHP unknown::AddPage怎么用?PHP unknown::AddPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown
的用法示例。
在下文中一共展示了unknown::AddPage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: emarking_draw_student_list
/**
* Draws a table with a list of students in the $pdf document
*
* @param unknown $pdf
* PDF document to print the list in
* @param unknown $logofilepath
* the logo
* @param unknown $downloadexam
* the exam
* @param unknown $course
* the course
* @param unknown $studentinfo
* the student info including name and idnumber
*/
function emarking_draw_student_list($pdf, $logofilepath, $downloadexam, $course, $studentinfo)
{
global $CFG;
// Pages should be added automatically while the list grows
$pdf->SetAutoPageBreak(true);
$pdf->AddPage();
// If we have a logo we draw it
$left = 10;
if ($CFG->emarking_includelogo && $logofilepath) {
$pdf->Image($logofilepath, $left, 6, 30);
$left += 40;
}
// We position to the right of the logo and write exam name
$top = 7;
$pdf->SetFont('Helvetica', 'B', 12);
$pdf->SetXY($left, $top);
$pdf->Write(1, core_text::strtoupper($downloadexam->name));
// Write course name
$top += 6;
$pdf->SetFont('Helvetica', '', 8);
$pdf->SetXY($left, $top);
$pdf->Write(1, core_text::strtoupper(get_string('course') . ': ' . $course->fullname));
$teachers = get_enrolled_users(context_course::instance($course->id), 'mod/emarking:supervisegrading');
$teachersnames = array();
foreach ($teachers as $teacher) {
$teachersnames[] = $teacher->firstname . ' ' . $teacher->lastname;
}
$teacherstring = implode(',', $teachersnames);
// Write number of students
$top += 4;
$pdf->SetXY($left, $top);
$pdf->Write(1, core_text::strtoupper(get_string('teacher', 'mod_emarking') . ': ' . $teacherstring));
// Write date
$top += 4;
$pdf->SetXY($left, $top);
$pdf->Write(1, core_text::strtoupper(get_string('date') . ': ' . date("l jS F g:ia", $downloadexam->examdate)));
// Write number of students
$top += 4;
$pdf->SetXY($left, $top);
$pdf->Write(1, core_text::strtoupper(get_string('students') . ': ' . count($studentinfo)));
// Write the table header
$left = 10;
$top += 8;
$pdf->SetXY($left, $top);
$pdf->Cell(10, 10, "N°", 1, 0, 'C');
$pdf->Cell(20, 10, core_text::strtoupper(get_string('idnumber')), 1, 0, 'C');
$pdf->Cell(20, 10, core_text::strtoupper(get_string('photo', 'mod_emarking')), 1, 0, 'C');
$pdf->Cell(90, 10, core_text::strtoupper(get_string('name')), 1, 0, 'C');
$pdf->Cell(50, 10, core_text::strtoupper(get_string('signature', 'mod_emarking')), 1, 0, 'C');
$pdf->Ln();
// Write each student
$current = 0;
foreach ($studentinfo as $stlist) {
if (!$stlist->id && $downloadexam->extraexams > 0) {
error_log(print_r($stlist, true));
continue;
}
$current++;
$pdf->Cell(10, 10, $current, 1, 0, 'C');
$pdf->Cell(20, 10, $stlist->idnumber, 1, 0, 'C');
$x = $pdf->GetX();
$y = $pdf->GetY();
$pdf->Image($stlist->picture, $x + 5, $y, 10, 10, "PNG", null, "T", true);
$pdf->SetXY($x, $y);
$pdf->Cell(20, 10, "", 1, 0, 'L');
$pdf->Cell(90, 10, core_text::strtoupper($stlist->name), 1, 0, 'L');
$pdf->Cell(50, 10, "", 1, 0, 'L');
$pdf->Ln();
}
}
示例2: emarking_add_answer_sheet
/**
*
* @param unknown $pdf
* @param unknown $filedir
* @param unknown $stinfo
* @param unknown $logofilepath
* @param unknown $path
* @param unknown $fileimg
* @param unknown $course
* @param unknown $examname
* @param unknown $answers
* @param unknown $attemptid
*/
function emarking_add_answer_sheet($pdf, $filedir, $stinfo, $logofilepath, $path, $fileimg, $course, $examname, $answers, $attemptid)
{
global $CFG;
require_once $CFG->dirroot . '/mod/assign/feedback/editpdf/fpdi/fpdi2tcpdf_bridge.php';
require_once $CFG->dirroot . '/mod/assign/feedback/editpdf/fpdi/fpdi.php';
if ($answers == null) {
return;
}
$answerspdffilename = $filedir . '/answer' . random_string(15) . '.pdf';
$answerspdf = emarking_create_omr_answer_sheet($answers);
$answerspdf->Output($answerspdffilename, 'F');
$pdf->setSourceFile($answerspdffilename);
$tplidx = $pdf->ImportPage(1);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage('P', array($s['w'], $s['h']));
$pdf->useTemplate($tplidx);
if ($path) {
$pdf->setSourceFile($path);
}
$top = 50;
$left = 10;
$width = $s['w'] - 20;
$height = $s['h'] - 65;
// Corners
$style = array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0));
$pdf->Circle($left, $top, 9, 0, 360, 'F', $style, array(0, 0, 0));
$pdf->Circle($left, $top, 4, 0, 360, 'F', $style, array(255, 255, 255));
$pdf->Circle($left + $width, $top, 9, 0, 360, 'F', $style, array(0, 0, 0));
$pdf->Circle($left + $width, $top, 4, 0, 360, 'F', $style, array(255, 255, 255));
$pdf->Circle($left, $top + $height, 9, 0, 360, 'F', $style, array(0, 0, 0));
$pdf->Circle($left, $top + $height, 4, 0, 360, 'F', $style, array(255, 255, 255));
$pdf->Circle($left + $width, $top + $height, 9, 0, 360, 'F', $style, array(0, 0, 0));
$pdf->Circle($left + $width, $top + $height, 4, 0, 360, 'F', $style, array(255, 255, 255));
emarking_draw_header($pdf, $stinfo, $examname, 1, $fileimg, $logofilepath, $course, null, false, true, $attemptid);
}