[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/vtlib/Vtiger/PDF/inventory/ -> FooterViewer.php (source)

   1  <?php
   2  /*+**********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   ************************************************************************************/
  10  include_once dirname(__FILE__) . '/../viewers/FooterViewer.php';
  11  
  12  class Vtiger_PDF_InventoryFooterViewer extends Vtiger_PDF_FooterViewer {
  13  
  14      static $DESCRIPTION_DATA_KEY = '__DES__DATA__';
  15      static $TERMSANDCONDITION_DATA_KEY = '__TANDC__DATA__';
  16      static $DESCRIPTION_LABEL_KEY = '__DES_LABEL__';
  17      static $TERMSANDCONDITION_LABEL_KEY = '__TANDC_LABEL__';
  18  
  19  	function totalHeight($parent) {
  20          if($this->model && $this->onEveryPage()) {
  21              $pdf = $parent->getPDF();
  22  
  23              $footerTitleHeight = 8.0;
  24              
  25              $termsConditionText = $this->model->get(self::$TERMSANDCONDITION_DATA_KEY);
  26              $termsConditionHeight = $pdf->GetStringHeight($termsConditionText, $parent->getTotalWidth());
  27  
  28              if($termsConditionHeight) $termsConditionHeight += $footerTitleHeight;
  29  
  30              $descriptionText = $this->model->get(self::$DESCRIPTION_DATA_KEY);
  31              $descriptionHeight = $pdf->GetStringHeight($descriptionText, $parent->getTotalWidth());
  32  
  33              if($descriptionHeight) $descriptionHeight += $footerTitleHeight;
  34  
  35              return $termsConditionHeight + $descriptionHeight;
  36          }
  37          return parent::totalHeight($parent);
  38      }
  39  
  40  	function display($parent) {
  41  
  42          $pdf = $parent->getPDF();
  43          $footerFrame = $parent->getFooterFrame();
  44  
  45          if($this->model) {
  46              $targetFooterHeight = ($this->onEveryPage())? $footerFrame->h : 0;
  47              
  48              $descriptionString = $this->labelModel->get(self::$DESCRIPTION_LABEL_KEY);
  49              $description = $this->model->get(self::$DESCRIPTION_DATA_KEY);
  50              $descriptionHeight = $pdf->GetStringHeight($descriptionString, $footerFrame->w);
  51              $pdf->SetFillColor(205,201,201);
  52              $pdf->MultiCell($footerFrame->w, $descriptionHeight, $descriptionString, 1, 'L', 1, 1, $footerFrame->x, $footerFrame->y);
  53              $pdf->MultiCell($footerFrame->w, $targetFooterHeight - $descriptionHeight, $description, 1, 'L',
  54                  0, 1, $footerFrame->x, $footerFrame->y + $descriptionHeight);
  55                  
  56              $termsAndConditionLabelString = $this->labelModel->get(self::$TERMSANDCONDITION_LABEL_KEY);
  57              $termsAndCondition = $this->model->get(self::$TERMSANDCONDITION_DATA_KEY);
  58              $offsetY = 2.0;
  59              $termsAndConditionHeight = $pdf->GetStringHeight($termsAndConditionLabelString, $footerFrame->w);
  60              $pdf->SetFillColor(205,201,201);
  61              $pdf->MultiCell($footerFrame->w, $termsAndConditionHeight, $termsAndConditionLabelString, 1, 'L', 1, 1,
  62                  $pdf->GetX(), $pdf->GetY() + $offsetY);
  63              $pdf->MultiCell($footerFrame->w, $targetFooterHeight - $termsAndConditionHeight, $termsAndCondition,1, 'L', 0, 1,
  64                  $pdf->GetX(), $pdf->GetY());
  65          }
  66      }
  67  }
  68  ?>


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1