cObj = $cObj;
}
}
/**
* Rendering the cObject, OTABLE
*
* @param array $conf Array of TypoScript properties
* @return string Output
*/
public function render($conf = array())
{
$tableParams = isset($conf['tableParams.']) ? $this->cObj->stdWrap($conf['tableParams'], $conf['tableParams.']) : $conf['tableParams'];
if ($tableParams) {
$this->tableParams = $tableParams;
}
$offset = isset($conf['offset.']) ? $this->cObj->stdWrap($conf['offset'], $conf['offset.']) : $conf['offset'];
$content = $this->start($this->cObj->cObjGet($conf), $offset);
if (isset($conf['stdWrap.'])) {
$content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
}
return $content;
}
/**
* Wrapping the input content string in a table which will space it out from top/left/right/bottom
*
* @param string $content The HTML content string
* @param string $offset List of offset parameters; x,y,r,b,w,h
* @return string The HTML content string being wrapped in a
offsetting the content as the $offset parameters defined
*/
public function start($content, $offset)
{
$valPairs = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $offset . ',,,,,');
if ($valPairs[0] || $valPairs[1] || $valPairs[2] || $valPairs[3] || $valPairs[4] || $valPairs[5]) {
// If width is defined AND there has been no change to the default table params,
// then extend them to a tablewidth of 1
if ($valPairs[4] && $this->default_tableParams == $this->tableParams) {
$this->tableParams .= ' width="1"';
}
// Init:
$this->begin = LF . 'tableParams . '>';
$this->end = '
';
$rows = array();
$widthImg = '';
$heightImg = '';
// If width is required, set so bottom column will display for sure
if ($valPairs[4]) {
if (!$valPairs[3]) {
$valPairs[3] = 1;
}
$widthImg = '';
}
// If height is required, set so right column will display for sure
if ($valPairs[5]) {
if (!$valPairs[2]) {
$valPairs[2] = 1;
}
$valPairs[2] = 1;
$heightImg = '';
}
// First row:
// top
if ($valPairs[1]) {
$rows[1] .= '';
$rows[1] .= ' | ';
if ($valPairs[0]) {
$rows[1] .= ' | ';
}
if ($valPairs[2]) {
$rows[1] .= ' | ';
}
$rows[1] .= '
';
}
// Middle row:
$rows[2] .= '';
if ($valPairs[0]) {
$rows[2] .= $valPairs[1] ? ' | ' : ' | ';
}
$rows[2] .= 'tdParams . '>' . $content . ' | ';
if ($valPairs[2]) {
$rows[2] .= $valPairs[3] ? '' . $heightImg . ' | ' : ' | ';
}
$rows[2] .= '
';
// Bottom row:
if ($valPairs[3]) {
$rows[3] .= '';
if ($valPairs[0]) {
$rows[3] .= ' | ';
}
if ($valPairs[2]) {
$rows[3] .= '' . $widthImg . ' | ';
}
$rows[3] .= ' | ';
$rows[3] .= '
';
}
return $this->begin . implode('', $rows) . $this->end;
} else {
return $content;
}
}
}