StagesService implements SingletonInterface
Stages service
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Constants
- STAGE_EDIT_ID = 0
- STAGE_PUBLISH_EXECUTE_ID = -20
- STAGE_PUBLISH_ID = -10
- TABLE_STAGE = 'sys_workspace_stage'
Properties
- $recordService : RecordService|null
- $workspaceStageAllowedCache : array<string|int, mixed>
- $workspaceStageCache : array<string|int, mixed>
- Local cache to reduce number of database queries for stages, groups, etc.
Methods
- getBackendUsers() : array<string|int, mixed>
- Gets backend user records from a given list of ids.
- getNextStage() : array<string|int, mixed>
- Gets next stage in process for given stage id
- getNextStageForElementCollection() : array<string|int, mixed>
- Retrieve the next stage based on the lowest stage given in the $workspaceItems record array.
- getNextStages() : array<string|int, mixed>
- Recursive function to get all next stages for a record depending on user permissions
- getPositionOfCurrentStage() : array<string|int, mixed>
- 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
- getPreselectedRecipients() : array<string|int, mixed>
- getPreviousStageForElementCollection() : array<string|int, mixed>
- Find the highest possible "previous" stage for all $byTableName
- getPrevStage() : bool|array<string|int, mixed>
- Get next stage in process for given stage id
- getPrevStages() : array<string|int, mixed>
- Recursive function to get all prev stages for a record depending on user permissions
- getPropertyOfCurrentWorkspaceStage() : string
- Gets a property of a workspaces stage.
- getRecordService() : RecordService
- getResponsibleBeUser() : array<string|int, mixed>
- Gets all backend user records that are considered to be responsible for a particular stage or workspace.
- getStageRecord() : array<string|int, mixed>|null
- Gets a particular stage record.
- getStagesForWS() : array<string|int, mixed>
- Building an array with all stage ids and titles related to the given workspace
- getStagesForWSUser() : array<string|int, mixed>
- Returns an array of stages, the user is allowed to send to
- getStageTitle() : string
- Gets the title of a stage.
- getWorkspaceId() : int
- Getter for current workspace id
- isNextStageAllowedForUser() : bool
- Check if the user has access to the next stage, relative to the given stage
- isPrevStageAllowedForUser() : bool
- Check if the user has access to the previous stage, relative to the given stage
- isValid() : bool
- Determines whether a stage Id is valid.
- resolveBackendUserIds() : array<string|int, mixed>
- 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,...")
- getBackendUser() : BackendUserAuthentication
- getLanguageService() : LanguageService|null
- getWorkspaceRecord() : WorkspaceRecord
- isStageAllowedForUser() : bool
- prepareStagesArray() : array<string|int, mixed>
- Prepares simplified stages array
Constants
STAGE_EDIT_ID
public
mixed
STAGE_EDIT_ID
= 0
STAGE_PUBLISH_EXECUTE_ID
public
mixed
STAGE_PUBLISH_EXECUTE_ID
= -20
STAGE_PUBLISH_ID
public
mixed
STAGE_PUBLISH_ID
= -10
TABLE_STAGE
public
mixed
TABLE_STAGE
= 'sys_workspace_stage'
Properties
$recordService
protected
RecordService|null
$recordService
$workspaceStageAllowedCache
protected
array<string|int, mixed>
$workspaceStageAllowedCache
= []
$workspaceStageCache
Local cache to reduce number of database queries for stages, groups, etc.
protected
array<string|int, mixed>
$workspaceStageCache
= []
Methods
getBackendUsers()
Gets backend user records from a given list of ids.
public
getBackendUsers(string $backendUserList) : array<string|int, mixed>
Parameters
- $backendUserList : string
Return values
array<string|int, mixed>getNextStage()
Gets next stage in process for given stage id
public
getNextStage(int $stageId) : array<string|int, mixed>
Parameters
- $stageId : int
-
Id of the stage to fetch the next one for
Tags
Return values
array<string|int, mixed> —The next stage (id + details)
getNextStageForElementCollection()
Retrieve the next stage based on the lowest stage given in the $workspaceItems record array.
public
getNextStageForElementCollection(array<string|int, mixed> $workspaceItems[, array<string|int, mixed> $byTableName = ['tt_content', 'pages'] ]) : array<string|int, mixed>
Parameters
- $workspaceItems : array<string|int, mixed>
- $byTableName : array<string|int, mixed> = ['tt_content', 'pages']
Return values
array<string|int, mixed> —Current and next possible stage.
getNextStages()
Recursive function to get all next stages for a record depending on user permissions
public
getNextStages(array<string|int, mixed> &$nextStageArray, int $stageId) : array<string|int, mixed>
Parameters
- $nextStageArray : array<string|int, mixed>
-
Next stages
- $stageId : int
-
Current stage id of the record
Return values
array<string|int, mixed> —Next stages
getPositionOfCurrentStage()
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
public
getPositionOfCurrentStage(int $stageId) : array<string|int, mixed>
Parameters
- $stageId : int
Return values
array<string|int, mixed> —position => 3, count => 20
getPreselectedRecipients()
public
getPreselectedRecipients(StageRecord $stageRecord) : array<string|int, mixed>
Parameters
- $stageRecord : StageRecord
Return values
array<string|int, mixed>getPreviousStageForElementCollection()
Find the highest possible "previous" stage for all $byTableName
public
getPreviousStageForElementCollection(array<string|int, mixed> $workspaceItems[, array<string|int, mixed> $byTableName = ['tt_content', 'pages'] ]) : array<string|int, mixed>
Parameters
- $workspaceItems : array<string|int, mixed>
- $byTableName : array<string|int, mixed> = ['tt_content', 'pages']
Return values
array<string|int, mixed> —Current and next highest possible stage
getPrevStage()
Get next stage in process for given stage id
public
getPrevStage(int $stageId) : bool|array<string|int, mixed>
Parameters
- $stageId : int
-
Id of the stage to fetch the previous one for
Tags
Return values
bool|array<string|int, mixed> —The previous stage or false
getPrevStages()
Recursive function to get all prev stages for a record depending on user permissions
public
getPrevStages(array<string|int, mixed> &$prevStageArray, int $stageId) : array<string|int, mixed>
Parameters
- $prevStageArray : array<string|int, mixed>
-
Prev stages
- $stageId : int
-
Current stage id of the record
Return values
array<string|int, mixed> —prev stages
getPropertyOfCurrentWorkspaceStage()
Gets a property of a workspaces stage.
public
getPropertyOfCurrentWorkspaceStage(int $stageId, string $property) : string
Parameters
- $stageId : int
- $property : string
Tags
Return values
stringgetRecordService()
public
getRecordService() : RecordService
Return values
RecordServicegetResponsibleBeUser()
Gets all backend user records that are considered to be responsible for a particular stage or workspace.
public
getResponsibleBeUser(StageRecord|int $stageRecord[, bool $selectDefaultUserField = false ]) : array<string|int, mixed>
Parameters
- $stageRecord : StageRecord|int
-
Stage
- $selectDefaultUserField : bool = false
-
If field notification_defaults should be selected instead of responsible users
Return values
array<string|int, mixed> —be_users with e-mail and name
getStageRecord()
Gets a particular stage record.
public
getStageRecord(int $stageid) : array<string|int, mixed>|null
Parameters
- $stageid : int
Return values
array<string|int, mixed>|nullgetStagesForWS()
Building an array with all stage ids and titles related to the given workspace
public
getStagesForWS() : array<string|int, mixed>
Return values
array<string|int, mixed> —id and title of the stages
getStagesForWSUser()
Returns an array of stages, the user is allowed to send to
public
getStagesForWSUser() : array<string|int, mixed>
Return values
array<string|int, mixed> —id and title of stages
getStageTitle()
Gets the title of a stage.
public
getStageTitle(int $ver_stage) : string
Parameters
- $ver_stage : int
Return values
stringgetWorkspaceId()
Getter for current workspace id
public
getWorkspaceId() : int
Return values
intisNextStageAllowedForUser()
Check if the user has access to the next stage, relative to the given stage
public
isNextStageAllowedForUser(int $stageId) : bool
Parameters
- $stageId : int
Return values
boolisPrevStageAllowedForUser()
Check if the user has access to the previous stage, relative to the given stage
public
isPrevStageAllowedForUser(int $stageId) : bool
Parameters
- $stageId : int
Return values
boolisValid()
Determines whether a stage Id is valid.
public
isValid(int $stageId) : bool
Parameters
- $stageId : int
-
The stage Id to be checked
Return values
boolresolveBackendUserIds()
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,...")
public
resolveBackendUserIds(string $backendUserGroupList) : array<string|int, mixed>
Parameters
- $backendUserGroupList : string
Return values
array<string|int, mixed>getBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetLanguageService()
protected
getLanguageService() : LanguageService|null
Return values
LanguageService|nullgetWorkspaceRecord()
protected
getWorkspaceRecord() : WorkspaceRecord
Return values
WorkspaceRecordisStageAllowedForUser()
protected
isStageAllowedForUser(int $stageId) : bool
Parameters
- $stageId : int
Return values
boolprepareStagesArray()
Prepares simplified stages array
protected
prepareStagesArray(array<string|int, StageRecord> $stageRecords) : array<string|int, mixed>
Parameters
- $stageRecords : array<string|int, StageRecord>