OXID eShop CE  4.10.7
 All Classes Namespaces Files Functions Variables Pages
invoicepdfblock.php
Go to the documentation of this file.
1 <?php
2 
7 {
8 
14  protected $_aCache = array();
15 
21  protected $_sFont = 'Arial';
22 
29  protected function _toCache($sFunc, $aParams)
30  {
31  $oItem = new stdClass();
32  $oItem->sFunc = $sFunc;
33  $oItem->aParams = $aParams;
34  $this->_aCache[] = $oItem;
35  }
36 
42  public function run($oPdf)
43  {
44  foreach ($this->_aCache as $oItem) {
45  $sFn = $oItem->sFunc;
46  switch (count($oItem->aParams)) {
47  case 0:
48  $oPdf->$sFn();
49  break;
50  case 1:
51  $oPdf->$sFn($oItem->aParams[0]);
52  break;
53  case 2:
54  $oPdf->$sFn($oItem->aParams[0], $oItem->aParams[1]);
55  break;
56  case 3:
57  $oPdf->$sFn($oItem->aParams[0], $oItem->aParams[1], $oItem->aParams[2]);
58  break;
59  case 4:
60  $oPdf->$sFn($oItem->aParams[0], $oItem->aParams[1], $oItem->aParams[2], $oItem->aParams[3]);
61  break;
62  }
63  }
64  }
65 
74  public function line($iLPos, $iLHeight, $iRPos, $iRHeight)
75  {
76  $this->_toCache('Line', array($iLPos, $iLHeight, $iRPos, $iRHeight));
77  }
78 
86  public function text($iLPos, $iLHeight, $sString)
87  {
88  $this->_toCache('Text', array($iLPos, $iLHeight, $sString));
89  }
90 
98  public function font($sType, $sWeight, $sSize)
99  {
100  $this->_toCache('SetFont', array($sType, $sWeight, $sSize));
101  }
102 
108  public function ajustHeight($iDelta)
109  {
110  foreach ($this->_aCache as $key => $oItem) {
111  switch ($oItem->sFunc) {
112  case 'Line':
113  $this->_aCache[$key]->aParams[3] += $iDelta;
114  $this->_aCache[$key]->aParams[1] += $iDelta;
115  break;
116  case 'Text':
117  $this->_aCache[$key]->aParams[1] += $iDelta;
118  break;
119  }
120  }
121  }
122 
128  public function getFont()
129  {
130  return $this->_sFont;
131  }
132 }