function download_pdf_file($assign, $sub, $auto_judge_scenarios, $auto_judge_scenarios_output) { // 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(PDF_AUTHOR); $pdf->SetTitle('Auto Judge Report'); $pdf->SetSubject('Auto Judge Report'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); } // add a page $pdf->AddPage(); $report_table = ' <style> table.first{ width: 100%; border-collapse: collapse; } td { font-size: 0.9em; border: 1px solid #95CAFF; padding: 3px 7px 2px 7px; } th { font-size: 0.9em; text-align: center; padding-top: 5px; padding-bottom: 4px; background-color: #3399FF; color: #ffffff; } </style> <table class="first"> <tr> <th>Είσοδος</th> <th>Έξοδος</th> <th>Τελεστής</th> <th>Αναμεν. Έξοδος</th> <th>Βαρύτητα</th> <th >Αποτέλεσμα</th> </tr> ' . get_table_content($auto_judge_scenarios, $auto_judge_scenarios_output, $assign->max_grade) . ' </table>'; $report_details = ' <style> table.first{ width: 100%; border-collapse: collapse; vertical-align: center; } td { font-size: 1em; border: 1px solid #000000; padding: 3px 7px 2px 7px; text-align: center; } th { font-size: 1.0em; text-align: left; padding-top: 5px; padding-bottom: 4px; background-color: #3399FF; color: #ffffff; width: 120px; border: 1px solid #000000; } </style> <table class="first"> <tr> <th> Μάθημα</th> <td>' . htmlspecialchars(get_course_title(), ENT_QUOTES) . ' </td> </tr> <tr> <th> Εργασία</th> <td> ' . htmlspecialchars($assign->title, ENT_QUOTES) . '</td> </tr> <tr> <th> Εκπαιδευόμενος</th><td> ' . htmlspecialchars(q(uid_to_name($sub->uid)), ENT_QUOTES) . '</td> </tr> <tr> <th> Βαθμός</th> <td>' . htmlspecialchars($sub->grade, ENT_QUOTES) . '/' . htmlspecialchars($assign->max_grade, ENT_QUOTES) . ' </td> </tr> <tr> <th> Κατάταξη</th> <td>' . htmlspecialchars(get_submission_rank($assign->id, $sub->grade, $sub->submission_date), ENT_QUOTES) . '</td> </tr> </table>'; $pdf->writeHTML($report_details, true, false, true, false, ''); $pdf->Ln(); $pdf->writeHTML($report_table, true, false, true, false, ''); $pdf->Output('auto_judge_report_' . q(uid_to_name($sub->uid)) . '.pdf', 'D'); }
function download_pdf_file($assign, $submissions) { // 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(PDF_AUTHOR); $pdf->SetTitle('Rank Report'); $pdf->SetSubject('Rank Report'); // set default header data $pdfHeaderStr = htmlspecialchars('Αναφορά κατάταξης εκπαιδευόμενων για το μάθημα ' . get_course_title() . ' και την εργασία ' . $assign->title, ENT_QUOTES); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, $pdfHeaderStr); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(3); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); } // add a page $pdf->AddPage(); $report_details = ' <style> table.first{ width: 100%; border-collapse: collapse; vertical-align: center; } td { font-size: 1em; border: 1px solid #000000; padding: 3px 7px 2px 7px; text-align: center; } th { font-size: 1.1em; text-align: left; padding-top: 5px; padding-bottom: 4px; background-color: #3399FF; color: #ffffff; border: 1px solid #000000; } </style> <table class="first"> <tr> <th>Κατάταξη</th> <th>Εκπαιδευόμενος</th> <th>Βαθμός</th> <th>Περασμένα Σενάρια</th> </tr> ' . get_table_content($assign, $submissions) . ' </table> '; $pdf->writeHTML($report_details, true, false, true, false, ''); $pdf->Ln(); $pdf->Output('Rank Report_' . greeklish(get_course_title() . '_' . $assign->title) . '.pdf', 'D'); }