[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

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


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