15){ //$txt=str_split($t,55); $txt = explode('?', $t); $this->SetX($x); $this->Cell($w,$first,$txt[0],'','',''); $this->SetX($x); $this->Cell($w,$second,$txt[1],'','',''); $this->SetX($x); $this->Cell($w,$third,$txt[2],'','',''); $this->SetX($x); $this->Cell($w,$h,'','LTRB',0,'L',0); } else{ $this->SetX($x); $this->Cell($w,$h,$t,'LTRB',0,'L',0); } } } $textColour = array( 0, 0, 0 ); $tableHeaderTopTextColour = array( 255, 255, 255 ); $tableHeaderTopFillColour = array( 125, 152, 179 ); $tableHeaderTopProductTextColour = array( 0, 0, 0 ); $tableHeaderTopProductFillColour = array( 143, 173, 204 ); $tableHeaderLeftTextColour = array( 99, 42, 57 ); $tableHeaderLeftFillColour = array( 184, 207, 229 ); $tableBorderColour = array( 50, 50, 50 ); $tableRowFillColour = array( 213, 170, 170 ); $logoXPos = 20; $logoYPos = 40; $logoWidth = 40; $columnLabels = array( "QRкод" , "Инфо" );//, "Имя", "Логин", "Пароль" $arrNames = array( '0' =>"qr" , '1' =>"name", '2' =>"login", '3' =>"password" ); $countListItem = 5; $mainArray = []; $tempArray = []; $halfArray = []; $i = 1; $textQR = "QRкод"; $pdf = new myPDF( 'P', 'mm', 'A4' ); $myArray = $_SESSION['staffQRList']; foreach( $myArray as $item) { $tempArray[] = $item; if ($i == $countListItem){ $mainArray[] = $tempArray; $tempArray = []; $countListItem += 5; $halfArray = []; } else { $halfArray[] = $item; } $i++; } if ( !empty($halfArray)) { $mainArray[] = $halfArray; } $myArray = $mainArray; $countListItem = 5; $countPage = ceil(count($_SESSION['staffQRList'])/$countListItem); $ii = 0; $textQR = iconv('UTF-8', 'windows-1251', $textQR); $w=65; $h=41; while ( $ii < $countPage ) { $logoYPos = 40; $pdf->AddPage(); $pdf->AddFont('Arial','','arial.php'); $pdf->SetFont('Arial'); // Логотип $pdf->SetDrawColor( $tableBorderColour[0], $tableBorderColour[1], $tableBorderColour[2] ); $pdf->Ln( 15 ); $pdf->SetTextColor( $tableHeaderTopProductTextColour[0], $tableHeaderTopProductTextColour[1], $tableHeaderTopProductTextColour[2] ); $pdf->SetFillColor( $tableHeaderTopProductFillColour[0], $tableHeaderTopProductFillColour[1], $tableHeaderTopProductFillColour[2] ); // Остальные ячейки заголовков $pdf->SetTextColor( $tableHeaderTopTextColour[0], $tableHeaderTopTextColour[1], $tableHeaderTopTextColour[2] ); $pdf->SetFillColor( $tableHeaderTopFillColour[0], $tableHeaderTopFillColour[1], $tableHeaderTopFillColour[2] ); $pdf->Cell( 60, 12, iconv('UTF-8', 'windows-1251', $columnLabels[0]), 1, 0, 'C', true ); $pdf->Cell( 120, 12, iconv('UTF-8', 'windows-1251', $columnLabels[1]), 1, 0, 'C', true ); $pdf->Ln( 12 ); $fill = false; $row = 0; for( $r = 0 ; $r < $countListItem; $r++) { if(null == $myArray[$ii][$r]['password']){ continue; } $pdf->SetTextColor( $tableHeaderLeftTextColour[0], $tableHeaderLeftTextColour[1], $tableHeaderLeftTextColour[2] ); $pdf->SetFillColor( $tableHeaderLeftFillColour[0], $tableHeaderLeftFillColour[1], $tableHeaderLeftFillColour[2] ); $pdf->SetTextColor( $textColour[0], $textColour[1], $textColour[2] ); $pdf->SetFillColor( $tableRowFillColour[0], $tableRowFillColour[1], $tableRowFillColour[2] ); $pdf->SetFont( 'Arial', '', 15 ); $textInfo = "Имя: ".$myArray[$ii][$r]['name']."?Логин: ".$myArray[$ii][$r]['login']."?Пароль: " .$myArray[$ii][$r]['password'] ; $textInfo = iconv('UTF-8', 'windows-1251', $textInfo); $x = $pdf->getx(); $rty = $pdf->Image( $myArray[$ii][$r]['qr'], $logoXPos, $logoYPos, $logoWidth ); $pdf->myCell(60,$h,$x,$rty); $x=$pdf->getx(); $pdf->myCell(120,$h,$x,$textInfo); $pdf->Ln(); $row++; $fill = !$fill; $pdf->Ln( 0 ); $logoYPos += 40; } $ii++; } $pdf->Output( "report.pdf", "I" ); ?>