TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Workspaces\Service\StagesService Class Reference
Inheritance diagram for TYPO3\CMS\Workspaces\Service\StagesService:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 getWorkspaceId ()
 
 getPreviousStageForElementCollection ( $workspaceItems, array $byTableName=['tt_content', 'pages', 'pages_language_overlay'])
 
 getNextStageForElementCollection ( $workspaceItems, array $byTableName=['tt_content', 'pages', 'pages_language_overlay'])
 
 getStagesForWS ()
 
 getStageTitle ($ver_stage)
 
 getStageRecord ($stageid)
 
 getNextStage ($stageId)
 
 getNextStages (array &$nextStageArray, $stageId)
 
 getPrevStage ($stageId)
 
 getPrevStages (array &$prevStageArray, $stageId)
 
 getResponsibleBeUser ($stageRecord, $selectDefaultUserField=false)
 
 getResponsibleUser ($stageRespValue)
 
 resolveBackendUserIds ($backendUserGroupList)
 
 getBackendUsers ($backendUserList)
 
 getPreselectedRecipients (StageRecord $stageRecord)
 
 getPropertyOfCurrentWorkspaceStage ($stageId, $property)
 
 getPositionOfCurrentStage ($stageId)
 
 isPrevStageAllowedForUser ($stageId)
 
 isNextStageAllowedForUser ($stageId)
 
 isValid ($stageId)
 
 getNotificationMode ($stageId)
 
 getRecordService ()
 

Public Attributes

const TABLE_STAGE = 'sys_workspace_stage'
 
const STAGE_PUBLISH_EXECUTE_ID = -20
 
const STAGE_PUBLISH_ID = -10
 
const STAGE_EDIT_ID = 0
 
const MODE_NOTIFY_SOMEONE = 0
 
const MODE_NOTIFY_ALL = 1
 
const MODE_NOTIFY_ALL_STRICT = 2
 

Protected Member Functions

 prepareStagesArray (array $stageRecords)
 
 getWorkspaceRecord ()
 
 isStageAllowedForUser ($stageId)
 
 getBackendUser ()
 
 getDatabaseConnection ()
 

Protected Attributes

 $recordService
 
 $workspaceStageCache = []
 
 $workspaceStageAllowedCache = []
 
 $fetchGroupsCache = []
 
 $userGroups = []
 

Private Member Functions

 fetchGroups ($grList, $idList='')
 
 fetchGroupsFromDB (array $groups)
 
 fetchGroupsRecursive ($grList, $idList='')
 

Private Attributes

 $pathToLocallang = 'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf'
 

Detailed Description

Stages service

Definition at line 26 of file StagesService.php.

Member Function Documentation

◆ fetchGroups()

TYPO3\CMS\Workspaces\Service\StagesService::fetchGroups (   $grList,
  $idList = '' 
)
private

◆ fetchGroupsFromDB()

TYPO3\CMS\Workspaces\Service\StagesService::fetchGroupsFromDB ( array  $groups)
private
Parameters
array$groups
Returns
void

Definition at line 579 of file StagesService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Workspaces\Service\StagesService\fetchGroupsRecursive().

◆ fetchGroupsRecursive()

TYPO3\CMS\Workspaces\Service\StagesService::fetchGroupsRecursive (   $grList,
  $idList = '' 
)
private

◆ getBackendUser()

TYPO3\CMS\Workspaces\Service\StagesService::getBackendUser ( )
protected
Returns

Definition at line 813 of file StagesService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Workspaces\Service\StagesService\getWorkspaceId().

◆ getBackendUsers()

TYPO3\CMS\Workspaces\Service\StagesService::getBackendUsers (   $backendUserList)

◆ getDatabaseConnection()

TYPO3\CMS\Workspaces\Service\StagesService::getDatabaseConnection ( )
protected
Returns

Definition at line 821 of file StagesService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Workspaces\Service\StagesService\getBackendUsers().

◆ getNextStage()

TYPO3\CMS\Workspaces\Service\StagesService::getNextStage (   $stageId)

◆ getNextStageForElementCollection()

TYPO3\CMS\Workspaces\Service\StagesService::getNextStageForElementCollection (   $workspaceItems,
array  $byTableName = ['tt_content',
'pages'  ,
'pages_language_overlay']   
)

Retrieve the next stage based on the lowest stage given in the $workspaceItems record array.

Parameters
array$workspaceItems
array$byTableName
Returns
array Current and next possible stage.

Definition at line 137 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\getNextStage(), TYPO3\CMS\Workspaces\Service\StagesService\getStagesForWS(), and TYPO3\CMS\Workspaces\Service\StagesService\isStageAllowedForUser().

◆ getNextStages()

TYPO3\CMS\Workspaces\Service\StagesService::getNextStages ( array &  $nextStageArray,
  $stageId 
)

Recursive function to get all next stages for a record depending on user permissions

Parameters
array$nextStageArrayNext stages
int$stageIdCurrent stage id of the record
Returns
array Next stages

Definition at line 342 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\getNextStage(), and TYPO3\CMS\Workspaces\Service\StagesService\isStageAllowedForUser().

◆ getNotificationMode()

TYPO3\CMS\Workspaces\Service\StagesService::getNotificationMode (   $stageId)

Returns the notification mode from stage configuration

Return values: 0 = notify someone / old way / default setting 1 = notify all responsible users (some users checked per default and you're not allowed to uncheck them) 2 = notify all responsible users (all users are checked and nothing can be changed during stage change)

Parameters
int$stageIdStage id to return the notification mode for
Returns
int
Exceptions

Definition at line 774 of file StagesService.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecord(), TYPO3\CMS\Workspaces\Service\StagesService\getWorkspaceId(), and TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction().

◆ getPositionOfCurrentStage()

TYPO3\CMS\Workspaces\Service\StagesService::getPositionOfCurrentStage (   $stageId)

Gets the position of the given workspace in the hole process f.e. 3 means step 3 of 20, by which 1 is edit and 20 is ready to publish

Parameters
int$stageId
Returns
array position => 3, count => 20

Definition at line 658 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\getStagesForWS().

◆ getPreselectedRecipients()

TYPO3\CMS\Workspaces\Service\StagesService::getPreselectedRecipients ( StageRecord  $stageRecord)

◆ getPreviousStageForElementCollection()

TYPO3\CMS\Workspaces\Service\StagesService::getPreviousStageForElementCollection (   $workspaceItems,
array  $byTableName = ['tt_content',
'pages'  ,
'pages_language_overlay']   
)

Find the highest possible "previous" stage for all $byTableName

Parameters
array$workspaceItems
array$byTableName
Returns
array Current and next highest possible stage

Definition at line 89 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\getPrevStage(), TYPO3\CMS\Workspaces\Service\StagesService\getStagesForWS(), and TYPO3\CMS\Workspaces\Service\StagesService\isStageAllowedForUser().

◆ getPrevStage()

TYPO3\CMS\Workspaces\Service\StagesService::getPrevStage (   $stageId)

◆ getPrevStages()

TYPO3\CMS\Workspaces\Service\StagesService::getPrevStages ( array &  $prevStageArray,
  $stageId 
)

Recursive function to get all prev stages for a record depending on user permissions

Parameters
array$prevStageArrayPrev stages
int$stageIdCurrent stage id of the record
Returns
array prev stages

Definition at line 403 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\getPrevStage(), and TYPO3\CMS\Workspaces\Service\StagesService\isStageAllowedForUser().

◆ getPropertyOfCurrentWorkspaceStage()

TYPO3\CMS\Workspaces\Service\StagesService::getPropertyOfCurrentWorkspaceStage (   $stageId,
  $property 
)

Gets a property of a workspaces stage.

Parameters
int$stageId
string$property
Returns
string
Exceptions

Definition at line 638 of file StagesService.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger(), and TYPO3\CMS\Backend\Utility\BackendUtility\getRecord().

Referenced by TYPO3\CMS\Workspaces\Service\StagesService\getStageTitle().

◆ getRecordService()

◆ getResponsibleBeUser()

TYPO3\CMS\Workspaces\Service\StagesService::getResponsibleBeUser (   $stageRecord,
  $selectDefaultUserField = false 
)

Gets all backend user records that are considered to be responsible for a particular stage or workspace.

Parameters
StageRecord | int$stageRecordStage
bool$selectDefaultUserFieldIf field notification_defaults should be selected instead of responsible users
Returns
array be_users with e-mail and name

Definition at line 429 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\getBackendUsers(), and TYPO3\CMS\Workspaces\Service\StagesService\getWorkspaceRecord().

◆ getResponsibleUser()

TYPO3\CMS\Workspaces\Service\StagesService::getResponsibleUser (   $stageRespValue)

Gets backend user ids from a mixed list of backend users and backend users groups. This is used for notifying persons responsible for a particular stage or workspace.

Parameters
string$stageRespValueResponsible_person value from stage record
Returns
string List of backend user ids

Definition at line 459 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\resolveBackendUserIds().

◆ getStageRecord()

TYPO3\CMS\Workspaces\Service\StagesService::getStageRecord (   $stageid)

Gets a particular stage record.

Parameters
int$stageid
Returns
array

Definition at line 294 of file StagesService.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\getRecord().

◆ getStagesForWS()

◆ getStageTitle()

TYPO3\CMS\Workspaces\Service\StagesService::getStageTitle (   $ver_stage)

Gets the title of a stage.

Parameters
int$ver_stage
Returns
string

Definition at line 266 of file StagesService.php.

References $GLOBALS, and TYPO3\CMS\Workspaces\Service\StagesService\getPropertyOfCurrentWorkspaceStage().

◆ getWorkspaceId()

◆ getWorkspaceRecord()

◆ isNextStageAllowedForUser()

TYPO3\CMS\Workspaces\Service\StagesService::isNextStageAllowedForUser (   $stageId)

Check if the user has access to the next stage, relative to the given stage

Parameters
int$stageId
Returns
bool

Definition at line 709 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\getNextStage(), and TYPO3\CMS\Workspaces\Service\StagesService\isStageAllowedForUser().

◆ isPrevStageAllowedForUser()

TYPO3\CMS\Workspaces\Service\StagesService::isPrevStageAllowedForUser (   $stageId)

Check if the user has access to the previous stage, relative to the given stage

Parameters
int$stageId
Returns
bool

Definition at line 687 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\getPrevStage(), and TYPO3\CMS\Workspaces\Service\StagesService\isStageAllowedForUser().

◆ isStageAllowedForUser()

◆ isValid()

TYPO3\CMS\Workspaces\Service\StagesService::isValid (   $stageId)

Determines whether a stage Id is valid.

Parameters
int$stageIdThe stage Id to be checked
Returns
bool

Definition at line 748 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\getStagesForWS().

◆ prepareStagesArray()

TYPO3\CMS\Workspaces\Service\StagesService::prepareStagesArray ( array  $stageRecords)
protected

Prepares simplified stages array to be used in ExtJs components.

Parameters
StageRecord[]$stageRecords
Returns
array

Definition at line 242 of file StagesService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Workspaces\Service\StagesService\getStagesForWS().

◆ resolveBackendUserIds()

TYPO3\CMS\Workspaces\Service\StagesService::resolveBackendUserIds (   $backendUserGroupList)

Resolves backend user ids from a mixed list of backend users and backend user groups (e.g. "be_users_1,be_groups_3,be_users_4,...")

Parameters
string$backendUserGroupList
Returns
array

Definition at line 471 of file StagesService.php.

References TYPO3\CMS\Workspaces\Service\StagesService\fetchGroups(), TYPO3\CMS\Backend\Utility\BackendUtility\getUserNames(), TYPO3\CMS\Core\Utility\GeneralUtility\inList(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Workspaces\Service\StagesService\getResponsibleUser().

Member Data Documentation

◆ $fetchGroupsCache

TYPO3\CMS\Workspaces\Service\StagesService::$fetchGroupsCache = []
protected

Definition at line 65 of file StagesService.php.

◆ $pathToLocallang

TYPO3\CMS\Workspaces\Service\StagesService::$pathToLocallang = 'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf'
private

Definition at line 43 of file StagesService.php.

◆ $recordService

TYPO3\CMS\Workspaces\Service\StagesService::$recordService
protected

◆ $userGroups

TYPO3\CMS\Workspaces\Service\StagesService::$userGroups = []
protected

◆ $workspaceStageAllowedCache

TYPO3\CMS\Workspaces\Service\StagesService::$workspaceStageAllowedCache = []
protected

Definition at line 60 of file StagesService.php.

◆ $workspaceStageCache

TYPO3\CMS\Workspaces\Service\StagesService::$workspaceStageCache = []
protected

Definition at line 55 of file StagesService.php.

◆ MODE_NOTIFY_ALL

const TYPO3\CMS\Workspaces\Service\StagesService::MODE_NOTIFY_ALL = 1

Definition at line 35 of file StagesService.php.

◆ MODE_NOTIFY_ALL_STRICT

const TYPO3\CMS\Workspaces\Service\StagesService::MODE_NOTIFY_ALL_STRICT = 2

Definition at line 36 of file StagesService.php.

◆ MODE_NOTIFY_SOMEONE

const TYPO3\CMS\Workspaces\Service\StagesService::MODE_NOTIFY_SOMEONE = 0

Definition at line 34 of file StagesService.php.

◆ STAGE_EDIT_ID

◆ STAGE_PUBLISH_EXECUTE_ID

◆ STAGE_PUBLISH_ID

◆ TABLE_STAGE

const TYPO3\CMS\Workspaces\Service\StagesService::TABLE_STAGE = 'sys_workspace_stage'

Definition at line 28 of file StagesService.php.