public function write() { parent::write(); if ($this->dataProvider === null) { throw new Exception("DataProvider is NULL"); } $this->generateTableData(); $this->writeList(); }
public function write() { parent::write(); if ($this->dataProvider == null) { throw new Exception("DataProvider is NULL"); } $this->generateTableData(); //------- init columns width --------------- $colZero = 0; $colMore = 0; for ($i = 0; $i < count($this->columns); $i++) { if ((double) $this->columns[$i]->width == 0) { $colZero++; } else { $colMore += (double) $this->columns[$i]->width; } } if ($colZero > 0 && $colMore > 0 || $colMore == 0) { $avarage = ($this->width - $colMore) / $colZero; for ($i = 0; $i < count($this->columns); $i++) { if ((double) $this->columns[$i]->width == 0) { $this->columns[$i]->width = $avarage; } } } else { if ($colZero == 0) { for ($i = 0; $i < count($this->columns); $i++) { $perc = (double) $this->columns[$i]->width / $colMore; $this->columns[$i]->width = $this->width * $perc; } } } //------- init columns width --------------- if ($this->contentPageRollover) { $this->componentPdfWriter->SetXY($this->getPageX(), $this->getPageY()); /*int*/ $rowCount = count($this->dataProviderList); /*int*/ $usedRows = 0; if ($rowCount < $this->rowsPerPage()) { $this->writeTable($rowCount); } else { while ($rowCount - $usedRows > $this->rowsPerPage()) { $usedRows = $usedRows + $this->rowsPerPage(); $this->writeTable($this->rowsPerPage()); PDFUtil::startNewPage($this->componentPdfWriter, $this->document); $this->componentPdfWriter->SetXY($this->getPageX(), $this->getPageY()); } $this->writeTable($rowCount - $usedRows); } } else { $this->componentPdfWriter->SetXY($this->getPageX(), $this->getPageY()); $this->writeTable(count($this->dataProviderList)); } }