Code Duplication    Length = 78-78 lines in 3 locations

typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php 1 location

@@ 246-323 (lines=78) @@
243
     * @return string HTML content for the table row
244
     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10
245
     */
246
    public function addElement($h, $icon, $data, $rowParams = '', $_ = '', $_2 = '', $colType = 'td')
247
    {
248
        $colType = ($colType === 'th') ? 'th' : 'td';
249
        $noWrap = $this->no_noWrap ? '' : ' nowrap';
250
        // Start up:
251
        $l10nParent = isset($data['_l10nparent_']) ? (int)$data['_l10nparent_'] : 0;
252
        $out = '
253
		<!-- Element, begin: -->
254
		<tr ' . $rowParams . ' data-uid="' . (int)$data['uid'] . '" data-l10nparent="' . $l10nParent . '">';
255
        // Show icon and lines
256
        if ($this->showIcon) {
257
            $out .= '
258
			<' . $colType . ' class="col-icon nowrap">';
259
            if (!$h) {
260
                $out .= '&nbsp;';
261
            } else {
262
                for ($a = 0; $a < $h; $a++) {
263
                    if (!$a) {
264
                        if ($icon) {
265
                            $out .= $icon;
266
                        }
267
                    }
268
                }
269
            }
270
            $out .= '</' . $colType . '>
271
			';
272
        }
273
        // Init rendering.
274
        $colsp = '';
275
        $lastKey = '';
276
        $c = 0;
277
        $ccount = 0;
278
        // __label is used as the label key to circumvent problems with uid used as label (see #67756)
279
        // as it was introduced later on, check if it really exists before using it
280
        $fields = $this->fieldArray;
281
        if ($colType === 'td' && array_key_exists('__label', $data)) {
282
            $fields[0] = '__label';
283
        }
284
        // Traverse field array which contains the data to present:
285
        foreach ($fields as $vKey) {
286
            if (isset($data[$vKey])) {
287
                if ($lastKey) {
288
                    $cssClass = $this->addElement_tdCssClass[$lastKey];
289
                    if ($this->oddColumnsCssClass && $ccount % 2 == 0) {
290
                        $cssClass = implode(' ', [$this->addElement_tdCssClass[$lastKey], $this->oddColumnsCssClass]);
291
                    }
292
                    $out .= '
293
						<' . $colType . ' class="' . $cssClass . $noWrap . '"' . $colsp . $this->addElement_tdParams[$lastKey] . '>' . $data[$lastKey] . '</' . $colType . '>';
294
                }
295
                $lastKey = $vKey;
296
                $c = 1;
297
                $ccount++;
298
            } else {
299
                if (!$lastKey) {
300
                    $lastKey = $vKey;
301
                }
302
                $c++;
303
            }
304
            if ($c > 1) {
305
                $colsp = ' colspan="' . $c . '"';
306
            } else {
307
                $colsp = '';
308
            }
309
        }
310
        if ($lastKey) {
311
            $cssClass = $this->addElement_tdCssClass[$lastKey];
312
            if ($this->oddColumnsCssClass) {
313
                $cssClass = implode(' ', [$this->addElement_tdCssClass[$lastKey], $this->oddColumnsCssClass]);
314
            }
315
            $out .= '
316
				<' . $colType . ' class="' . $cssClass . $noWrap . '"' . $colsp . $this->addElement_tdParams[$lastKey] . '>' . $data[$lastKey] . '</' . $colType . '>';
317
        }
318
        // End row
319
        $out .= '
320
		</tr>';
321
        // Return row.
322
        return $out;
323
    }
324
325
    /**
326
     * Dummy function, used to write the top of a table listing.

typo3/sysext/backend/Classes/View/PageLayoutView.php 1 location

@@ 4093-4170 (lines=78) @@
4090
     *
4091
     * @return string HTML content for the table row
4092
     */
4093
    public function addElement($h, $icon, $data, $rowParams = '', $_ = '', $_2 = '', $colType = 'td')
4094
    {
4095
        $colType = ($colType === 'th') ? 'th' : 'td';
4096
        $noWrap = $this->no_noWrap ? '' : ' nowrap';
4097
        // Start up:
4098
        $l10nParent = isset($data['_l10nparent_']) ? (int)$data['_l10nparent_'] : 0;
4099
        $out = '
4100
		<!-- Element, begin: -->
4101
		<tr ' . $rowParams . ' data-uid="' . (int)$data['uid'] . '" data-l10nparent="' . $l10nParent . '">';
4102
        // Show icon and lines
4103
        if ($this->showIcon) {
4104
            $out .= '
4105
			<' . $colType . ' class="col-icon nowrap">';
4106
            if (!$h) {
4107
                $out .= '&nbsp;';
4108
            } else {
4109
                for ($a = 0; $a < $h; $a++) {
4110
                    if (!$a) {
4111
                        if ($icon) {
4112
                            $out .= $icon;
4113
                        }
4114
                    }
4115
                }
4116
            }
4117
            $out .= '</' . $colType . '>
4118
			';
4119
        }
4120
        // Init rendering.
4121
        $colsp = '';
4122
        $lastKey = '';
4123
        $c = 0;
4124
        $ccount = 0;
4125
        // __label is used as the label key to circumvent problems with uid used as label (see #67756)
4126
        // as it was introduced later on, check if it really exists before using it
4127
        $fields = $this->fieldArray;
4128
        if ($colType === 'td' && array_key_exists('__label', $data)) {
4129
            $fields[0] = '__label';
4130
        }
4131
        // Traverse field array which contains the data to present:
4132
        foreach ($fields as $vKey) {
4133
            if (isset($data[$vKey])) {
4134
                if ($lastKey) {
4135
                    $cssClass = $this->addElement_tdCssClass[$lastKey];
4136
                    if ($this->oddColumnsCssClass && $ccount % 2 == 0) {
4137
                        $cssClass = implode(' ', [$this->addElement_tdCssClass[$lastKey], $this->oddColumnsCssClass]);
4138
                    }
4139
                    $out .= '
4140
						<' . $colType . ' class="' . $cssClass . $noWrap . '"' . $colsp . $this->addElement_tdParams[$lastKey] . '>' . $data[$lastKey] . '</' . $colType . '>';
4141
                }
4142
                $lastKey = $vKey;
4143
                $c = 1;
4144
                $ccount++;
4145
            } else {
4146
                if (!$lastKey) {
4147
                    $lastKey = $vKey;
4148
                }
4149
                $c++;
4150
            }
4151
            if ($c > 1) {
4152
                $colsp = ' colspan="' . $c . '"';
4153
            } else {
4154
                $colsp = '';
4155
            }
4156
        }
4157
        if ($lastKey) {
4158
            $cssClass = $this->addElement_tdCssClass[$lastKey];
4159
            if ($this->oddColumnsCssClass) {
4160
                $cssClass = implode(' ', [$this->addElement_tdCssClass[$lastKey], $this->oddColumnsCssClass]);
4161
            }
4162
            $out .= '
4163
				<' . $colType . ' class="' . $cssClass . $noWrap . '"' . $colsp . $this->addElement_tdParams[$lastKey] . '>' . $data[$lastKey] . '</' . $colType . '>';
4164
        }
4165
        // End row
4166
        $out .= '
4167
		</tr>';
4168
        // Return row.
4169
        return $out;
4170
    }
4171
4172
    /**
4173
     * Dummy function, used to write the top of a table listing.

typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php 1 location

@@ 3961-4038 (lines=78) @@
3958
     *
3959
     * @return string HTML content for the table row
3960
     */
3961
    public function addElement($h, $icon, $data, $rowParams = '', $_ = '', $_2 = '', $colType = 'td')
3962
    {
3963
        $colType = ($colType === 'th') ? 'th' : 'td';
3964
        $noWrap = $this->no_noWrap ? '' : ' nowrap';
3965
        // Start up:
3966
        $l10nParent = isset($data['_l10nparent_']) ? (int)$data['_l10nparent_'] : 0;
3967
        $out = '
3968
		<!-- Element, begin: -->
3969
		<tr ' . $rowParams . ' data-uid="' . (int)$data['uid'] . '" data-l10nparent="' . $l10nParent . '">';
3970
        // Show icon and lines
3971
        if ($this->showIcon) {
3972
            $out .= '
3973
			<' . $colType . ' class="col-icon nowrap">';
3974
            if (!$h) {
3975
                $out .= '&nbsp;';
3976
            } else {
3977
                for ($a = 0; $a < $h; $a++) {
3978
                    if (!$a) {
3979
                        if ($icon) {
3980
                            $out .= $icon;
3981
                        }
3982
                    }
3983
                }
3984
            }
3985
            $out .= '</' . $colType . '>
3986
			';
3987
        }
3988
        // Init rendering.
3989
        $colsp = '';
3990
        $lastKey = '';
3991
        $c = 0;
3992
        $ccount = 0;
3993
        // __label is used as the label key to circumvent problems with uid used as label (see #67756)
3994
        // as it was introduced later on, check if it really exists before using it
3995
        $fields = $this->fieldArray;
3996
        if ($colType === 'td' && array_key_exists('__label', $data)) {
3997
            $fields[0] = '__label';
3998
        }
3999
        // Traverse field array which contains the data to present:
4000
        foreach ($fields as $vKey) {
4001
            if (isset($data[$vKey])) {
4002
                if ($lastKey) {
4003
                    $cssClass = $this->addElement_tdCssClass[$lastKey];
4004
                    if ($this->oddColumnsCssClass && $ccount % 2 == 0) {
4005
                        $cssClass = implode(' ', [$this->addElement_tdCssClass[$lastKey], $this->oddColumnsCssClass]);
4006
                    }
4007
                    $out .= '
4008
						<' . $colType . ' class="' . $cssClass . $noWrap . '"' . $colsp . $this->addElement_tdParams[$lastKey] . '>' . $data[$lastKey] . '</' . $colType . '>';
4009
                }
4010
                $lastKey = $vKey;
4011
                $c = 1;
4012
                $ccount++;
4013
            } else {
4014
                if (!$lastKey) {
4015
                    $lastKey = $vKey;
4016
                }
4017
                $c++;
4018
            }
4019
            if ($c > 1) {
4020
                $colsp = ' colspan="' . $c . '"';
4021
            } else {
4022
                $colsp = '';
4023
            }
4024
        }
4025
        if ($lastKey) {
4026
            $cssClass = $this->addElement_tdCssClass[$lastKey];
4027
            if ($this->oddColumnsCssClass) {
4028
                $cssClass = implode(' ', [$this->addElement_tdCssClass[$lastKey], $this->oddColumnsCssClass]);
4029
            }
4030
            $out .= '
4031
				<' . $colType . ' class="' . $cssClass . $noWrap . '"' . $colsp . $this->addElement_tdParams[$lastKey] . '>' . $data[$lastKey] . '</' . $colType . '>';
4032
        }
4033
        // End row
4034
        $out .= '
4035
		</tr>';
4036
        // Return row.
4037
        return $out;
4038
    }
4039
4040
    /**
4041
     * Dummy function, used to write the top of a table listing.