|
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\Domain\Model\OverwriteProtection; |
|
28
|
|
|
use Aoe\AoeDbSequenzer\Domain\Repository\OverwriteProtectionRepository; |
|
29
|
|
|
use TYPO3\CMS\Backend\Form\NodeFactory; |
|
30
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
31
|
|
|
use TYPO3\CMS\Extbase\Object\ObjectManager; |
|
32
|
|
|
use TYPO3\CMS\Lang\LanguageService; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @package Aoe\AoeDbSequenzer\Form |
|
36
|
|
|
*/ |
|
37
|
|
|
abstract class AbstractOverwriteElement |
|
38
|
|
|
{ |
|
39
|
|
|
/** |
|
40
|
|
|
* @param integer $protectedUid |
|
41
|
|
|
* @param string $tableName |
|
42
|
|
|
* @return boolean |
|
43
|
|
|
*/ |
|
44
|
|
|
protected function hasOverwriteProtection($protectedUid, $tableName) |
|
45
|
|
|
{ |
|
46
|
|
|
$countOverwriteProtections = $this->getOverwriteProtectionRepository() |
|
47
|
|
|
->findByProtectedUidAndTableName($protectedUid, $tableName) |
|
48
|
|
|
->count() ; |
|
49
|
|
|
return ($countOverwriteProtections > 0); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @param integer $protectedUid |
|
54
|
|
|
* @param string $tableName |
|
55
|
|
|
* @return OverwriteProtection |
|
56
|
|
|
*/ |
|
57
|
|
|
protected function getOverwriteProtection($protectedUid, $tableName) |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->getOverwriteProtectionRepository() |
|
60
|
|
|
->findByProtectedUidAndTableName($protectedUid, $tableName) |
|
61
|
|
|
->getFirst(); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return LanguageService |
|
66
|
|
|
*/ |
|
67
|
|
|
protected function getLanguageService() |
|
68
|
|
|
{ |
|
69
|
|
|
return $GLOBALS['LANG']; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @return NodeFactory |
|
74
|
|
|
*/ |
|
75
|
|
|
protected function getNodeFactory() |
|
76
|
|
|
{ |
|
77
|
|
|
return GeneralUtility::makeInstance(NodeFactory::class); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @return OverwriteProtectionRepository |
|
82
|
|
|
*/ |
|
83
|
|
|
protected function getOverwriteProtectionRepository() |
|
84
|
|
|
{ |
|
85
|
|
|
$objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
|
86
|
|
|
return $objectManager->get(OverwriteProtectionRepository::class); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|