. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; /** * Class ReportHtmlCell */ class ReportHtmlCell extends ReportBaseCell { /** * HTML Cell renderer * * @param ReportHtml $renderer * * @return void */ public function render($renderer) { if (strpos($this->text, '{{:ptp:}}') !== false) { return; } $temptext = str_replace('#PAGENUM#', $renderer->pageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace([ '«', '»', ], [ '', '', ], $temptext); // Setup the style name if ($renderer->getCurrentStyle() != $this->styleName) { $renderer->setCurrentStyle($this->styleName); } // If (Future-feature-enable/disable cell padding) $cP = $renderer->cPadding; // Adjust the positions if ($this->left == '.') { $this->left = $renderer->getX(); } else { $renderer->setX($this->left); } if ($this->top == '.') { $this->top = $renderer->getY(); } else { $renderer->setY($this->top); } // Start collecting the HTML code echo '
'; // Print URL if (!empty($this->url)) { echo ''; } // Print any text if exists if (!empty($temptext)) { $renderer->write($temptext, $this->tcolor, false); } if (!empty($this->url)) { echo ''; } // Finish the cell printing and start to clean up echo "
\n"; // Where to place the next position if ($this->newline == 0) { // -> Next to this cell in the same line $renderer->setXy($this->left + $this->width, $this->top); $renderer->lastCellHeight = $this->height; } elseif ($this->newline == 1) { // -> On a new line at the margin - Default $renderer->setXy(0, $renderer->getY() + $this->height + ($cP * 2)); // Reset the last cell height for the next line $renderer->lastCellHeight = 0; } elseif ($this->newline == 2) { // -> On a new line at the end of this cell $renderer->setXy($renderer->getX() + $this->width, $renderer->getY() + $this->height + ($cP * 2)); // Reset the last cell height for the next line $renderer->lastCellHeight = 0; } } }