function pdfAssignmentPage($code, $margins, $fullname, grade_item $item, $course, $blended, $gradingmarks = false) { global $CFG; $assignmentname = blended_get_item_name($item); $assignmenttimedue = blended_get_item_due_date($item); // if(isset($item->duedate)){ // $assignmenttimedue= $item->duedate ? userdate($item->duedate,"%A %d, %B, %Y") : ' '; // } // else if(isset($item->timedue)){ // $assignmenttimedue= $item->timedue ? userdate($item->timedue,"%A %d, %B, %Y") : ' '; // } $assignment_code = $item->id; $formatoptions = new stdClass(); $formatoptions->noclean = true; $item_desc = blended_get_item_description($item); $cellHtmlDescription = format_text($item_desc->text, $item_desc->format, $formatoptions); $coursename = $course->fullname; // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Blended Module'); $pdf->SetTitle('Submission form for activity "$assigment_name".'); $pdf->SetSubject('Blended module. (C)ITAST group. Juan Pablo de Castro'); $pdf->SetKeywords('Moodle, blended, ITAST'); //set margins $pdf->SetMargins($margins['left'], $margins['top'], $margins['right']); $pdf->SetFooterMargin(0); //PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, $margins['bottom']); //set image scale factor $pdf->setImageScale(2.5); // set font $pdf->AddFont('courier', '', ''); $pdf->SetFont('courier', '', 10); // add a page $pdf->AddPage(); $dims = new stdClass(); $dims->coords = array(); $headeroptions = new stdClass(); $headeroptions->rowHeight = 6; $headeroptions->logoWidth = 30; $headeroptions->codebarWidth = 30; $headeroptions->logo_url = "pix/UVa_logo.jpg"; $headeroptions->codebarType = $blended->codebartype; $headeroptions->cellHtmlText = '<b>' . $assignmentname . '</b>'; $headeroptions->cellHtmlDate = get_string('duedate', 'blended') . ':<b>' . $assignmenttimedue . '</b>' . ' '; $headeroptions->cellHtmlUser = get_string('username', 'blended') . ':' . $fullname; $headeroptions->cellCourseName = get_string('course') . ':' . $coursename; $headeroptions->marksize = 5; $headeroptions->marksName = 'a'; $identifylabel = "printCourseLabels.php?a={$blended->id}&action=barcode&scale=2&code={$code}"; blended_print_page_header($pdf, $dims, $code, $assignment_code . "1", $headeroptions, '', $identifylabel, ''); $pdf->writeHTMLCell($pdf->getPageWidth() - $margins['left'] - $margins['right'], '', $margins['left'], '', $cellHtmlDescription, true, 0, 0, true); $pdf->Ln(); //Close and output PDF document ob_end_clean(); $pdf->Output('labels.pdf', 'I'); }
echo $OUTPUT->spacer(array('height' => 30)); $url = "assignmentpage.php?id={$id}"; if ($code == -1) { $OUTPUT->notify(get_string("cantprintassignmentpage", "blended"), $url); } else { $OUTPUT->notify(get_string("cantprintassignmentpage2", "blended"), $url); } echo $OUTPUT->spacer(array('height' => 20)); } if (true) { pdfAssignmentPage($code, $margins, $fullname, $item, $course, $blended, $gradingmarks = false); } else { require_once "php-barcode.php"; // Imprimimos la hoja de tarea -------------------------------------- $assignmentname = blended_get_item_name($item); $assignmenttimedue = blended_get_item_due_date($item); $formatoptions = new stdClass(); $formatoptions->noclean = true; $item_description = blended_get_item_description($item); $description = format_text($item_description->text, $item_description->format, $formatoptions); echo "<table width=\"692\" height=\"104\" border=\"1\">"; echo "<tr>"; echo "<td width=\"216\" height=\"132\" rowspan=\"4\" bordercolor=\"#000000\"><img src=\"printlabels.php?a={$blended->id}&action=barcode&scale=2&code={$code}\" width=\"210\" height=\"90\" alt=\"barcode\" /></td>"; echo "<td width=\"400\" height=\"23\" bordercolor=\"#000000\"><strong>Tarea: </strong>" . $assignmentname . "</td>"; echo "<td width=\"100\" bordercolor=\"#000000\"><strong>Calificacion:</strong></td>"; echo "</tr>"; echo "<tr>"; echo "<td height=\"23\" bordercolor=\"#000000\"><strong>Fecha entrega: </strong>" . $assignmenttimedue . "</td>"; echo "<td width=\"100\" rowspan=\"3\" bordercolor=\"#000000\"> </td>"; echo "</tr>"; echo "<tr>";