Go to the documentation of this file.00001 <?php
00002
00006 class InvoicepdfBlock
00007 {
00008
00014 protected $_aCache = array();
00015
00021 protected $_sFont = 'Arial';
00022
00029 protected function _toCache($sFunc, $aParams)
00030 {
00031 $oItem = new stdClass();
00032 $oItem->sFunc = $sFunc;
00033 $oItem->aParams = $aParams;
00034 $this->_aCache[] = $oItem;
00035 }
00036
00042 public function run($oPdf)
00043 {
00044 foreach ($this->_aCache as $oItem) {
00045 $sFn = $oItem->sFunc;
00046 switch (count($oItem->aParams)) {
00047 case 0:
00048 $oPdf->$sFn();
00049 break;
00050 case 1:
00051 $oPdf->$sFn($oItem->aParams[0]);
00052 break;
00053 case 2:
00054 $oPdf->$sFn($oItem->aParams[0], $oItem->aParams[1]);
00055 break;
00056 case 3:
00057 $oPdf->$sFn($oItem->aParams[0], $oItem->aParams[1], $oItem->aParams[2]);
00058 break;
00059 case 4:
00060 $oPdf->$sFn($oItem->aParams[0], $oItem->aParams[1], $oItem->aParams[2], $oItem->aParams[3]);
00061 break;
00062 }
00063 }
00064 }
00065
00074 public function line($iLPos, $iLHeight, $iRPos, $iRHeight)
00075 {
00076 $this->_toCache('Line', array($iLPos, $iLHeight, $iRPos, $iRHeight));
00077 }
00078
00086 public function text($iLPos, $iLHeight, $sString)
00087 {
00088 $this->_toCache('Text', array($iLPos, $iLHeight, $sString));
00089 }
00090
00098 public function font($sType, $sWeight, $sSize)
00099 {
00100 $this->_toCache('SetFont', array($sType, $sWeight, $sSize));
00101 }
00102
00108 public function ajustHeight($iDelta)
00109 {
00110 foreach ($this->_aCache as $key => $oItem) {
00111 switch ($oItem->sFunc) {
00112 case 'Line':
00113 $this->_aCache[$key]->aParams[3] += $iDelta;
00114 $this->_aCache[$key]->aParams[1] += $iDelta;
00115 break;
00116 case 'Text':
00117 $this->_aCache[$key]->aParams[1] += $iDelta;
00118 break;
00119 }
00120 }
00121 }
00122
00128 public function getFont()
00129 {
00130 return $this->_sFont;
00131 }
00132 }