‪TYPO3CMS  ‪main
TYPO3\CMS\Workspaces\Service\GridDataService Class Reference
Inheritance diagram for TYPO3\CMS\Workspaces\Service\GridDataService:

Public Member Functions

 __construct (private readonly EventDispatcherInterface $eventDispatcher, private readonly WorkspaceService $workspaceService, private readonly ModuleProvider $moduleProvider, private readonly WorkspacePublishGate $workspacePublishGate,)
 
array generateGridListFromVersions (array $versions, \stdClass $parameter, int $currentWorkspace, ServerRequestInterface $request)
 

Public Attributes

const GridColumn_Collection = 'Workspaces_Collection'
 
const GridColumn_CollectionLevel = 'Workspaces_CollectionLevel'
 
const GridColumn_CollectionParent = 'Workspaces_CollectionParent'
 
const GridColumn_CollectionCurrent = 'Workspaces_CollectionCurrent'
 
const GridColumn_CollectionChildren = 'Workspaces_CollectionChildren'
 

Protected Member Functions

 generateDataArray (array $versions, string $filterTxt, ServerRequestInterface $request)
 
 versionIsModified (CombinedRecord $combinedRecord, ServerRequestInterface $request)
 
 resolveDataArrayDependencies ()
 
 getDataArray (int $start, int $limit)
 
 initializeWorkspacesCachingFramework ()
 
 setDataArrayIntoCache (array $versions, string $filterTxt)
 
bool getDataArrayFromCache (array $versions, string $filterTxt)
 
 calculateHash (array $versions, string $filterTxt)
 
 sortDataArray ()
 
 intSort (array $a, array $b)
 
 stringSort (array $a, array $b)
 
 isSortable (array $a, array $b)
 
 isPageModuleAllowed ()
 
 isFilterTextInVisibleColumns (string $filterText, array $versionArray)
 
 workspaceState (int $stateId, bool $hiddenOnline=false, bool $hiddenOffline=false, bool $hasDiff=true)
 
string null getTcaEnableColumnsFieldName (string $table, string $type)
 
int getLanguageValue (string $table, array $record)
 
string null getSystemLanguageValue (int $id, int $pageId, string $key)
 
 calculateStartWithCollections (int $start)
 
 addCollectionChildrenRecursive (array $item, int &$recordsCount, array &$dataArrayPart=[])
 
 getSystemLanguages (int $pageId)
 
 getIntegrityService ()
 
 getDependencyCollectionService ()
 
 getBackendUser ()
 

Protected Attributes

int $currentWorkspace = 0
 
array $dataArray = []
 
string $sort = ''
 
string $sortDir = ''
 
FrontendInterface $workspacesCache
 
IntegrityService $integrityService
 

Private Member Functions

 fillDataArrayPart (int $start, int $end)
 

Detailed Description

Definition at line 47 of file GridDataService.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Workspaces\Service\GridDataService::__construct ( private readonly EventDispatcherInterface  $eventDispatcher,
private readonly WorkspaceService  $workspaceService,
private readonly ModuleProvider  $moduleProvider,
private readonly WorkspacePublishGate  $workspacePublishGate 
)

Definition at line 80 of file GridDataService.php.

Member Function Documentation

◆ addCollectionChildrenRecursive()

TYPO3\CMS\Workspaces\Service\GridDataService::addCollectionChildrenRecursive ( array  $item,
int &  $recordsCount,
array &  $dataArrayPart = [] 
)
protected

◆ calculateHash()

TYPO3\CMS\Workspaces\Service\GridDataService::calculateHash ( array  $versions,
string  $filterTxt 
)
protected

Calculates the hash value of the used workspace, the user id, the versions array, the filter text, the sorting attribute, the workspace selected in grid and the sorting direction.

Parameters
array$versions‪All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid and t3ver_oid fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid
string$filterTxt‪The given filter text from the grid.

Definition at line 371 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\$currentWorkspace, TYPO3\CMS\Workspaces\Service\GridDataService\$sort, TYPO3\CMS\Workspaces\Service\GridDataService\$sortDir, and TYPO3\CMS\Workspaces\Service\GridDataService\getBackendUser().

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\getDataArrayFromCache(), and TYPO3\CMS\Workspaces\Service\GridDataService\setDataArrayIntoCache().

◆ calculateStartWithCollections()

TYPO3\CMS\Workspaces\Service\GridDataService::calculateStartWithCollections ( int  $start)
protected

Calculate the "real" start value by also taking collection children into account

Definition at line 642 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\addCollectionChildrenRecursive().

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\getDataArray().

◆ fillDataArrayPart()

TYPO3\CMS\Workspaces\Service\GridDataService::fillDataArrayPart ( int  $start,
int  $end 
)
private

Fill the data array part until enough parent records are found ($end is reached). Also adds the related collection children, but without increasing the corresponding parent records count.

Definition at line 681 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\addCollectionChildrenRecursive().

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\getDataArray().

◆ generateDataArray()

TYPO3\CMS\Workspaces\Service\GridDataService::generateDataArray ( array  $versions,
string  $filterTxt,
ServerRequestInterface  $request 
)
protected

Generates grid list array from given versions.

Parameters
array$versions‪All available version records
string$filterTxt‪Text to be used to filter record result

Definition at line 120 of file GridDataService.php.

References TYPO3\CMS\Webhooks\Message\$identifier, TYPO3\CMS\Webhooks\Message\$record, TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord\createFromArrays(), TYPO3\CMS\Core\Utility\GeneralUtility\fixed_lgd_cs(), TYPO3\CMS\Workspaces\Service\GridDataService\getBackendUser(), TYPO3\CMS\Workspaces\Service\GridDataService\getDataArrayFromCache(), TYPO3\CMS\Workspaces\Service\GridDataService\getIntegrityService(), TYPO3\CMS\Workspaces\Service\GridDataService\getLanguageValue(), TYPO3\CMS\Workspaces\Service\GridDataService\getSystemLanguageValue(), TYPO3\CMS\Workspaces\Service\GridDataService\getTcaEnableColumnsFieldName(), TYPO3\CMS\Workspaces\Service\GridDataService\initializeWorkspacesCachingFramework(), TYPO3\CMS\Workspaces\Service\GridDataService\isFilterTextInVisibleColumns(), TYPO3\CMS\Workspaces\Service\GridDataService\isPageModuleAllowed(), TYPO3\CMS\Workspaces\Service\WorkspaceService\PUBLISH_ACCESS_ONLY_IN_PUBLISH_STAGE, TYPO3\CMS\Workspaces\Service\GridDataService\resolveDataArrayDependencies(), TYPO3\CMS\Workspaces\Service\GridDataService\setDataArrayIntoCache(), TYPO3\CMS\Workspaces\Service\GridDataService\sortDataArray(), TYPO3\CMS\Workspaces\Service\StagesService\STAGE_EDIT_ID, TYPO3\CMS\Workspaces\Service\StagesService\STAGE_PUBLISH_ID, TYPO3\CMS\Workspaces\Service\GridDataService\versionIsModified(), and TYPO3\CMS\Workspaces\Service\GridDataService\workspaceState().

◆ generateGridListFromVersions()

array TYPO3\CMS\Workspaces\Service\GridDataService::generateGridListFromVersions ( array  $versions,
\stdClass  $parameter,
int  $currentWorkspace,
ServerRequestInterface  $request 
)

Generates grid list array from given versions.

Parameters
array$versions‪All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid and t3ver_oid fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid
\stdClass$parameter‪Parameters as submitted by JavaScript component
int$currentWorkspace‪The current workspace
Returns
‪array Version record information (filtered, sorted and limited)

Definition at line 95 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\$currentWorkspace, and TYPO3\CMS\Workspaces\Service\GridDataService\getDataArray().

◆ getBackendUser()

◆ getDataArray()

TYPO3\CMS\Workspaces\Service\GridDataService::getDataArray ( int  $start,
int  $limit 
)
protected

◆ getDataArrayFromCache()

bool TYPO3\CMS\Workspaces\Service\GridDataService::getDataArrayFromCache ( array  $versions,
string  $filterTxt 
)
protected

Checks if a cache entry is given for given versions and filter text and tries to load the data array from cache.

Parameters
array$versions‪All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid and t3ver_oid fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid
string$filterTxt‪The given filter text from the grid.
Returns
‪bool TRUE if cache entry was successfully fetched from cache and content put to $this->dataArray

Definition at line 353 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\calculateHash().

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ getDependencyCollectionService()

TYPO3\CMS\Workspaces\Service\GridDataService::getDependencyCollectionService ( )
protected

◆ getIntegrityService()

TYPO3\CMS\Workspaces\Service\GridDataService::getIntegrityService ( )
protected

Gets an instance of the integrity service.

Definition at line 751 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\$integrityService.

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ getLanguageValue()

int TYPO3\CMS\Workspaces\Service\GridDataService::getLanguageValue ( string  $table,
array  $record 
)
protected

Gets the language value (system language uid) of a given database record

Parameters
string$table‪Name of the table
array$record‪Database record
Returns
‪int

Definition at line 608 of file GridDataService.php.

References $GLOBALS, and TYPO3\CMS\Webhooks\Message\$record.

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ getSystemLanguages()

TYPO3\CMS\Workspaces\Service\GridDataService::getSystemLanguages ( int  $pageId)
protected

Gets all available system languages.

Definition at line 743 of file GridDataService.php.

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\getSystemLanguageValue().

◆ getSystemLanguageValue()

string null TYPO3\CMS\Workspaces\Service\GridDataService::getSystemLanguageValue ( int  $id,
int  $pageId,
string  $key 
)
protected

Gets a named value of an available system language

Parameters
int$id‪system language uid
int$pageId‪page id of a site
string$key‪Name of the value to be fetched (e.g. title)
Returns
‪string|null
See also
getSystemLanguages

Definition at line 629 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\getSystemLanguages().

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ getTcaEnableColumnsFieldName()

string null TYPO3\CMS\Workspaces\Service\GridDataService::getTcaEnableColumnsFieldName ( string  $table,
string  $type 
)
protected

Gets the field name of the enable-columns as defined in $TCA.

Parameters
string$table‪Name of the table
string$type‪Type to be fetches (e.g. 'disabled', 'starttime', 'endtime', 'fe_group)
Returns
‪string|null The accordant field name or NULL if not defined

Definition at line 590 of file GridDataService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ initializeWorkspacesCachingFramework()

TYPO3\CMS\Workspaces\Service\GridDataService::initializeWorkspacesCachingFramework ( )
protected

Initializes the workspace cache

Definition at line 322 of file GridDataService.php.

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ intSort()

TYPO3\CMS\Workspaces\Service\GridDataService::intSort ( array  $a,
array  $b 
)
protected

Implements individual sorting for columns based on integer comparison.

Definition at line 426 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\$sort, and TYPO3\CMS\Workspaces\Service\GridDataService\isSortable().

◆ isFilterTextInVisibleColumns()

TYPO3\CMS\Workspaces\Service\GridDataService::isFilterTextInVisibleColumns ( string  $filterText,
array  $versionArray 
)
protected

Determines whether the text used to filter the results is part of a column that is visible in the grid view.

Definition at line 505 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\getBackendUser().

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ isPageModuleAllowed()

TYPO3\CMS\Workspaces\Service\GridDataService::isPageModuleAllowed ( )
protected

Checks whether the configured page module can be accessed by the current user. Note that this does not check whether a custom page module is configured correctly.

Definition at line 496 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\getBackendUser().

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ isSortable()

TYPO3\CMS\Workspaces\Service\GridDataService::isSortable ( array  $a,
array  $b 
)
protected

Determines whether dataArray elements are sortable. Only elements on the first level (0) or below the same parent element are directly sortable.

Definition at line 484 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\GridColumn_CollectionLevel, and TYPO3\CMS\Workspaces\Service\GridDataService\GridColumn_CollectionParent.

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\intSort(), and TYPO3\CMS\Workspaces\Service\GridDataService\stringSort().

◆ resolveDataArrayDependencies()

TYPO3\CMS\Workspaces\Service\GridDataService::resolveDataArrayDependencies ( )
protected

Resolves dependencies of nested structures and sort data elements considering these dependencies.

Definition at line 286 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\getDependencyCollectionService().

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ setDataArrayIntoCache()

TYPO3\CMS\Workspaces\Service\GridDataService::setDataArrayIntoCache ( array  $versions,
string  $filterTxt 
)
protected

Puts the generated dataArray into the workspace cache.

Parameters
array$versions‪All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid and t3ver_oid fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid
string$filterTxt‪The given filter text from the grid.

Definition at line 333 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\calculateHash(), and TYPO3\CMS\Workspaces\Service\GridDataService\getBackendUser().

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ sortDataArray()

TYPO3\CMS\Workspaces\Service\GridDataService::sortDataArray ( )
protected

Performs sorting on the data array accordant to the selected column in the grid view to be used for sorting.

Definition at line 391 of file GridDataService.php.

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

◆ stringSort()

TYPO3\CMS\Workspaces\Service\GridDataService::stringSort ( array  $a,
array  $b 
)
protected

Implements individual sorting for columns based on string comparison.

Definition at line 454 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\isSortable().

◆ versionIsModified()

TYPO3\CMS\Workspaces\Service\GridDataService::versionIsModified ( CombinedRecord  $combinedRecord,
ServerRequestInterface  $request 
)
protected

◆ workspaceState()

TYPO3\CMS\Workspaces\Service\GridDataService::workspaceState ( int  $stateId,
bool  $hiddenOnline = false,
bool  $hiddenOffline = false,
bool  $hasDiff = true 
)
protected

Gets the state of a given state value.

Parameters
int$stateId‪stateId of offline record
bool$hiddenOnline‪hidden status of online record
bool$hiddenOffline‪hidden status of offline record
bool$hasDiff‪whether the version has any changes

Definition at line 554 of file GridDataService.php.

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\generateDataArray().

Member Data Documentation

◆ $currentWorkspace

int TYPO3\CMS\Workspaces\Service\GridDataService::$currentWorkspace = 0
protected

◆ $dataArray

array TYPO3\CMS\Workspaces\Service\GridDataService::$dataArray = []
protected

Version record information (filtered, sorted and limited)

Definition at line 65 of file GridDataService.php.

◆ $integrityService

IntegrityService TYPO3\CMS\Workspaces\Service\GridDataService::$integrityService
protected

◆ $sort

string TYPO3\CMS\Workspaces\Service\GridDataService::$sort = ''
protected

◆ $sortDir

string TYPO3\CMS\Workspaces\Service\GridDataService::$sortDir = ''
protected

Direction used for sorting (ASC, DESC).

Definition at line 75 of file GridDataService.php.

Referenced by TYPO3\CMS\Workspaces\Service\GridDataService\calculateHash().

◆ $workspacesCache

FrontendInterface TYPO3\CMS\Workspaces\Service\GridDataService::$workspacesCache
protected

Definition at line 77 of file GridDataService.php.

◆ GridColumn_Collection

const TYPO3\CMS\Workspaces\Service\GridDataService::GridColumn_Collection = 'Workspaces_Collection'

◆ GridColumn_CollectionChildren

const TYPO3\CMS\Workspaces\Service\GridDataService::GridColumn_CollectionChildren = 'Workspaces_CollectionChildren'

◆ GridColumn_CollectionCurrent

const TYPO3\CMS\Workspaces\Service\GridDataService::GridColumn_CollectionCurrent = 'Workspaces_CollectionCurrent'

◆ GridColumn_CollectionLevel

const TYPO3\CMS\Workspaces\Service\GridDataService::GridColumn_CollectionLevel = 'Workspaces_CollectionLevel'

◆ GridColumn_CollectionParent

const TYPO3\CMS\Workspaces\Service\GridDataService::GridColumn_CollectionParent = 'Workspaces_CollectionParent'