tm, ->lm, ->rm, ->bm and ->content in a table where each content part is stored in a cell.
* The two arguments to this function defines some offsets and margins to use in the arrangement of the content in the table.
*
* @param string $offset List of offset parameters; x,y
* @param string $cMargins List of margin parameters; left, top, right, bottom
* @return string The content strings wrapped in a
as the parameters defined
* @see \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::CTABLE()
*/
public function start($offset, $cMargins)
{
$offArr = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $offset);
$cMargArr = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $cMargins);
$cols = 0;
$rows = 0;
if ($this->lm) {
$cols++;
}
if ($this->rm) {
$cols++;
}
if ($cMargArr[0]) {
$cols++;
}
if ($cMargArr[2]) {
$cols++;
}
if ($cMargArr[1] || $cMargArr[3] || $this->tm || $this->bm || $this->content || $this->contentW) {
$cols++;
}
if ($cMargArr[1]) {
$rows++;
}
if ($cMargArr[3]) {
$rows++;
}
if ($this->tm) {
$rows++;
}
if ($this->bm) {
$rows++;
}
if ($this->content) {
$rows++;
}
if ($this->contentW) {
$rows++;
}
if (!$rows && $cols) {
// If there are no rows in the middle but still som columns...
$rows = 1;
}
if ($rows && $cols) {
$res = LF . 'tableParams . '>';
// Top offset:
if ($offArr[1]) {
$xoff = $offArr[0] ? 1 : 0;
if ($cols + $xoff > 1) {
$colspan = ' colspan="' . ($cols + $xoff) . '"';
}
$res .= ' |
';
}
// The rows:
if ($rows > 1) {
$rowspan = ' rowspan="' . $rows . '"';
}
$res .= '';
if ($offArr[0]) {
$res .= ' | ';
}
if ($this->lm) {
$res .= 'lmTDparams . '>' . $this->lm . ' | ';
}
if ($cMargArr[0]) {
$res .= ' | ';
}
// Content...
$middle = array();
if ($this->tm) {
$middle[] = 'tmTDparams . '>' . $this->tm . ' | ';
}
if ($cMargArr[1]) {
$middle[] = ' | ';
}
if ($this->content) {
$middle[] = 'contentTDparams . '>' . $this->content . ' | ';
}
if ($cMargArr[3]) {
$middle[] = ' | ';
}
if ($this->bm) {
$middle[] = 'bmTDparams . '>' . $this->bm . ' | ';
}
if ($this->contentW) {
$middle[] = ' | ';
}
if (isset($middle[0])) {
$res .= $middle[0];
}
// Left of content
if ($cMargArr[2]) {
$res .= ' | ';
}
if ($this->rm) {
$res .= 'rmTDparams . '>' . $this->rm . ' | ';
}
$res .= '
';
// More than the two rows
$mCount = count($middle);
for ($a = 1; $a < $mCount; $a++) {
$res .= '' . $middle[$a] . '
';
}
$res .= '
';
return $res;
}
}
}