TYPO3 CMS  TYPO3_6-2
ColumnsContentObject.php
Go to the documentation of this file.
1 <?php
3 
23 
30  public function render($conf = array()) {
31  if (empty($conf) || !empty($conf['if.']) && !$this->cObj->checkIf($conf['if.'])) {
32  return '';
33  }
34 
35  $content = '';
36 
37  $tdRowCount = 0;
38  $tableParams = isset($conf['tableParams.']) ? $this->cObj->stdWrap($conf['tableParams'], $conf['tableParams.']) : $conf['tableParams'];
39  $tableParams = $tableParams ? ' ' . $tableParams : ' border="0" cellspacing="0" cellpadding="0"';
40  $TDparams = isset($conf['TDParams.']) ? $this->cObj->stdWrap($conf['TDParams'], $conf['TDParams.']) : $conf['TDParams'];
41  $TDparams = $TDparams ? ' ' . $TDparams : ' valign="top"';
42  $rows = isset($conf['rows.']) ? $this->cObj->stdWrap($conf['rows'], $conf['rows.']) : $conf['rows'];
44  $totalWidth = isset($conf['totalWidth.']) ? (int)$this->cObj->stdWrap($conf['totalWidth'], $conf['totalWidth.']) : (int)$conf['totalWidth'];
45  $totalGapWidth = 0;
46  $gapData = array(
47  'gapWidth' => isset($conf['gapWidth.']) ? $this->cObj->stdWrap($conf['gapWidth'], $conf['gapWidth.']) : $conf['gapWidth'],
48  'gapBgCol' => isset($conf['gapBgCol.']) ? $this->cObj->stdWrap($conf['gapBgCol'], $conf['gapBgCol.']) : $conf['gapBgCol'],
49  'gapLineThickness' => isset($conf['gapLineThickness.']) ? $this->cObj->stdWrap($conf['gapLineThickness'], $conf['gapLineThickness.']) : $conf['gapLineThickness'],
50  'gapLineCol' => isset($conf['gapLineCol.']) ? $this->cObj->stdWrap($conf['gapLineCol'], $conf['gapLineCol.']) : $conf['gapLineCol']
51  );
52  $gapData = $GLOBALS['TSFE']->tmpl->splitConfArray($gapData, $rows - 1);
53  foreach ($gapData as $val) {
54  $totalGapWidth += (int)$val['gapWidth'];
55  }
56  if ($totalWidth) {
57  $columnWidth = ceil(($totalWidth - $totalGapWidth) / $rows);
58  $TDparams .= ' width="' . $columnWidth . '"';
59  $tableParams .= ' width="' . $totalWidth . '"';
60  } else {
61  $TDparams .= ' width="' . floor(100 / $rows) . '%"';
62  $tableParams .= ' width="100%"';
63  }
64  for ($a = 1; $a <= $rows; $a++) {
65  $tdRowCount++;
66  $content .= '<td' . $TDparams . '>';
67  $content .= $this->cObj->cObjGetSingle($conf[$a], $conf[$a . '.'], $a);
68  $content .= '</td>';
69  if ($a < $rows) {
70  $gapConf = $gapData[$a - 1];
71  $gapWidth = (int)$gapConf['gapWidth'];
72  if ($gapWidth) {
73  $tdPar = $gapConf['gapBgCol'] ? ' bgcolor="' . $gapConf['gapBgCol'] . '"' : '';
74  $gapLine = (int)$gapConf['gapLineThickness'];
75  if ($gapLine) {
76  $gapSurround = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(($gapWidth - $gapLine) / 2, 1, 1000);
77  // right gap
78  $content .= '<td' . $tdPar . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . $gapSurround . '" height="1" alt="" title="" /></td>';
79  $tdRowCount++;
80  // line:
81  $GtdPar = $gapConf['gapLineCol'] ? ' bgcolor="' . $gapConf['gapLineCol'] . '"' : ' bgcolor="black"';
82  $content .= '<td' . $GtdPar . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . $gapLine . '" height="1" alt="" title="" /></td>';
83  $tdRowCount++;
84  // left gap
85  $content .= '<td' . $tdPar . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . $gapSurround . '" height="1" alt="" title="" /></td>';
86  $tdRowCount++;
87  } else {
88  $content .= '<td' . $tdPar . '><img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width="' . $gapWidth . '" height="1" alt="" title="" /></td>';
89  $tdRowCount++;
90  }
91  }
92  }
93  }
94  $content = '<tr>' . $content . '</tr>';
95  $content = '<table' . $tableParams . '>' . $content . '</table>';
96  if ($conf['after'] || isset($conf['after.'])) {
97  $content .= $this->cObj->cObjGetSingle($conf['after'], $conf['after.'], 'after');
98  }
99  if (isset($conf['stdWrap.'])) {
100  $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
101  }
102  return $content;
103  }
104 
105 }
static forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
Definition: MathUtility.php:32
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]