[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/vtlib/Vtiger/PDF/viewers/ -> 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__) . '/Viewer.php';
  11  
  12  class Vtiger_PDF_FooterViewer extends Vtiger_PDF_Viewer {
  13  
  14      protected $model;
  15      
  16      protected $onEveryPage = true;
  17      protected $onLastPage = false;
  18      
  19  	function setOnEveryPage() {
  20          $this->onEveryPage = true;
  21          $this->onLastPage = false;
  22      }
  23      
  24  	function onEveryPage() {
  25          return $this->onEveryPage;
  26      }
  27      
  28  	function setOnLastPage() {
  29          $this->onEveryPage = false;
  30          $this->onLastPage = true;
  31      }
  32      
  33  	function onLastPage() {
  34          return $this->onLastPage;
  35      }
  36      
  37  	function setModel($m) {
  38          $this->model = $m;
  39      }
  40      
  41  	function totalHeight($parent) {
  42          $height = 0.1;
  43          
  44          if($this->model && $this->onEveryPage()) {
  45              $pdf = $parent->getPDF();
  46  
  47              $contentText = $this->model->get('content');
  48              $height = $pdf->GetStringHeight($contentText, $parent->getTotalWidth());
  49          }        
  50  
  51          if($this->onEveryPage) return $height;
  52          if($this->onLastPage && $parent->onLastPage()) return $height;
  53          return 0;
  54      }
  55      
  56  	function initDisplay($parent) {
  57          
  58      }
  59  
  60  	function display($parent) {
  61  
  62          $pdf = $parent->getPDF();
  63          $footerFrame = $parent->getFooterFrame();
  64          
  65          if($this->model) {
  66              $targetFooterHeight = ($this->onEveryPage())? $footerFrame->h : 0;
  67                  
  68              $pdf->MultiCell($footerFrame->w, $targetFooterHeight, $this->model->get('content'), 1, 'L', 0, 1, $footerFrame->x, $footerFrame->y);
  69          }
  70          
  71      }
  72      
  73  }


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