OverwriteTillElement   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 35
ccs 0
cts 26
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 28 2
1
<?php
2
namespace Aoe\AoeDbSequenzer\Form;
3
4
/***************************************************************
5
 *  Copyright notice
6
 *
7
 *  (c) 2017 AOE GmbH ([email protected])
8
 *  All rights reserved
9
 *
10
 *  This script is part of the TYPO3 project. The TYPO3 project is
11
 *  free software; you can redistribute it and/or modify
12
 *  it under the terms of the GNU General Public License as published by
13
 *  the Free Software Foundation; either version 2 of the License, or
14
 *  (at your option) any later version.
15
 *
16
 *  The GNU General Public License can be found at
17
 *  http://www.gnu.org/copyleft/gpl.html.
18
 *
19
 *  This script is distributed in the hope that it will be useful,
20
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 *  GNU General Public License for more details.
23
 *
24
 *  This copyright notice MUST APPEAR in all copies of the script!
25
 ***************************************************************/
26
27
use Aoe\AoeDbSequenzer\Service\OverwriteProtectionService;
28
use TYPO3\CMS\Backend\Form\Element\InputTextElement;
29
30
/**
31
 * @package Aoe\AoeDbSequenzer\Form
32
 */
33
class OverwriteTillElement extends AbstractOverwriteElement
34
{
35
    /**
36
     * @param array $PA
37
     * @return String
38
     */
39
    public function render(array $PA)
40
    {
41
        $itemFormElValue = '';
42
        if ($this->hasOverwriteProtection($PA['row']['uid'], $PA['table'])) {
43
            $overwriteProtection = $this->getOverwriteProtection($PA['row']['uid'], $PA['table']);
44
            $itemFormElValue = $overwriteProtection->getProtectedTime();
45
        }
46
47
        $data = [
48
            'parameterArray' => [
49
                'itemFormElName' => 'data[' . $PA['table'] . '][' . $PA['row']['uid'] . ']['.OverwriteProtectionService::OVERWRITE_PROTECTION_TILL.']',
50
                'itemFormElValue' => $itemFormElValue,
51
                'fieldName' => OverwriteProtectionService::OVERWRITE_PROTECTION_TILL,
52
                'fieldConf' => [
53
                    'label' => $this->getLanguageService()->sL('LLL:EXT:aoe_dbsequenzer/Resources/Private/Language/locallang_db.xml:protectoverwrite_till'),
54
                    'config' => [
55
                        'type' => 'input',
56
                        'dbType' => 'datetime',
57
                        'eval' => 'datetime',
58
                    ]
59
                ]
60
            ]
61
        ];
62
63
        $element = new InputTextElement($this->getNodeFactory(), $data);
64
        $resultArray = $element->render();
65
        return $resultArray['html'];
66
    }
67
}
68