GridDataService

class \TYPO3\CMS\Workspaces\Service\GridDataService

Implements
LoggerAwareInterface
Uses
LoggerAwareTrait

Grid data service

Table of Contents

Interfaces

LoggerAwareInterface

Constants

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

Properties

$currentWorkspace  : int
Id of the current active workspace.
$dataArray  : array
Version record information (filtered, sorted and limited)
$eventDispatcher  : EventDispatcherInterface
$integrityService  : IntegrityService|null
$sort  : string
Name of the field used for sorting.
$sortDir  : string
Direction used for sorting (ASC, DESC).
$workspacesCache  : FrontendInterface

Methods

__construct()  : mixed
generateGridListFromVersions()  : array
Generates grid list array from given versions.
addCollectionChildrenRecursive()  : void
Add collection children to the data array part recursively
calculateHash()  : string
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.
calculateStartWithCollections()  : int
Calculate the "real" start value by also taking collection children into account
generateDataArray()  : mixed
Generates grid list array from given versions.
getBackendUser()  : BackendUserAuthentication
getDataArray()  : array
Gets the data array by considering the page to be shown in the grid view.
getDataArrayFromCache()  : bool
Checks if a cache entry is given for given versions and filter text and tries to load the data array from cache.
getDependencyCollectionService()  : CollectionService
getIntegrityService()  : IntegrityService
Gets an instance of the integrity service.
getLanguageValue()  : int
Gets the used language value (sys_language.uid) of a given database record.
getSystemLanguages()  : array
Gets all available system languages.
getSystemLanguageValue()  : string|null
Gets a named value of the available sys_language elements.
getTcaEnableColumnsFieldName()  : string|null
Gets the field name of the enable-columns as defined in $TCA.
initializeWorkspacesCachingFramework()  : mixed
Initializes the workspace cache
intSort()  : int
Implements individual sorting for columns based on integer comparison.
isFilterTextInVisibleColumns()  : bool
Determines whether the text used to filter the results is part of a column that is visible in the grid view.
isPageModuleAllowed()  : bool
Checks whether the configured page module can be accessed by the current user.
isSortable()  : bool
Determines whether dataArray elements are sortable.
resolveDataArrayDependencies()  : mixed
Resolves dependencies of nested structures and sort data elements considering these dependencies.
setDataArrayIntoCache()  : mixed
Puts the generated dataArray into the workspace cache.
sortDataArray()  : mixed
Performs sorting on the data array accordant to the selected column in the grid view to be used for sorting.
stringSort()  : int
Implements individual sorting for columns based on string comparison.
versionIsModified()  : bool
workspaceState()  : string
Gets the state of a given state value.

Constants

GridColumn_Collection

public mixed GridColumn_Collection = 'Workspaces_Collection'

GridColumn_CollectionChildren

public mixed GridColumn_CollectionChildren = 'Workspaces_CollectionChildren'

GridColumn_CollectionCurrent

public mixed GridColumn_CollectionCurrent = 'Workspaces_CollectionCurrent'

GridColumn_CollectionLevel

public mixed GridColumn_CollectionLevel = 'Workspaces_CollectionLevel'

GridColumn_CollectionParent

public mixed GridColumn_CollectionParent = 'Workspaces_CollectionParent'

Properties

$currentWorkspace

Id of the current active workspace.

protected int $currentWorkspace

$dataArray

Version record information (filtered, sorted and limited)

protected array $dataArray = []

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

$sort

Name of the field used for sorting.

protected string $sort = ''

$sortDir

Direction used for sorting (ASC, DESC).

protected string $sortDir = ''

Methods

__construct()

public __construct(EventDispatcherInterface $eventDispatcher) : mixed

Parameters

$eventDispatcher : EventDispatcherInterface

generateGridListFromVersions()

Generates grid list array from given versions.

public generateGridListFromVersions(array $versions, stdClass $parameter, int $currentWorkspace) : array

Parameters

$versions : array

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

$parameter : stdClass

Parameters as submitted by JavaScript component

$currentWorkspace : int

The current workspace

Tags

throws
InvalidArgumentException

Return values

array —

Version record information (filtered, sorted and limited)

addCollectionChildrenRecursive()

Add collection children to the data array part recursively

protected addCollectionChildrenRecursive(array $item, int &$recordsCount[, array &$dataArrayPart = [] ]) : void

Parameters

$item : array
$recordsCount : int
$dataArrayPart : array = []

calculateHash()

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.

protected calculateHash(array $versions, string $filterTxt) : string

Parameters

$versions : array

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

$filterTxt : string

The given filter text from the grid.

Return values

string

calculateStartWithCollections()

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

protected calculateStartWithCollections(int $start) : int

Parameters

$start : int

Return values

int

getDataArray()

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

protected getDataArray(int $start, int $limit) : array

Parameters

$start : int
$limit : int

Return values

array

getDataArrayFromCache()

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

protected getDataArrayFromCache(array $versions, string $filterTxt) : bool

Parameters

$versions : array

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

$filterTxt : string

The given filter text from the grid.

Return values

bool —

TRUE if cache entry was successfully fetched from cache and content put to $this->dataArray

getLanguageValue()

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

protected getLanguageValue(string $table, array $record) : int

Parameters

$table : string

Name of the table

$record : array

Database record

Return values

int

getSystemLanguages()

Gets all available system languages.

protected getSystemLanguages(int $pageId) : array

Parameters

$pageId : int

Return values

array

getSystemLanguageValue()

Gets a named value of the available sys_language elements.

protected getSystemLanguageValue(int $id, int $pageId, string $key) : string|null

Parameters

$id : int

sys_language uid

$pageId : int

page id of a site

$key : string

Name of the value to be fetched (e.g. title)

Tags

see
getSystemLanguages

Return values

string|null

getTcaEnableColumnsFieldName()

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

protected getTcaEnableColumnsFieldName(string $table, string $type) : string|null

Parameters

$table : string

Name of the table

$type : string

Type to be fetches (e.g. 'disabled', 'starttime', 'endtime', 'fe_group)

Return values

string|null —

The accordant field name or NULL if not defined

initializeWorkspacesCachingFramework()

Initializes the workspace cache

protected initializeWorkspacesCachingFramework() : mixed

intSort()

Implements individual sorting for columns based on integer comparison.

protected intSort(array $a, array $b) : int

Parameters

$a : array

First value

$b : array

Second value

Return values

int

isFilterTextInVisibleColumns()

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

protected isFilterTextInVisibleColumns(string $filterText, array $versionArray) : bool

Parameters

$filterText : string
$versionArray : array

Return values

bool

isPageModuleAllowed()

Checks whether the configured page module can be accessed by the current user.

protected isPageModuleAllowed() : bool

Note that this does not check whether a custom page module is configured correctly.

Return values

bool

isSortable()

Determines whether dataArray elements are sortable.

protected isSortable(array $a, array $b) : bool

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

Parameters

$a : array
$b : array

Return values

bool

resolveDataArrayDependencies()

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

protected resolveDataArrayDependencies() : mixed

setDataArrayIntoCache()

Puts the generated dataArray into the workspace cache.

protected setDataArrayIntoCache(array $versions, string $filterTxt) : mixed

Parameters

$versions : array

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

$filterTxt : string

The given filter text from the grid.

sortDataArray()

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

protected sortDataArray() : mixed

stringSort()

Implements individual sorting for columns based on string comparison.

protected stringSort(array $a, array $b) : int

Parameters

$a : array

First value

$b : array

Second value

Return values

int

workspaceState()

Gets the state of a given state value.

protected workspaceState(int $stateId[, bool $hiddenOnline = false ][, bool $hiddenOffline = false ][, bool $hasDiff = true ]) : string

Parameters

$stateId : int

stateId of offline record

$hiddenOnline : bool = false

hidden status of online record

$hiddenOffline : bool = false

hidden status of offline record

$hasDiff : bool = true

whether the version has any changes

Return values

string
On this page