/** * @param string[] $cells * Format: $[$colName] = $content * * @return $this */ function thMultiple(array $cells) { foreach ($cells as $rowName => $content) { $this->tsection->th($rowName, $this->colName, $content); } return $this; }
function testRegularTable() { $columns = new DynamicAxis(); $columns->addNames(['c0', 'c1', 'c2']); $tsection = new TableSection($columns); $tsection->addRow('r0')->td('c0', '00')->td('c1', '01')->td('c2', '02'); $tsection->addRow('r1')->td('c0', '10')->td('c1', '11')->td('c2', '12'); # print_r($tsection->getRawMatrix($columns->takeSnapshot())); }
/** * @return string * Rendered table html. */ function render() { $colAttributes = $this->colAttributes->staticCopy(); $columns = $this->columns->takeSnapshot(); $html = ''; $html .= $this->thead->render($columns, $colAttributes); $html .= $this->tfoot->render($columns, $colAttributes); $html .= $this->renderTBody($columns, $colAttributes); foreach ($this->tbodies as $tbody) { $html .= $tbody->render($columns, $colAttributes); } return $this->renderTag('table', "\n" . $html) . "\n"; }
/** * @param string $rowName * * @return true */ function rowExists($rowName) { return $this->tbody->rowExists($rowName); }
/** * Adds a th cell with a colspan that ends where the next known cell begins. * * @param string|string[] $colName * Column name, group or range. * @param string $content * HTML cell content. * * @return $this */ public function thOpenEnd($colName, $content) { $this->tsection->thOpenEnd($this->rowName, $colName, $content); }