phpDocumentor SpoolTemplate
[ Back ] [ class tree: SpoolTemplate ] [ index: SpoolTemplate ] [ all elements ]

Source for file sptpl_clsPageMgr.php

Documentation is available at sptpl_clsPageMgr.php

  1. <?php
  2. /**
  3. * sptpl_clsPageMgr.php
  4. *
  5. * Class PageManeger definition.
  6. * This class manage all the output detail, such margins, page size (and
  7. * skip to the next page) and print (to the file) each row.
  8. *
  9. * @copyright sptpl_clsPageMgr.php is part of Sptpl project {@link http://www.andrioli.com/en/sptpl.html} and it is LGPL
  10. * @author Andrioli Darvin <darvin (inside) andrioli (dot) com>
  11. * @version $Header: d:\cvs/classistd/sptpl/sptpl_clsPageMgr.php,v 2.16 2005/03/17 12:46:48 Darvin Exp $
  12. */
  13. /*
  14. * +-------------------------------------------------------------------------+
  15. * | Sptpl |
  16. * +-------------------------------------------------------------------------+
  17. * | Copyright (c) 2003-2005 Andrioli Darvin |
  18. * | Email <darvin (inside) andrioli (dot) com> |
  19. * | Web http://www.andrioli.com/en/sptpl.html |
  20. * | Download http://www.phpclasses.org/browse.html/package/1326.html |
  21. * | |
  22. * +-------------------------------------------------------------------------+
  23. * | This library is free software; you can redistribute it and/or modify |
  24. * | it under the terms of the GNU Lesser General Public License as |
  25. * | published by the Free Software Foundation; either version 2 of the |
  26. * | License, or (at your option) any later version. |
  27. * | |
  28. * | This library is distributed in the hope that it will be useful, but |
  29. * | WITHOUT ANY WARRANTY; without even the implied warranty of |
  30. * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
  31. * | Lesser General Public License for more details. |
  32. * | |
  33. * | You should have received a copy of the GNU Lesser General Public |
  34. * | License along with this library; if not, write to the Free Software |
  35. * | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
  36. * +-------------------------------------------------------------------------+
  37. */
  38.  
  39.  
  40.  
  41. class CPageMgr {
  42.  
  43. /**
  44. * Handler to the output file
  45. * @var integer
  46. */
  47. var $OutputFp;
  48. /**
  49. * Size of the page (width, length) as number
  50. * of characters and rows.
  51. * Index length = number of rows
  52. * Index width = number of characters for each row
  53. * @var array $PageSize
  54. */
  55. var $PageSize;
  56. /**
  57. * Table contains the size for the ISO code
  58. * Each index contains an array with two key length e width
  59. *
  60. * @var array
  61. */
  62. var $tblFormatIso;
  63. /**
  64. * Page format from the configuration file.
  65. * It is an ISO code
  66. * @see $tblFormatIso
  67. * @var string
  68. */
  69. var $PageFormat;
  70. /**
  71. * Margins setting.
  72. * Allowed index: top, bottom, left, right
  73. * @var array $Margins
  74. */
  75. var $Margins;
  76.  
  77. /**
  78. * Index of the current item to be inserted into $PageData
  79. * @var integer $CurrentLine
  80. * @see WriteOut()
  81. */
  82. var $CurrentLine;
  83.  
  84. /**
  85. * Index of the first line of the page
  86. * @var integer
  87. * @see WriteOut()
  88. */
  89. var $TopPageLine;
  90.  
  91. var $CurrentPage;
  92. /**
  93. * Array holding the text to print at the begin and end page.
  94. * See ParseXml for detail about the text stored
  95. * @var array
  96. * @see ParseXml()
  97. */
  98. var $Report;
  99. /**
  100. * Reference to the DataStorage class
  101. * @var object CDataStorage
  102. */
  103. var $clsDataManager;
  104. /**
  105. * Memory image of the page, each item of this array
  106. * is one row of the page. Each row is made by many columns
  107. * The columns 0 contains the whole page, the index > 0
  108. * point to the column defined by column set.
  109. * Each element is a CUnit object
  110. * The array is load by WriteOut and
  111. * written to the file by _ClosePage
  112. * @var array $PageData
  113. * @see WriteOut()
  114. * @see _ClosePage()
  115. */
  116. var $PageData;
  117. /**
  118. * Current ColumnSet
  119. * Array of CColumn object.
  120. * Each block my set its own column set.
  121. * Columns 0 is the whole page
  122. * @var array
  123. * @see NewColumnSet()
  124. */
  125. var $ColumnSet;
  126. /**
  127. * Column set used to print out the page header
  128. * @var array
  129. */
  130. var $HeaderColSet;
  131. /**
  132. * Column set used to print out the page footer
  133. * @var array
  134. */
  135. var $FooterColSet;
  136. /**
  137. * array with all columnset defined. The first index is the columnsset
  138. * identifier
  139. * @var array
  140. */
  141. var $DefinedColumnSet;
  142. /**
  143. * Id of the current columnset selected. It is uesd to avoid
  144. * to reload the same columnset if it is selected again
  145. * @var string
  146. * @see NewColumnSet()
  147. */
  148. var $CurrentColumnSetId;
  149. /**
  150. * Max height for each row.
  151. * @var array
  152. */
  153. var $LineHeight;
  154. /**
  155. * Array containing all defined class CFont
  156. * @var array $Fonts
  157. */
  158. var $Fonts;
  159. /**
  160. * Class constructor. It initalize all configuration varaibale
  161. * @param object CDataStorage &$DataMgr Reference to the DataStorage istance
  162. * @access public
  163. */
  164. function CPageMgr(&$DataMgr)
  165. {
  166. // set the default margins and page size.
  167. $this->tblFormatIso=array();
  168. $this->PageSize=array( 'width' => 80,
  169. 'length' => 66 );
  170. $this->Margins=array('top' =>2,
  171. 'bottom' =>2,
  172. 'left' =>2,
  173. 'right' =>2);
  174. $this->Report=array();
  175. $this->clsDataManager=&$DataMgr;
  176. $this->PageData=array();
  177. $this->Fonts=array();
  178. $this->_CreateDefaultFont();
  179. $this->ColumnSet=array();
  180. $this->ColumnSet[0]=new CColumn();
  181. $this->HeaderColSet[0]=new CColumn();
  182. $this->FooterColSet[0]=new CColumn();
  183. $this->CurrentFont='STANDARD';
  184. $this->ColumnSet[0]->setDefaultFont($this->Fonts['STANDARD']);
  185. $this->HeaderColSet[0]->setDefaultFont($this->Fonts['STANDARD']);
  186. $this->FooterColSet[0]->setDefaultFont($this->Fonts['STANDARD']);
  187. $this->LastWrittenLine=0;
  188. $this->TopPageLine=1;
  189. $this->LineHeight=array();
  190. $this->CurrentColumnSet=-1; // No default columnset
  191. $this->DefinedColumnSet=array();
  192. }
  193. /**
  194. * Parse the configuration node for a new information about the layout
  195. * of the page
  196. * @param object CXml2Array Class containingg the configuration
  197. * @access public
  198. */
  199. function ParseXml($cfg)
  200. {
  201.  
  202. switch(strtolower($cfg->GetNodeName())) {
  203. case 'columnset':
  204. $this->_SetColumnSet($cfg);
  205. break;
  206. case 'margin' :
  207. $this->_SetMargins($cfg);
  208. break;
  209. case 'pagesize' :
  210. $this->_SetPageSize($cfg);
  211. break;
  212. case 'beginreport' :
  213. $this->Report['beginreport']=new CRow($this->clsDataManager,$cfg);
  214. break;
  215. case 'closereport' :
  216. $this->Report['closereport']=new CRow($this->clsDataManager,$cfg);
  217. break;
  218. case 'openpage' :
  219. $this->Report['openpage']=new CRowHeader($this->clsDataManager,$cfg);
  220. break;
  221. case 'closepage' :
  222. $this->Report['closepage']=new CRowFooter($this->clsDataManager,$cfg);
  223. break;
  224.  
  225. }
  226. }
  227.  
  228. /**
  229. * Create one default font named STANDARD
  230. * @access private
  231. */
  232. function _CreateDefaultFont()
  233. {
  234. $q="?"; // It makes happy my editor!!
  235. $XmlStr="<".$q."xml version='1.0' ".$q.">
  236. <font id='STANDARD' size='1' />
  237. ";
  238. $tmpRoot=new CXml2Array();
  239. $tmpRoot->LoadFromString($XmlStr);
  240. $this->NewFont($tmpRoot);
  241.  
  242. }
  243. /**
  244. * Create an istance of the CFont class based on configuration
  245. * file.
  246. * @param object CXml2Array Node with font configuration
  247. * @access public
  248. */
  249. function NewFont($node)
  250. {
  251. $tmpFont=new CFont($node);
  252. if(array_key_exists($tmpFont->GetId(),$this->Fonts))
  253. trigger_error('Font '.$tmpFont->GetId().' already exist',E_USER_ERROR);
  254. $this->Fonts[$tmpFont->GetId()]=$tmpFont;
  255. }
  256.  
  257. /**
  258. * Load columnset settings from the configuration file
  259. * Default values are set by the class constructor.
  260. * @param object CXml2Array
  261. * @access private
  262. *
  263. */
  264. function _SetColumnSet($Cfg)
  265. {
  266. $ColumNo=0;
  267. // Check some attribute
  268. while(($ret=$Cfg->EachAttribute())!=FALSE)
  269. {
  270. list($AttribName,$value)=$ret;
  271. switch(strtolower($AttribName))
  272. {
  273. case 'id' :
  274. $Id=$value;
  275. break;
  276. }
  277. }
  278. if($Id=='')
  279. trigger_error('Configuration error: columnset without attribute id',E_USER_ERROR);
  280. while(($ret=$Cfg->EachChild())!=FALSE)
  281. {
  282. list($ChildName,$Child)=$ret;
  283. switch(strtolower($ChildName)) {
  284. case 'column' :
  285. $this->DefinedColumnSet[$Id][$ColumNo]=new CColumn();
  286. $this->DefinedColumnSet[$Id][$ColumNo]->setDefaultFont($this->Fonts['STANDARD']);
  287. $this->DefinedColumnSet[$Id][$ColumNo]->Parse($Child);
  288. $ColumNo++;
  289. break;
  290. default:
  291. trigger_error('Unknown tag '.$Child->GetNodeName(),E_USER_ERROR);
  292. break;
  293. }
  294. }
  295. }
  296.  
  297. /**
  298. * Load margins setting from the configuration file
  299. * Default values are set by the class constructor.
  300. * @param object CXml2Array
  301. * @access private
  302. *
  303. */
  304. function _SetMargins($Cfg)
  305. {
  306.  
  307. while(($ret=$Cfg->EachChild())!=FALSE)
  308. {
  309. list($ChildName,$Child)=$ret;
  310. switch(strtolower($ChildName)) {
  311. case 'top' :
  312. $value=trim($Child->GetText());
  313. if(!ctype_digit($value))
  314. trigger_error('Tag '.$Child->GetNodeName(). ', numeric value expected',E_USER_ERROR);
  315. $this->Margins['top']=$value;
  316. break;
  317. case 'bottom' :
  318. $value=trim($Child->GetText());
  319. if(!ctype_digit($value))
  320. trigger_error('Tag '.$Child->GetNodeName(). ', numeric value expected',E_USER_ERROR);
  321. $this->Margins['bottom']=$value;
  322. break;
  323. case 'left' :
  324. $value=trim($Child->GetText());
  325. if(!ctype_digit($value))
  326. trigger_error('Tag '.$Child->GetNodeName(). ', numeric value expected',E_USER_ERROR);
  327. $this->Margins['left']=$value;
  328. break;
  329. case 'right' :
  330. $value=trim($Child->GetText());
  331. if(!ctype_digit($value))
  332. trigger_error('Tag '.$Child->GetNodeName(). ', numeric value expected',E_USER_ERROR);
  333. $this->Margins['right']=$value;
  334. break;
  335. default:
  336. trigger_error('Unknown tag '.$Child->GetNodeName(),E_USER_ERROR);
  337. break;
  338. }
  339. }
  340. }
  341. /**
  342. * Load the size of the page from the configuration file.
  343. * Default values are set by the class constructor.
  344. * @param object CXml2Array $Cfg
  345. * @access private
  346. *
  347. */
  348. function _SetPageSize($Cfg)
  349. {
  350. while(($ret=$Cfg->EachChild())!=FALSE)
  351. {
  352. list($ChildName,$Child)=$ret;
  353. switch(strtolower($ChildName)) {
  354. case 'length' :
  355. $value=trim($Child->GetText());
  356. if(!ctype_digit($value))
  357. trigger_error('Tag '.$Child->GetNodeName(). ', numeric value expected',E_USER_ERROR);
  358. $this->PageSize['length']=$value;
  359. break;
  360. case 'width' :
  361. $value=trim($Child->GetText());
  362. if(!ctype_digit($value))
  363. trigger_error('Tag '.$Child->GetNodeName(). ', numeric value expected',E_USER_ERROR);
  364. $this->PageSize['width']=$value;
  365. break;
  366. case 'pageformat' :
  367. $value=trim($Child->GetText());
  368. if(!array_key_exists($value,$this->tblFormatIso))
  369. trigger_error('Tag '.$Child->GetNodeName(). ', format unknown',E_USER_ERROR);
  370. $this->PageFormat=$value;
  371. break;
  372. default:
  373. trigger_error('Unknown tag '.$Child->GetNodeName(),E_USER_ERROR);
  374. break;
  375. }
  376. }
  377. }
  378.  
  379. /**
  380. * Check whether the margins are placed inside or outside the page
  381. * @access private
  382. */
  383. function CheckMargins()
  384. {
  385. if(($this->Margins['top']+$this->Margins['bottom'])>$this->PageSize['length'])
  386. trigger_error('The top or bottom margin are bigger then the size of the page',E_USER_ERROR);
  387. if(($this->Margins['left']+$this->Margins['right'])>$this->PageSize['width'])
  388. trigger_error('The left or right margin are bigger then the size of the page',E_USER_ERROR);
  389. }
  390.  
  391. /**
  392. * Function executed at the end of the xml parsing. I run the final configuration
  393. * checks and complete the configration data
  394. * @access public
  395. */
  396. function EndParseXml()
  397. {
  398. $this->CheckMargins();
  399. $this->ColumnSet[0]->SetWidth($this->PageSize['width']-$this->Margins['left']-$this->Margins['right']); // page with
  400. $this->ColumnSet[0]->SetLeftPos($this->Margins['left']); // starting point of the column 0
  401. //$GLOBALS['dbg']->pray($this->DefinedColumnSet);
  402. // die();
  403. foreach($this->DefinedColumnSet as $colSet)
  404. {
  405. $nCol=count($colSet);
  406. for($i=0;$i<$nCol;$i++)
  407. $colSet[$i]->EndParseXml();
  408. }
  409. // As header/footer column set I use the default with only one column
  410. $this->HeaderColSet[0]->SetWidth($this->PageSize['width']-$this->Margins['left']-$this->Margins['right']); // page with
  411. $this->HeaderColSet[0]->SetLeftPos($this->Margins['left']); // starting point of the column 0
  412. $this->FooterColSet[0]->SetWidth($this->PageSize['width']-$this->Margins['left']-$this->Margins['right']); // page with
  413. $this->FooterColSet[0]->SetLeftPos($this->Margins['left']); // starting point of the column 0
  414.  
  415. }
  416.  
  417. /**
  418. * Set new columnset. Each block may hve its own columnset. Before write the text, the
  419. * block passes its configuration. This configuration override the previous one,
  420. * so I must write the previous text
  421. * @param string id of the new columnset to use
  422. * @access public
  423. */
  424. function NewColumnSet($NewSet)
  425. {
  426. // close the previous
  427. $this->_ComposeRow($this->ColumnSet);
  428. // if I already use this set I don't change anything
  429. if($NewSet==$this->CurrentColumnSetId)
  430. return(TRUE);
  431. if(!array_key_exists($NewSet,$this->DefinedColumnSet))
  432. trigger_error('The columnset id '.$NewSet.' doesn\'t exists',E_USER_ERROR); // '
  433. $size=count($this->DefinedColumnSet[$NewSet]);
  434. for($i=0;$i<$size;$i++)
  435. {
  436. $this->ColumnSet[$i+1]=$this->DefinedColumnSet[$NewSet][$i];
  437. }
  438. $this->CurrentColumnSetId=$NewSet;
  439. }
  440. /**
  441. * Start to printout the report. OPen the output file,
  442. * initialize some variable.
  443. * @parameter string $OutFile output file name
  444. * @access public
  445. */
  446. function BeginReport($OutFile)
  447. {
  448. $this->OutputFp=fopen($OutFile,'wb');
  449. $this->CurrentPage=0;
  450. $this->_OpenPage();
  451. $this->_StartReport();
  452. }
  453.  
  454. /**
  455. * Perform the requested job for ending the report.
  456. * Print the end report text, close the current page and the output file
  457. * @access public
  458. */
  459. function CloseReport()
  460. {
  461. $this->_EndReport();
  462. $this->_ComposeRow($this->ColumnSet);
  463. $this->CurrentLine=$this->PageSize['length']-$this->Margins['bottom'];
  464. $this->_ClosePage();
  465. fclose($this->OutputFp);
  466. }
  467.  
  468. /**
  469. * Print out the 'beginreport' text
  470. * @access public
  471. */
  472. function _StartReport()
  473. {
  474. if(array_key_exists('beginreport',$this->Report))
  475. $this->Report['beginreport']->WriteOut($this);
  476. }
  477.  
  478. /**
  479. * Print out the 'closereport' text
  480. * @access public
  481. */
  482. function _EndReport()
  483. {
  484. if(array_key_exists('closereport',$this->Report))
  485. $this->Report['closereport']->WriteOut($this);
  486. }
  487.  
  488. /**
  489. * Begin a new page. Close the previous, if any,
  490. * and printout the 'openpage' text if specified
  491. *
  492. * @access public
  493. */
  494. function NewPage($FromComposeRow=FALSE)
  495. {
  496. // If this function is not called from composerow, but as page skip
  497. // in the middle of the page, before change the page, I close the
  498. // current text
  499. if(!$FromComposeRow)
  500. $this->_ComposeRow($this->ColumnSet);
  501. if($this->CurrentPage)
  502. {
  503. $this->CurrentLine=$this->PageSize['length']-$this->Margins['bottom'];
  504. $this->_ClosePage();
  505. fputs($this->OutputFp,NEWPAGECHAR);
  506. }
  507. // print "<br>".$this->CurrentPage;
  508. $this->_OpenPage();
  509. }
  510.  
  511. /**
  512. * Start the new page
  513. * @access private
  514. */
  515. function _OpenPage()
  516. {
  517. $this->PageData=array_fill(1,$this->PageSize['length'],"\r\n");
  518. $this->CurrentPage++;
  519. $this->clsDataManager->SetVar('PageNumber',$this->CurrentPage);
  520. // The open should printed on the first row
  521. $this->CurrentLine=1;
  522. if(array_key_exists('openpage',$this->Report))
  523. {
  524. $this->Report['openpage']->WriteOut($this);
  525. }
  526. $this->CurrentLine=$this->Margins['top']+1;
  527. }
  528.  
  529. /**
  530. * Printout the closepage text (if any)
  531. * @access private
  532. */
  533. function _ClosePage()
  534. {
  535. if(array_key_exists('closepage',$this->Report))
  536. {
  537. $this->Report['closepage']->WriteOut($this);
  538. }
  539. // Now I may download the page to the file
  540. for($c=1;$c<($this->PageSize['length']+1);$c++)
  541. fputs($this->OutputFp,$this->PageData[$c]);
  542. }
  543.  
  544. /**
  545. * Now each column has its own text for the current row. This function
  546. * merge all texts from the columns and fill the PageData array.
  547. * Note a column may span over one or more row
  548. * @param array column set to print
  549. * @param bool the row to print is the footer? If so don't skip to the new page
  550. * @return bool return true if the function writes almost 1 row
  551. * @access private
  552. */
  553. function _ComposeRow($ColSet,$PageFooter=FALSE)
  554. {
  555. $nColumn=count($ColSet);
  556. $RowWritten=FALSE;
  557. /*
  558. if($PageFooter) {
  559. $GLOBALS['dbg']->pray($this);
  560. $GLOBALS['dbg']->Backtrace();
  561. die('prova');
  562. }
  563. */
  564. // $GLOBALS['dbg']->pray($ColSet);
  565. do
  566. {
  567. $Text='';
  568. $OneColumnWithText=FALSE;
  569. for($i=0;$i<$nColumn;$i++)
  570. {
  571. // I've got one columns, check where it starts
  572. assert('is_object($ColSet[$i])');
  573. if($ColSet[$i]->HasAnotherText())
  574. {
  575. $LeftPos=$ColSet[$i]->GetLeftTextPos();
  576. $Diff=$LeftPos-strlen($Text);
  577. if($Diff>0)
  578. $Text.=str_repeat(' ',$Diff);
  579. // Text too long, cut it!
  580. if($Diff<0)
  581. $Text=substr($Text,0,$LeftPos-1);
  582. $Text.=$ColSet[$i]->GetText();
  583. $OneColumnWithText=TRUE;
  584. }
  585. }
  586. if($OneColumnWithText)
  587. {
  588. $RowWritten=TRUE;
  589. if($this->CurrentLine>($this->PageSize['length']-$this->Margins['bottom'])&&!$PageFooter)
  590. {
  591. // echo $this->PageSize['length']."-".$this->Margins['bottom']."-".$this->CurrentLine;
  592. $this->NewPage(TRUE);
  593. }
  594. $this->PageData[$this->CurrentLine]=$Text."\r\n";
  595. $this->CurrentLine++;
  596. }
  597. } while($OneColumnWithText);
  598. // Clear all used text
  599. for($i=0;$i<$nColumn;$i++)
  600. $ColSet[$i]->ClearText();
  601. return($RowWritten);
  602. }
  603.  
  604. /**
  605. * Pass the text to the appropriate column. It returns a CUnit object containing
  606. * the text with format (alignment, font) according to the given parameters
  607. * @parameter string $txt Text to write
  608. * @parameter string $align Text alignment, left, center, right
  609. * @parameter integer $colPos
  610. * @parameter integer $Column column where place the text
  611. * @parameter string Id of the selected font. If not set, the font defined for the column will be used
  612. * @access public
  613. */
  614. function WriteOut($txt,$align='',$colPos=0,$Column=0,$idfont='')
  615. {
  616. if(!array_key_exists($Column,$this->ColumnSet))
  617. trigger_error('Error: the request column '.$Column.' does not exists. Text to print:'.$txt,E_USER_ERROR);
  618. if($this->ColumnSet[$Column]->AlreadyHaveText()||$Column==0)
  619. {
  620. // If I've already set the text for that column in the current line, skip to next
  621. // Before skip to the new row, I merge the texts from the columns into
  622. // many row (each column may span over one or more rows)
  623. $this->_ComposeRow($this->ColumnSet);
  624. }
  625. if(!array_key_exists($idfont,$this->Fonts)&&$idfont!='')
  626. trigger_error('Undefined font '.$idfont,E_USER_ERROR);
  627. $font=($idfont=='')?NULL:$this->Fonts[$idfont];
  628. $this->ColumnSet[$Column]->WriteOut($txt,$align,$colPos,$font);
  629. }
  630.  
  631. /**
  632. * Print out the text row (used only for the closepage row)
  633. * @parameter string $txt Text to write
  634. * @parameter string $align Text alignment, left, center, right
  635. * @parameter integer $colPos
  636. * @access public
  637. */
  638. function WriteOutFooterRow($txt,$align='',$colPos=0,$idfont='')
  639. {
  640. $font=($idfont=='')?NULL:$this->Fonts[$idfont];
  641. $this->FooterColSet[0]->WriteOut($txt,$align,$colPos,$font);
  642. // $GLOBALS['dbg']->pray($this->ColumnSet);
  643. $this->_ComposeRow($this->FooterColSet,TRUE);
  644. }
  645.  
  646. /**
  647. * Print out the text row (used only for the closepage row)
  648. * @parameter string $txt Text to write
  649. * @parameter string $align Text alignment, left, center, right
  650. * @parameter integer $colPos
  651. * @access public
  652. */
  653. function WriteOutHeaderRow($txt,$align='',$colPos=0,$idfont='')
  654. {
  655. $font=($idfont=='')?NULL:$this->Fonts[$idfont];
  656. $this->HeaderColSet[0]->WriteOut($txt,$align,$colPos,$font);
  657. // $GLOBALS['dbg']->pray($this->ColumnSet);
  658. // $GLOBALS['dbg']->pray($this->HeaderColSet);
  659. // print_r($this->CurrentLine);
  660. // $GLOBALS['dbg']->BackTrace();
  661. $this->_ComposeRow($this->HeaderColSet,TRUE);
  662. }
  663.  
  664. /**
  665. * loop over all columns inside the current columnset and print
  666. * the column's header, if set
  667. *
  668. * @access public
  669. */
  670. function PrintColumnsHeader()
  671. {
  672.  
  673. }
  674.  
  675. /**
  676. * Move the currentline up or down of nRow rows. It return TRUE on success,
  677. * FALSE otherwise
  678. * @parameter integer $nRow Number of row to add (or subtract) from the
  679. * current line
  680. * @access public
  681. * @return boolean
  682. */
  683. function MvRelativePos($nRow)
  684. {
  685. if($nRow<0&&abs($nRow)>$this->CurrentLine)
  686. return(FALSE);
  687. elseif($nRow+$this->CurrentLine>$this->PageSize['length'])
  688. {
  689. $this->_ComposeRow($this->ColumnSet);
  690. $this->NewPage();
  691. return(TRUE);
  692. }
  693. $this->_ComposeRow($this->ColumnSet);
  694. $this->CurrentLine+=$nRow;
  695. return(TRUE);
  696. }
  697.  
  698.  
  699. /**
  700. * Move the currentline to nRow. It return TRUE on success,
  701. * FALSE otherwise
  702. * @parameter integer $nRow New current line number
  703. * @access public
  704. * @return boolean
  705. */
  706. function MvAbsolutePos($nRow)
  707. {
  708. if($nRow<1||$nRow>$this->PageSize['length'])
  709. return(FALSE);
  710. $this->_ComposeRow($this->ColumnSet);
  711. $this->CurrentLine=$nRow;
  712. return(TRUE);
  713. }
  714.  
  715. /**
  716. * Move to the first row after the top margin It return TRUE on success,
  717. * FALSE otherwise
  718. * @access public
  719. * @return boolean
  720. */
  721. function MvTop()
  722. {
  723. $this->_ComposeRow($this->ColumnSet);
  724. $this->CurrentLine=$this->Margins['top']+1;
  725. return(TRUE);
  726. }
  727.  
  728. /**
  729. * Move to the last row before the bottom margin It return TRUE on success,
  730. * FALSE otherwise
  731. * @access public
  732. * @return boolean
  733. */
  734. function MvBottom()
  735. {
  736. $this->_ComposeRow($this->Columnset);
  737. $this->CurrentLine=$this->PageSize['length']-$this->Margins['bottom'];
  738. return(TRUE);
  739. }
  740.  
  741. /**
  742. * Return True if the current PHP version is 5
  743. * False if is PHP4
  744. * @return boolean
  745. * @access public
  746. */
  747. function __php5()
  748. {
  749. return((version_compare(phpversion(), "5.0.0", "<")==-1)?false:true);
  750. }
  751. }
  752. ?>

Documentation generated on Mon, 28 Mar 2005 15:13:17 +0200 by phpDocumentor 1.3.0RC3