コード例 #1
0
ファイル: util.php プロジェクト: Hermannhaf/DeepskyLog
 public function pdfObjectsDetails($result)
 {
     global $dateformat, $baseURL, $instDir, $objObserver, $loggedUser, $objLocation, $objInstrument, $objPresentations;
     $result = $this->sortResult($result);
     $pdf = new Cezpdf('a4', 'landscape');
     $pdf->selectFont($instDir . 'lib/fonts/Helvetica.afm');
     $bottom = 40;
     $bottomsection = 30;
     $top = 550;
     $header = 570;
     $footer = 10;
     $xleft = 20;
     $xmid = 431;
     $fontSizeSection = 10;
     $fontSizeText = 8;
     $descriptionLeadingSpace = 20;
     $sectionBarSpace = 3;
     $deltalineSection = 2;
     $deltaline = $fontSizeText + 4;
     $pagenr = 0;
     $y = 0;
     $xbase = $xmid;
     $sectionBarHeight = $fontSizeSection + 4;
     $SectionBarWidth = 400 + $sectionBarSpace;
     $theDate = date('d/m/Y');
     $pdf->addTextWrap($xleft, $header, 100, 8, utf8_decode($theDate));
     if ($loggedUser && $objObserver->getObserverProperty($loggedUser, 'name') && $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name') && $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name')) {
         $pdf->addTextWrap($xleft, $footer, $xmid + $SectionBarWidth, 8, utf8_decode(html_entity_decode(LangPDFMessage19 . $objObserver->getObserverProperty($loggedUser, 'firstname') . ' ' . $objObserver->getObserverProperty($loggedUser, 'name') . ' ' . LangPDFMessage20 . $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name') . ' ' . LangPDFMessage21 . $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name'))), 'center');
     }
     $pdf->addTextWrap($xleft, $header, $xmid + $SectionBarWidth, 10, utf8_decode(html_entity_decode($_GET['pdfTitle'])), 'center');
     $pdf->addTextWrap($xmid + $SectionBarWidth - $sectionBarSpace - 100, $header, 100, 8, utf8_decode(LangPDFMessage22 . '1'), 'right');
     while (list($key, $valueA) = each($result)) {
         $con = $valueA['objectconstellation'];
         if ($y < $bottom) {
             $y = $top;
             if ($xbase == $xmid) {
                 if ($pagenr++) {
                     $pdf->newPage();
                     $pdf->addTextWrap($xleft, $header, 100, 8, utf8_decode($theDate));
                     if ($loggedUser && $objObserver->getObserverProperty($loggedUser, 'name') && $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name') && $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name')) {
                         $pdf->addTextWrap($xleft, $footer, $xmid + $SectionBarWidth, 8, utf8_decode(html_entity_decode(LangPDFMessage19 . $objObserver->getObserverProperty($loggedUser, 'name') . ' ' . $objObserver->getObserverProperty($loggedUser, 'firstname') . ' ' . LangPDFMessage20 . $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name') . ' ' . LangPDFMessage21 . $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name'))), 'center');
                     }
                     $pdf->addTextWrap($xleft, $header, $xmid + $SectionBarWidth, 10, utf8_decode(html_entity_decode($_GET['pdfTitle'])), 'center');
                     $pdf->addTextWrap($xmid + $SectionBarWidth - $sectionBarSpace - 100, $header, 100, 8, utf8_decode(LangPDFMessage22 . $pagenr), 'right');
                 }
                 $xbase = $xleft;
             } else {
                 $xbase = $xmid;
             }
         }
         $pdf->addTextWrap($xbase, $y, 30, $fontSizeText, utf8_decode($valueA['objectseen']));
         // seen
         $pdf->addTextWrap($xbase + 30, $y, 40, $fontSizeText, utf8_decode($valueA['objectlastseen']));
         // last seen
         $pdf->addTextWrap($xbase + 70, $y, 85, $fontSizeText, utf8_decode('<b>' . '<c:alink:' . $baseURL . 'index.php?indexAction=detail_object&amp;object=' . urlencode($valueA['objectname']) . '>' . $valueA['showname']));
         // object
         $pdf->addTextWrap($xbase + 150, $y, 30, $fontSizeText, utf8_decode('</c:alink></b>' . $valueA['objecttype']));
         // type
         $pdf->addTextWrap($xbase + 180, $y, 20, $fontSizeText, utf8_decode($valueA['objectconstellation']));
         // constellation
         $pdf->addTextWrap($xbase + 200, $y, 17, $fontSizeText, utf8_decode($objPresentations->presentationInt1($valueA['objectmagnitude'], 99.90000000000001, '')), 'left');
         // mag
         $pdf->addTextWrap($xbase + 217, $y, 18, $fontSizeText, utf8_decode($objPresentations->presentationInt1($valueA['objectsurfacebrightness'], 99.90000000000001, '')), 'left');
         // sb
         $pdf->addTextWrap($xbase + 235, $y, 60, $fontSizeText, utf8_decode($objPresentations->raToStringHM($valueA['objectra']) . ' ' . $objPresentations->decToString($valueA['objectdecl'], 0)));
         // ra - decl
         $pdf->addTextWrap($xbase + 295, $y, 55, $fontSizeText, utf8_decode($valueA['objectsize'] . '/' . $objPresentations->presentationInt($valueA['objectpa'], 999, "-")));
         // size
         $pdf->addTextWrap($xbase + 351, $y, 17, $fontSizeText, utf8_decode($objPresentations->presentationInt1($valueA['objectcontrast'], '', '')), 'left');
         // contrast
         $pdf->addTextWrap($xbase + 368, $y, 17, $fontSizeText, utf8_decode((int) $valueA['objectoptimalmagnification']), 'left');
         // magnification
         $pdf->addTextWrap($xbase + 380, $y, 20, $fontSizeText, utf8_decode('<b>' . $valueA[$loggedUser ? $objObserver->getObserverProperty($loggedUser, 'standardAtlasCode', 'urano') : 'urano'] . '</b>'), 'right');
         // atlas page
         $y -= $deltaline;
         if (array_key_exists('objectlistdescription', $valueA) && $valueA['objectlistdescription']) {
             $theText = $objPresentations->br2nl($valueA['objectlistdescription']);
             $theText = $pdf->addTextWrap($xbase + $descriptionLeadingSpace, $y, $xmid - $xleft - $descriptionLeadingSpace - 10, $fontSizeText, '<i>' . utf8_decode($theText));
             $y -= $deltaline;
             while ($theText) {
                 if ($y < $bottomsection) {
                     $y = $top;
                     if ($xbase == $xmid) {
                         if ($pagenr++) {
                             $pdf->newPage();
                             $pdf->addTextWrap($xleft, $header, 100, 8, utf8_decode($theDate));
                             if ($objObserver->getObserverProperty($loggedUser, 'name') && $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name') && $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name')) {
                                 $pdf->addTextWrap($xleft, $footer, $xmid + $SectionBarWidth, 8, utf8_decode(html_entity_decode(LangPDFMessage19 . $objObserver->getObserverProperty($loggedUser, 'name') . ' ' . $objObserver->getObserverProperty($loggedUser, 'firstname') . LangPDFMessage20 . $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name') . ' ' . LangPDFMessage21 . $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name'))), 'center');
                             }
                             $pdf->addTextWrap($xleft, $header, $xmid + $SectionBarWidth, 10, utf8_decode(html_entity_decode($_GET['pdfTitle'])), 'center');
                             $pdf->addTextWrap($xmid + $SectionBarWidth - $sectionBarSpace - 100, $header, 100, 8, utf8_decode(LangPDFMessage22 . $pagenr), 'right');
                         }
                         $xbase = $xleft;
                         if ($sort) {
                             $y -= $deltalineSection;
                             $pdf->rectangle($xbase - $sectionBarSpace, $y - $sectionBarSpace, $SectionBarWidth, $sectionBarHeight);
                             $pdf->addText($xbase, $y, $fontSizeSection, utf8_decode($GLOBALS[${$sort}]));
                             $y -= $deltaline + $deltalineSection;
                         }
                     } else {
                         $xbase = $xmid;
                         if ($sort) {
                             $y -= $deltalineSection;
                             $pdf->rectangle($xbase - $sectionBarSpace, $y - $sectionBarSpace, $SectionBarWidth, $sectionBarHeight);
                             $pdf->addText($xbase, $y, $fontSizeSection, utf8_decode($GLOBALS[${$sort}]));
                             $y -= $deltaline + $deltalineSection;
                         }
                     }
                 }
                 $theText = $pdf->addTextWrap($xbase + $descriptionLeadingSpace, $y, $xmid - $xleft - $descriptionLeadingSpace - 10, $fontSizeText, utf8_decode($theText));
                 $y -= $deltaline;
             }
             $pdf->addText(0, 0, 10, '</i>');
         } elseif (array_key_exists('objectdescription', $valueA) && $valueA['objectdescription']) {
             $theText = $objPresentations->br2nl($valueA['objectdescription']);
             $theText = $pdf->addTextWrap($xbase + $descriptionLeadingSpace, $y, $xmid - $xleft - $descriptionLeadingSpace - 10, $fontSizeText, '<i>' . utf8_decode($theText));
             $y -= $deltaline;
             while ($theText) {
                 if ($y < $bottomsection) {
                     $y = $top;
                     if ($xbase == $xmid) {
                         if ($pagenr++) {
                             $pdf->newPage();
                             $pdf->addTextWrap($xleft, $header, 100, 8, utf8_decode($theDate));
                             if ($objObserver->getObserverProperty($loggedUser, 'name') && $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name') && $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name')) {
                                 $pdf->addTextWrap($xleft, $footer, $xmid + $SectionBarWidth, 8, utf8_decode(html_entity_decode(LangPDFMessage19 . $objObserver->getObserverProperty($loggedUser, 'name') . ' ' . $objObserver->getObserverProperty($loggedUser, 'firstname') . LangPDFMessage20 . $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name') . ' ' . LangPDFMessage21 . $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name'))), 'center');
                             }
                             $pdf->addTextWrap($xleft, $header, $xmid + $SectionBarWidth, 10, utf8_decode(html_entity_decode($_GET['pdfTitle'])), 'center');
                             $pdf->addTextWrap($xmid + $SectionBarWidth - $sectionBarSpace - 100, $header, 100, 8, utf8_decode(LangPDFMessage22 . $pagenr), 'right');
                         }
                         $xbase = $xleft;
                         if ($sort) {
                             $y -= $deltalineSection;
                             $pdf->rectangle($xbase - $sectionBarSpace, $y - $sectionBarSpace, $SectionBarWidth, $sectionBarHeight);
                             $pdf->addText($xbase, $y, $fontSizeSection, utf8_decode($GLOBALS[${$sort}]));
                             $y -= $deltaline + $deltalineSection;
                         }
                     } else {
                         $xbase = $xmid;
                         if ($sort) {
                             $y -= $deltalineSection;
                             $pdf->rectangle($xbase - $sectionBarSpace, $y - $sectionBarSpace, $SectionBarWidth, $sectionBarHeight);
                             $pdf->addText($xbase, $y, $fontSizeSection, utf8_decode($GLOBALS[${$sort}]));
                             $y -= $deltaline + $deltalineSection;
                         }
                     }
                 }
                 $theText = $pdf->addTextWrap($xbase + $descriptionLeadingSpace, $y, $xmid - $xleft - $descriptionLeadingSpace - 10, $fontSizeText, utf8_decode($theText));
                 $y -= $deltaline;
             }
             $pdf->addText(0, 0, 10, '</i>');
         }
     }
     $pdf->Stream();
 }
コード例 #2
0
ファイル: Packing-Slip.php プロジェクト: digideskio/oscmax2
 $pdf->addText($x += PRODUCTS_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, TABLE_HEADING_PRODUCTS_MODEL);
 $pdf->addText($x += MODEL_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, '');
 $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, '');
 $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, '');
 $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, '');
 $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, '');
 $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 // Sort through the products
 for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
     $prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name'];
     change_color(PRODUCT_LISTING_BKGD_COLOR);
     $pdf->filledRectangle(LEFT_MARGIN, $pos - PRODUCT_TABLE_ROW_HEIGHT, PRODUCT_TABLE_HEADER_WIDTH, PRODUCT_TABLE_ROW_HEIGHT);
     $x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
     $pos = $pos - PRODUCT_TABLE_ROW_HEIGHT + PRODUCT_TABLE_BOTTOM_MARGIN;
     change_color(GENERAL_FONT_COLOR);
     $truncated_str = $pdf->addTextWrap($x, $pos, PRODUCTS_COLUMN_SIZE, TABLE_HEADER_FONT_SIZE, $prod_str);
     $pdf->addText($x += PRODUCTS_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, $order->products[$i]['model']);
     $pdf->addText($x += MODEL_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, '');
     $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, '');
     $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, '');
     $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, '');
     $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, '');
     $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
     if ($truncated_str) {
         change_color(PRODUCT_LISTING_BKGD_COLOR);
         $pdf->filledRectangle(LEFT_MARGIN, $pos - PRODUCT_TABLE_ROW_HEIGHT, PRODUCT_TABLE_HEADER_WIDTH, PRODUCT_TABLE_ROW_HEIGHT);
         $pos = $pos - PRODUCT_TABLE_ROW_HEIGHT + PRODUCT_TABLE_BOTTOM_MARGIN;
         change_color(GENERAL_FONT_COLOR);
         $reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
         $pdf->addText($reset_x, $pos, TABLE_HEADER_FONT_SIZE, $truncated_str);
         $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
コード例 #3
0
 $prod_str = $order->products[$i]['name'];
 change_color(PRODUCT_LISTING_BKGD_COLOR);
 $pdf->filledRectangle(LEFT_MARGIN, $pos - PRODUCT_TABLE_ROW_HEIGHT, PRODUCT_TABLE_HEADER_WIDTH, PRODUCT_TABLE_ROW_HEIGHT);
 $x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;
 $pos = $pos - PRODUCT_TABLE_ROW_HEIGHT + PRODUCT_TABLE_BOTTOM_MARGIN;
 //page feed
 if ($pos <= 30) {
     $pdf->ezNewPage();
     $pos = 780;
 }
 // end page feed
 change_color(GENERAL_FONT_COLOR);
 $pdf->rectangle(15, $pos - 2, 8, 8);
 // $pdf->addText($x += PRODUCTS_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$order->products[$i]['model']);
 $pdf->addText($x, $pos, TABLE_HEADER_FONT_SIZE, $order->products[$i]['model']);
 $truncated_str = $pdf->addTextWrap($x += MODEL_COLUMN_SIZE, $pos, PRODUCTS_COLUMN_SIZE, TABLE_HEADER_FONT_SIZE, $prod_str);
 $pdf->addText($x += MODEL_COLUMN_SIZE + PRODUCTS_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, $order->products[$i]['qty']);
 if ($billing_address_array[0] == $delivery_address_array[0]) {
     //$pdf->addText($x += MODEL_COLUMN_SIZE,$pos,TABLE_HEADER_FONT_SIZE,$order->products[$i]['tax']);
     $pdf->addText($x += MODEL_COLUMN_SIZE, $pos, TABLE_HEADER_FONT_SIZE, $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']));
     //$pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']));
     $pdf->addText($x += PRICING_COLUMN_SIZES, $pos, TABLE_HEADER_FONT_SIZE, $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']));
     //$pdf->addText($x += PRICING_COLUMN_SIZES,$pos,TABLE_HEADER_FONT_SIZE,$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']));
 }
 $pos -= PRODUCT_TABLE_BOTTOM_MARGIN;
 if ($truncated_str) {
     change_color(PRODUCT_LISTING_BKGD_COLOR);
     $pdf->filledRectangle(LEFT_MARGIN, $pos - PRODUCT_TABLE_ROW_HEIGHT, PRODUCT_TABLE_HEADER_WIDTH, PRODUCT_TABLE_ROW_HEIGHT);
     $pos = $pos - PRODUCT_TABLE_ROW_HEIGHT + PRODUCT_TABLE_BOTTOM_MARGIN;
     change_color(GENERAL_FONT_COLOR);
     $reset_x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN;