‪TYPO3CMS  11.5
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)
 

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, $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)
 
 isPageModuleAllowed ()
 
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=[])
 
array getSystemLanguages (int $pageId)
 
IntegrityService getIntegrityService ()
 
Dependency CollectionService getDependencyCollectionService ()
 
BackendUserAuthentication getBackendUser ()
 

Protected Attributes

int $currentWorkspace
 
array $dataArray = array( )
 
string $sort = ''
 
string $sortDir = ''
 
FrontendInterface $workspacesCache
 
IntegrityService null $integrityService
 
EventDispatcherInterface $eventDispatcher
 

Private Member Functions

array fillDataArrayPart (int $start, int $end)
 

Detailed Description

Grid data service

Definition at line 42 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 376 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 680 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 723 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 131 of file GridDataService.php.

References TYPO3\CMS\Workspaces\Service\IntegrityService\checkElement(), TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord\createFromArrays(), 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\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\isPageModuleAllowed(), TYPO3\CMS\Core\Versioning\VersionState\NEW_PLACEHOLDER, 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 102 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.

◆ 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 305 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 357 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 813 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 802 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 643 of file GridDataService.php.

References $GLOBALS.

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

◆ getSystemLanguages()

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

Gets all available system languages.

Parameters
int$pageId
Returns
‪array

Definition at line 792 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 664 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 624 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 326 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 442 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 537 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 521 of file GridDataService.php.

References TYPO3\CMS\Core\Authentication\BackendUserAuthentication\check(), and 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 509 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,
  $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 337 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 396 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 475 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 588 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.

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 62 of file GridDataService.php.

◆ $eventDispatcher

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

◆ $integrityService

IntegrityService null 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 74 of file GridDataService.php.

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

◆ $workspacesCache

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

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