TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
GridDataService Class Reference

Public Member Functions

 generateGridListFromVersions ($versions, $parameter, $currentWorkspace)
 

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

 resolveDataArrayDependencies ()
 
 getDataArray ($start, $limit)
 
 initializeWorkspacesCachingFramework ()
 
 setDataArrayIntoCache (array $versions, $filterTxt)
 
 getDataArrayFromCache (array $versions, $filterTxt)
 
 calculateHash (array $versions, $filterTxt)
 
 sortDataArray ()
 
 intSort (array $a, array $b)
 
 stringSort ($a, $b)
 
 isSortable (array $a, array $b)
 
 isFilterTextInVisibleColumns ($filterText, array $versionArray)
 
 workspaceState ($stateId, $hiddenOnline=false, $hiddenOffline=false)
 
 getTcaEnableColumnsFieldName ($table, $type)
 
 getLanguageValue ($table, array $record)
 
 getSystemLanguageValue ($id, $key)
 
 getIntegrityService ()
 
 emitSignal ($signalName,...$arguments)
 
 getDependencyCollectionService ()
 
 getAdditionalColumnService ()
 
 getSignalSlotDispatcher ()
 
 getObjectManager ()
 

Protected Attributes

 $currentWorkspace = null
 
 $dataArray = []
 
 $sort = ''
 
 $sortDir = ''
 
 $workspacesCache = null
 
 $systemLanguages
 
 $integrityService
 

Detailed Description

Grid data service

Definition at line 25 of file GridDataService.php.

Member Function Documentation

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$versionsAll 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$filterTxtThe given filter text from the grid.
Returns
string

Definition at line 332 of file GridDataService.php.

References GridDataService\$currentWorkspace, $GLOBALS, GridDataService\$sort, and GridDataService\$sortDir.

Referenced by GridDataService\getDataArrayFromCache(), and GridDataService\setDataArrayIntoCache().

emitSignal (   $signalName,
  $arguments 
)
protected

Emits a signal to be handled by any registered slots.

Parameters
string$signalNameName of the signal
mixed$arguments
Returns
array

Definition at line 627 of file GridDataService.php.

References GridDataService\getSignalSlotDispatcher().

Referenced by GridDataService\getDataArray(), and GridDataService\sortDataArray().

generateGridListFromVersions (   $versions,
  $parameter,
  $currentWorkspace 
)

Generates grid list array from given versions.

Parameters
array$versionsAll 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$parameterParameters as submitted by JavaScript component
int$currentWorkspaceThe current workspace
Returns
array Version record information (filtered, sorted and limited)
Exceptions
InvalidArgumentException

Definition at line 90 of file GridDataService.php.

References GridDataService\$currentWorkspace, and GridDataService\getDataArray().

getAdditionalColumnService ( )
protected
Returns

Definition at line 647 of file GridDataService.php.

References GridDataService\getObjectManager().

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

References GridDataService\emitSignal().

Referenced by GridDataService\generateGridListFromVersions().

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$versionsAll 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$filterTxtThe 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 313 of file GridDataService.php.

References GridDataService\calculateHash().

getDependencyCollectionService ( )
protected
Returns

Definition at line 639 of file GridDataService.php.

References GeneralUtility\makeInstance().

Referenced by GridDataService\resolveDataArrayDependencies().

getIntegrityService ( )
protected

Gets an instance of the integrity service.

Returns

Definition at line 612 of file GridDataService.php.

References GridDataService\$integrityService, and GeneralUtility\makeInstance().

getLanguageValue (   $table,
array  $record 
)
protected

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

Parameters
string$tableName of the table
array$recordDatabase record
Returns
int

Definition at line 562 of file GridDataService.php.

References $GLOBALS, and BackendUtility\isTableLocalizable().

getObjectManager ( )
protected
getSignalSlotDispatcher ( )
protected
Returns

Definition at line 655 of file GridDataService.php.

References GridDataService\getObjectManager().

Referenced by GridDataService\emitSignal().

getSystemLanguageValue (   $id,
  $key 
)
protected

Gets a named value of the available sys_language elements.

Parameters
int$idsys_language uid
string$keyName of the value to be fetched (e.g. title)
Returns
string|NULL
See also
getSystemLanguages

Definition at line 582 of file GridDataService.php.

References GridDataService\$systemLanguages.

getTcaEnableColumnsFieldName (   $table,
  $type 
)
protected

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

Parameters
string$tableName of the table
string$typeType 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 543 of file GridDataService.php.

References $GLOBALS.

initializeWorkspacesCachingFramework ( )
protected

Initializes the workspace cache

Returns
void

Definition at line 289 of file GridDataService.php.

References GeneralUtility\makeInstance().

intSort ( array  $a,
array  $b 
)
protected

Implements individual sorting for columns based on integer comparison.

Parameters
array$aFirst value
array$bSecond value
Returns
int

Definition at line 396 of file GridDataService.php.

References GridDataService\$sort, and GridDataService\isSortable().

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

References $GLOBALS.

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

Referenced by GridDataService\intSort(), and GridDataService\stringSort().

resolveDataArrayDependencies ( )
protected

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

Returns
void

Definition at line 239 of file GridDataService.php.

References GridDataService\getDependencyCollectionService().

setDataArrayIntoCache ( array  $versions,
  $filterTxt 
)
protected

Puts the generated dataArray into the workspace cache.

Parameters
array$versionsAll 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$filterTxtThe given filter text from the grid.

Definition at line 300 of file GridDataService.php.

References $GLOBALS, and GridDataService\calculateHash().

sortDataArray ( )
protected

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

Returns
void

Definition at line 353 of file GridDataService.php.

References GridDataService\emitSignal(), and GeneralUtility\SYSLOG_SEVERITY_ERROR.

stringSort (   $a,
  $b 
)
protected

Implements individual sorting for columns based on string comparison.

Parameters
string$aFirst value
string$bSecond value
Returns
int

Definition at line 427 of file GridDataService.php.

References GridDataService\isSortable().

workspaceState (   $stateId,
  $hiddenOnline = false,
  $hiddenOffline = false 
)
protected

Gets the state of a given state value.

Parameters
int$stateIdstateId of offline record
bool$hiddenOnlinehidden status of online record
bool$hiddenOfflinehidden status of offline record
Returns
string

Definition at line 512 of file GridDataService.php.

Member Data Documentation

$currentWorkspace = null
protected
$dataArray = []
protected

Definition at line 50 of file GridDataService.php.

$integrityService
protected

Definition at line 79 of file GridDataService.php.

Referenced by GridDataService\getIntegrityService().

$sort = ''
protected

Definition at line 57 of file GridDataService.php.

Referenced by GridDataService\calculateHash(), and GridDataService\intSort().

$sortDir = ''
protected

Definition at line 64 of file GridDataService.php.

Referenced by GridDataService\calculateHash().

$systemLanguages
protected

Definition at line 74 of file GridDataService.php.

Referenced by GridDataService\getSystemLanguageValue().

$workspacesCache = null
protected

Definition at line 69 of file GridDataService.php.

const GridColumn_Collection = 'Workspaces_Collection'
const GridColumn_CollectionChildren = 'Workspaces_CollectionChildren'
const GridColumn_CollectionCurrent = 'Workspaces_CollectionCurrent'
const GridColumn_CollectionLevel = 'Workspaces_CollectionLevel'
const GridColumn_CollectionParent = 'Workspaces_CollectionParent'
const SIGNAL_GenerateDataArray_BeforeCaching = 'generateDataArray.beforeCaching'

Definition at line 27 of file GridDataService.php.

const SIGNAL_GenerateDataArray_PostProcesss = 'generateDataArray.postProcess'

Definition at line 28 of file GridDataService.php.

const SIGNAL_GetDataArray_PostProcesss = 'getDataArray.postProcess'

Definition at line 29 of file GridDataService.php.

const SIGNAL_SortDataArray_PostProcesss = 'sortDataArray.postProcess'

Definition at line 30 of file GridDataService.php.