/** * @param $row * @param $header * @param $content see HTMLTableEntity#__construct() * @param $father HTMLTableCell object (default NULL) * @param $item CommonDBTM object: The item associated with the current cell (default NULL) **/ function __construct($row, $header, $content, HTMLTableCell $father = NULL, CommonDBTM $item = NULL) { parent::__construct($content); $this->row = $row; $this->header = $header; $this->father = $father; if (!empty($item)) { $this->item = clone $item; } else { $this->item = NULL; } if (!is_null($this->father)) { if ($this->father->row != $this->row) { throw new HTMLTableCellSameRow(); } if ($this->father->header != $this->header->getFather()) { if ($this->father->header instanceof HTMLTableHeader && $this->header->getFather() instanceof HTMLTableHeader) { throw new HTMLTableCellFatherCoherentHeader($this->header->getFather()->getName() . ' != ' . $this->father->header->getName()); } if ($this->father->header instanceof HTMLTableHeader) { throw new HTMLTableCellFatherCoherentHeader('NULL != ' . $this->father->header->getName()); } if ($this->header->getFather() instanceof HTMLTableHeader) { throw new HTMLTableCellFatherCoherentHeader($this->header->getFather()->getName() . ' != NULL'); } throw new HTMLTableCellFatherCoherentHeader('NULL != NULL'); } $this->father->addSon($this, $header); } else { if (!is_null($this->header->getFather())) { throw new HTMLTableCellWithoutFather(); } } $this->header->checkItemType($this->item); $this->copyAttributsFrom($this->header); if (is_string($content)) { $string = trim($content); $string = str_replace(' ', '', $string); $string = str_replace('<br>', '', $string); if (!empty($string)) { $this->header->addCell(); } } else { $this->header->addCell(); } }
/** * @param $name string the name of the header * @param $content see HTMLTableEntity#__construct() * @param $father HTMLTableHeader object: * the father of the current column (default NULL) **/ function __construct($name, $content, HTMLTableHeader $father = NULL) { parent::__construct($content); $this->name = $name; $this->father = $father; }