@@ -1,61 +1,61 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if (!defined('TYPO3_MODE')) { |
| 4 | - die('Access denied.'); |
|
| 4 | + die('Access denied.'); |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | $beUsersSiteFcn = function () { |
| 8 | - $table = 'mshop_locale_site'; |
|
| 9 | - $tableConnection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
| 10 | - \TYPO3\CMS\Core\Database\ConnectionPool::class |
|
| 11 | - )->getConnectionForTable($table); |
|
| 12 | - |
|
| 13 | - $queryBuilder = $tableConnection->createQueryBuilder(); |
|
| 14 | - $list = [['', '']]; |
|
| 15 | - |
|
| 16 | - if (empty($tableConnection->getSchemaManager()->listTableColumns($table)) !== true) { |
|
| 17 | - $result = $queryBuilder->select('siteid', 'label', 'nleft', 'nright') |
|
| 18 | - ->from($table) |
|
| 19 | - ->orderBy('nleft') |
|
| 20 | - ->execute(); |
|
| 21 | - |
|
| 22 | - $parents = []; |
|
| 23 | - |
|
| 24 | - $fcn = function ($result, $parents, $right) use (&$fcn, &$list) { |
|
| 25 | - while ($row = $result->fetch()) { |
|
| 26 | - $list[] = [join(' > ', array_merge($parents, [$row['label']])), $row['siteid']]; |
|
| 27 | - |
|
| 28 | - if ($row['nright'] - $row['nleft'] > 1) { |
|
| 29 | - $fcn($result, array_merge($parents, [$row['label']]), $row['nright']); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - if ($row['nright'] + 1 == $right) { |
|
| 33 | - return; |
|
| 34 | - } |
|
| 35 | - } |
|
| 36 | - }; |
|
| 37 | - |
|
| 38 | - while ($row = $result->fetch()) { |
|
| 39 | - $list[] = [$row['label'], $row['siteid']]; |
|
| 40 | - |
|
| 41 | - if ($row['nright'] - $row['nleft'] > 1) { |
|
| 42 | - $fcn($result, array_merge($parents, [$row['label']]), $row['nright']); |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - return $list; |
|
| 8 | + $table = 'mshop_locale_site'; |
|
| 9 | + $tableConnection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
| 10 | + \TYPO3\CMS\Core\Database\ConnectionPool::class |
|
| 11 | + )->getConnectionForTable($table); |
|
| 12 | + |
|
| 13 | + $queryBuilder = $tableConnection->createQueryBuilder(); |
|
| 14 | + $list = [['', '']]; |
|
| 15 | + |
|
| 16 | + if (empty($tableConnection->getSchemaManager()->listTableColumns($table)) !== true) { |
|
| 17 | + $result = $queryBuilder->select('siteid', 'label', 'nleft', 'nright') |
|
| 18 | + ->from($table) |
|
| 19 | + ->orderBy('nleft') |
|
| 20 | + ->execute(); |
|
| 21 | + |
|
| 22 | + $parents = []; |
|
| 23 | + |
|
| 24 | + $fcn = function ($result, $parents, $right) use (&$fcn, &$list) { |
|
| 25 | + while ($row = $result->fetch()) { |
|
| 26 | + $list[] = [join(' > ', array_merge($parents, [$row['label']])), $row['siteid']]; |
|
| 27 | + |
|
| 28 | + if ($row['nright'] - $row['nleft'] > 1) { |
|
| 29 | + $fcn($result, array_merge($parents, [$row['label']]), $row['nright']); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + if ($row['nright'] + 1 == $right) { |
|
| 33 | + return; |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | + }; |
|
| 37 | + |
|
| 38 | + while ($row = $result->fetch()) { |
|
| 39 | + $list[] = [$row['label'], $row['siteid']]; |
|
| 40 | + |
|
| 41 | + if ($row['nright'] - $row['nleft'] > 1) { |
|
| 42 | + $fcn($result, array_merge($parents, [$row['label']]), $row['nright']); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + return $list; |
|
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | 50 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('be_users', [ |
| 51 | - 'siteid' => [ |
|
| 52 | - 'label' => 'LLL:EXT:aimeos/Resources/Private/Language/admin.xlf:be_users_site.title', |
|
| 53 | - 'config' => [ |
|
| 54 | - 'type' => 'select', |
|
| 55 | - 'renderType' => 'selectSingle', |
|
| 56 | - 'items' => $beUsersSiteFcn(), |
|
| 57 | - ] |
|
| 58 | - ] |
|
| 51 | + 'siteid' => [ |
|
| 52 | + 'label' => 'LLL:EXT:aimeos/Resources/Private/Language/admin.xlf:be_users_site.title', |
|
| 53 | + 'config' => [ |
|
| 54 | + 'type' => 'select', |
|
| 55 | + 'renderType' => 'selectSingle', |
|
| 56 | + 'items' => $beUsersSiteFcn(), |
|
| 57 | + ] |
|
| 58 | + ] |
|
| 59 | 59 | ]); |
| 60 | 60 | |
| 61 | 61 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('be_users', 'siteid', '', 'after:password'); |