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

Public Member Functions

 __construct (EventDispatcherInterface $eventDispatcher)
 
array generateGridListFromVersions ($versions, $parameter, $currentWorkspace)
 
array getSystemLanguages (?int $pageId)
 

Public Attributes

const SIGNAL_GenerateDataArray_BeforeCaching = 'generateDataArray.beforeCaching'
 
const SIGNAL_GenerateDataArray_PostProcesss = 'generateDataArray.postProcess'
 
const SIGNAL_GetDataArray_PostProcesss = 'getDataArray.postProcess'
 
const SIGNAL_SortDataArray_PostProcesss = 'sortDataArray.postProcess'
 
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, $filterTxt)
 
 versionIsModified (CombinedRecord $combinedRecord)
 
 resolveDataArrayDependencies ()
 
array getDataArray ($start, $limit)
 
 initializeWorkspacesCachingFramework ()
 
 setDataArrayIntoCache (array $versions, $filterTxt)
 
bool getDataArrayFromCache (array $versions, $filterTxt)
 
string calculateHash (array $versions, $filterTxt)
 
 sortDataArray ()
 
int intSort (array $a, array $b)
 
int stringSort ($a, $b)
 
bool isSortable (array $a, array $b)
 
bool isFilterTextInVisibleColumns ($filterText, array $versionArray)
 
string workspaceState ($stateId, $hiddenOnline=false, $hiddenOffline=false, $hasDiff=true)
 
string null getTcaEnableColumnsFieldName ($table, $type)
 
int getLanguageValue ($table, array $record)
 
string null getSystemLanguageValue ($id, $pageId, $key)
 
int calculateStartWithCollections (int $start)
 
 addCollectionChildrenRecursive (array $item, int &$recordsCount, array &$dataArrayPart=[])
 
IntegrityService getIntegrityService ()
 
Dependency CollectionService getDependencyCollectionService ()
 
AdditionalColumnService getAdditionalColumnService ()
 
BackendUserAuthentication getBackendUser ()
 

Protected Attributes

int $currentWorkspace
 
array $dataArray = array( )
 
string $sort = ''
 
string $sortDir = ''
 
TYPO3 CMS Core Cache Frontend FrontendInterface $workspacesCache
 
IntegrityService $integrityService
 
EventDispatcherInterface $eventDispatcher
 

Private Member Functions

array fillDataArrayPart (int $start, int $end)
 

Detailed Description

Grid data service

Definition at line 41 of file GridDataService.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Workspaces\Service\GridDataService::__construct ( EventDispatcherInterface  $eventDispatcher)

Member Function Documentation

◆ addCollectionChildrenRecursive()

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

◆ calculateHash()

string TYPO3\CMS\Workspaces\Service\GridDataService::calculateHash ( array  $versions,
  $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.
Returns
‪string

Definition at line 385 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()

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

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

Parameters
int$start
Returns
‪int

Definition at line 673 of file GridDataService.php.

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

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

◆ fillDataArrayPart()

array 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.

Parameters
int$start
int$end
Returns
‪array

Definition at line 716 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,
  $filterTxt 
)
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 147 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\IntegrityService\checkElement(), TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord\createFromArrays(), TYPO3\CMS\Backend\Utility\BackendUtility\datetime(), TYPO3\CMS\Workspaces\Service\GridDataService\getAdditionalColumnService(), 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\Backend\Utility\BackendUtility\getRecord(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecordPath(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecordTitle(), TYPO3\CMS\Workspaces\Service\IntegrityService\getStatusRepresentation(), TYPO3\CMS\Workspaces\Service\GridDataService\getSystemLanguageValue(), TYPO3\CMS\Workspaces\Service\GridDataService\getTcaEnableColumnsFieldName(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getWorkspaceTitle(), TYPO3\CMS\Workspaces\Service\GridDataService\initializeWorkspacesCachingFramework(), TYPO3\CMS\Workspaces\Service\GridDataService\isFilterTextInVisibleColumns(), TYPO3\CMS\Workspaces\Service\GridDataService\resolveDataArrayDependencies(), TYPO3\CMS\Workspaces\Service\GridDataService\setDataArrayIntoCache(), TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL, TYPO3\CMS\Workspaces\Service\GridDataService\sortDataArray(), TYPO3\CMS\Workspaces\Service\StagesService\STAGE_PUBLISH_ID, TYPO3\CMS\Workspaces\Service\GridDataService\versionIsModified(), and TYPO3\CMS\Workspaces\Service\GridDataService\workspaceState().

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

◆ generateGridListFromVersions()

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

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)
Exceptions

Definition at line 118 of file GridDataService.php.

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

◆ getAdditionalColumnService()

AdditionalColumnService TYPO3\CMS\Workspaces\Service\GridDataService::getAdditionalColumnService ( )
protected

◆ getBackendUser()

◆ getDataArray()

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

Gets the data array by considering the page to be shown in the grid view.

Parameters
int$start
int$limit
Returns
‪array

Definition at line 314 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\GridDataService\calculateStartWithCollections(), and TYPO3\CMS\Workspaces\Service\GridDataService\fillDataArrayPart().

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

◆ getDataArrayFromCache()

bool TYPO3\CMS\Workspaces\Service\GridDataService::getDataArrayFromCache ( array  $versions,
  $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 366 of file GridDataService.php.

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

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

◆ getDependencyCollectionService()

Dependency CollectionService TYPO3\CMS\Workspaces\Service\GridDataService::getDependencyCollectionService ( )
protected
Returns
Dependency\CollectionService

Definition at line 805 of file GridDataService.php.

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

◆ getIntegrityService()

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

Gets an instance of the integrity service.

Returns
IntegrityService

Definition at line 794 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 (   $table,
array  $record 
)
protected

Gets the used language value (sys_language.uid) of a given database record.

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

Definition at line 636 of file GridDataService.php.

References $GLOBALS, and TYPO3\CMS\Backend\Utility\BackendUtility\isTableLocalizable().

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

◆ getSystemLanguages()

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

Gets all available system languages.

Returns
‪array

Definition at line 784 of file GridDataService.php.

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

◆ getSystemLanguageValue()

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

Gets a named value of the available sys_language elements.

Parameters
int$id‪sys_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 657 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 (   $table,
  $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 617 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 335 of file GridDataService.php.

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

◆ intSort()

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

Implements individual sorting for columns based on integer comparison.

Parameters
array$a‪First value
array$b‪Second value
Returns
‪int

Definition at line 447 of file GridDataService.php.

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

◆ isFilterTextInVisibleColumns()

bool TYPO3\CMS\Workspaces\Service\GridDataService::isFilterTextInVisibleColumns (   $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.

Parameters
string$filterText
array$versionArray
Returns
‪bool

Definition at line 530 of file GridDataService.php.

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

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

◆ isSortable()

bool 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.

Parameters
array$a
array$b
Returns
‪bool

Definition at line 514 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 295 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,
  $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 346 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 405 of file GridDataService.php.

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

◆ stringSort()

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

Implements individual sorting for columns based on string comparison.

Parameters
array$a‪First value
array$b‪Second value
Returns
‪int

Definition at line 480 of file GridDataService.php.

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

◆ versionIsModified()

◆ workspaceState()

string TYPO3\CMS\Workspaces\Service\GridDataService::workspaceState (   $stateId,
  $hiddenOnline = false,
  $hiddenOffline = false,
  $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
Returns
‪string

Definition at line 581 of file GridDataService.php.

References TYPO3\CMS\Core\Versioning\VersionState\DELETE_PLACEHOLDER, TYPO3\CMS\Core\Versioning\VersionState\MOVE_POINTER, and TYPO3\CMS\Core\Versioning\VersionState\NEW_PLACEHOLDER_VERSION.

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

Member Data Documentation

◆ $currentWorkspace

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

◆ $dataArray

array TYPO3\CMS\Workspaces\Service\GridDataService::$dataArray = array( )
protected

Version record information (filtered, sorted and limited)

Definition at line 78 of file GridDataService.php.

◆ $eventDispatcher

EventDispatcherInterface TYPO3\CMS\Workspaces\Service\GridDataService::$eventDispatcher
protected

◆ $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 90 of file GridDataService.php.

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

◆ $workspacesCache

TYPO3 CMS Core Cache Frontend FrontendInterface TYPO3\CMS\Workspaces\Service\GridDataService::$workspacesCache
protected

Definition at line 94 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'

◆ SIGNAL_GenerateDataArray_BeforeCaching

const TYPO3\CMS\Workspaces\Service\GridDataService::SIGNAL_GenerateDataArray_BeforeCaching = 'generateDataArray.beforeCaching'
Deprecated:
‪will be removed in TYPO3 v11 in favor of PSR-14 events

Definition at line 48 of file GridDataService.php.

Referenced by TYPO3\CMS\Workspaces\Compatibility\SlotReplacement\onGenerateDataArrayBeforeCaching().

◆ SIGNAL_GenerateDataArray_PostProcesss

const TYPO3\CMS\Workspaces\Service\GridDataService::SIGNAL_GenerateDataArray_PostProcesss = 'generateDataArray.postProcess'
Deprecated:
‪will be removed in TYPO3 v11 in favor of PSR-14 events

Definition at line 52 of file GridDataService.php.

Referenced by TYPO3\CMS\Workspaces\Compatibility\SlotReplacement\onGenerateDataArrayPostProcessing().

◆ SIGNAL_GetDataArray_PostProcesss

const TYPO3\CMS\Workspaces\Service\GridDataService::SIGNAL_GetDataArray_PostProcesss = 'getDataArray.postProcess'
Deprecated:
‪will be removed in TYPO3 v11 in favor of PSR-14 events

Definition at line 56 of file GridDataService.php.

Referenced by TYPO3\CMS\Workspaces\Compatibility\SlotReplacement\onGetDataPostProcessing().

◆ SIGNAL_SortDataArray_PostProcesss

const TYPO3\CMS\Workspaces\Service\GridDataService::SIGNAL_SortDataArray_PostProcesss = 'sortDataArray.postProcess'
Deprecated:
‪will be removed in TYPO3 v11 in favor of PSR-14 events

Definition at line 60 of file GridDataService.php.

Referenced by TYPO3\CMS\Workspaces\Compatibility\SlotReplacement\onSortDataPostProcessing().