First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
+116
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
$ValidAccess = 2010;
|
||||
require_once("include/globals.php");
|
||||
|
||||
|
||||
//
|
||||
// Ensure that the user is logged in
|
||||
//
|
||||
if (SessionActive() != 1 || !UserLoggedIn()) {
|
||||
header("Location: /?action=item-labels&schedule_num=$schedule_num&menu_num=$menu_num&error_code=NOACCESS");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Check permissions
|
||||
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Administration Team','Schedule Team','Supplier');
|
||||
if (!in_array($_SESSION['UserInfo']['type'],$AllowedUserTypes)) {
|
||||
header("Location: /?action=item-labels&schedule_num=$schedule_num&menu_num=$menu_num&error_code=NOACCESS");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$startColumn = 8;
|
||||
$columnWidth = 70;
|
||||
$labelColumns = array();
|
||||
$labelColumns[] = $startColumn;
|
||||
$labelColumns[] = $startColumn + $columnWidth;
|
||||
$labelColumns[] = $startColumn + $columnWidth * 2;
|
||||
|
||||
$startRow = 15;
|
||||
$rowHeight = 25.5;
|
||||
$labelRows = array($startRow);
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$labelRows[] = $startRow + $rowHeight * $i;
|
||||
}
|
||||
|
||||
|
||||
// Initialize the PDF document
|
||||
$document_font = $school_record['document_font'];
|
||||
if (strlen($document_font) == 0) $document_font = "Helvetica";
|
||||
|
||||
$document_font_weight = "";
|
||||
$document_text_color = "#000000";
|
||||
$document_font_size = 10;
|
||||
$incr = 4;
|
||||
|
||||
|
||||
//
|
||||
// Setup PDF document
|
||||
//
|
||||
require("tcpdf/config/lang/eng.php");
|
||||
require("tcpdf/tcpdf.php");
|
||||
|
||||
$pdf= new TCPDF('P', 'mm', 'Letter', true, 'UTF-8', false);
|
||||
|
||||
// set default monospaced font
|
||||
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
||||
|
||||
//set margins
|
||||
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
|
||||
|
||||
//set auto page breaks
|
||||
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
||||
|
||||
//set image scale factor
|
||||
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
||||
|
||||
$font_red = hexdec("00");
|
||||
$font_green = hexdec("00");
|
||||
$font_blue = hexdec("00");
|
||||
|
||||
$pdf->SetTextColor($font_red,$font_green,$font_blue);
|
||||
$pdf->SetFont($document_font,"",$document_font_size);
|
||||
|
||||
$pdf->addPage();
|
||||
|
||||
|
||||
for ($c = 0; $c < count($labelColumns); $c++) {
|
||||
$col = $labelColumns[$c];
|
||||
for ($r = 0; $r < count($labelRows); $r++) {
|
||||
$row = $labelRows[$r];
|
||||
$pdf->SetXY($col,$row);
|
||||
$pdf->Cell($labelWidth,$incr,"Mark Fester",'0',1,'L');
|
||||
|
||||
$row += $incr;
|
||||
$pdf->SetXY($col,$row);
|
||||
$pdf->Cell($labelWidth,$incr,"Pepperoni Pizza",'0',1,'L');
|
||||
|
||||
$row += $incr;
|
||||
$pdf->SetXY($col,$row);
|
||||
$pdf->Cell($labelWidth,$incr,"Chocolate Milk",'0',1,'L');
|
||||
|
||||
$row += $incr;
|
||||
$pdf->SetXY($col,$row);
|
||||
$pdf->Cell($labelWidth,$incr,"Chocolate Milk",'0',1,'L');
|
||||
|
||||
$row += $incr;
|
||||
$pdf->SetXY($col,$row);
|
||||
$pdf->Cell($labelWidth,$incr,"Chocolate Milk",'0',1,'L');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
header('Pragma: public');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Cache-Control: private',false);
|
||||
header('Content-type: application/pdf');
|
||||
header("Content-Disposition: attachment; filename=labels.pdf");
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
|
||||
$pdf->Output("labels.pdf","D");
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user