StagesService
class \
- Implements
- SingletonInterface
Stages service
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Constants
- STAGE_EDIT_ID : mixed = 0
- STAGE_PUBLISH_EXECUTE_ID : mixed = -20
- STAGE_PUBLISH_ID : mixed = -10
- TABLE_STAGE : mixed = 'sys_workspace_stage'
Properties
- $recordService : RecordService|null
- $workspaceStageAllowedCache : array
- $workspaceStageCache : array
- Local cache to reduce number of database queries for stages, groups, etc.
Methods
- getBackendUsers() : array
- Gets backend user records from a given list of ids.
- getNextStage() : array
- Gets next stage in process for given stage id
- getNextStageForElementCollection() : array
- Retrieve the next stage based on the lowest stage given in the $workspaceItems record array.
- getNextStages() : array
- Recursive function to get all next stages for a record depending on user permissions
- getPositionOfCurrentStage() : array
- 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
- getPreviousStageForElementCollection() : array
- Find the highest possible "previous" stage for all $byTableName
- getPrevStage() : bool|array
- Get next stage in process for given stage id
- getPrevStages() : array
- 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
- Gets all backend user records that are considered to be responsible for a particular stage or workspace.
- getStageRecord() : array|null
- Gets a particular stage record.
- getStagesForWS() : array
- Building an array with all stage ids and titles related to the given workspace
- getStagesForWSUser() : array
- 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
- 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
- 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
$workspaceStageAllowedCache
= []
$workspaceStageCache
Local cache to reduce number of database queries for stages, groups, etc.
protected
array
$workspaceStageCache
= []
Methods
getBackendUsers()
Gets backend user records from a given list of ids.
public
getBackendUsers(string $backendUserList) : array
Parameters
- $backendUserList : string
Return values
arraygetNextStage()
Gets next stage in process for given stage id
public
getNextStage(int $stageId) : array
Parameters
- $stageId : int
-
Id of the stage to fetch the next one for
Tags
Return values
array —The next stage (id + details)
getNextStageForElementCollection()
Retrieve the next stage based on the lowest stage given in the $workspaceItems record array.
public
getNextStageForElementCollection(array $workspaceItems[, array $byTableName = ['tt_content', 'pages'] ]) : array
Parameters
- $workspaceItems : array
- $byTableName : array = ['tt_content', 'pages']
Return values
array —Current and next possible stage.
getNextStages()
Recursive function to get all next stages for a record depending on user permissions
public
getNextStages(array &$nextStageArray, int $stageId) : array
Parameters
- $nextStageArray : array
-
Next stages
- $stageId : int
-
Current stage id of the record
Return values
array —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
Parameters
- $stageId : int
Return values
array —position => 3, count => 20
getPreselectedRecipients()
public
getPreselectedRecipients(StageRecord $stageRecord) : array
Parameters
- $stageRecord : StageRecord
Return values
arraygetPreviousStageForElementCollection()
Find the highest possible "previous" stage for all $byTableName
public
getPreviousStageForElementCollection(array $workspaceItems[, array $byTableName = ['tt_content', 'pages'] ]) : array
Parameters
- $workspaceItems : array
- $byTableName : array = ['tt_content', 'pages']
Return values
array —Current and next highest possible stage
getPrevStage()
Get next stage in process for given stage id
public
getPrevStage(int $stageId) : bool|array
Parameters
- $stageId : int
-
Id of the stage to fetch the previous one for
Tags
Return values
bool|array —The previous stage or false
getPrevStages()
Recursive function to get all prev stages for a record depending on user permissions
public
getPrevStages(array &$prevStageArray, int $stageId) : array
Parameters
- $prevStageArray : array
-
Prev stages
- $stageId : int
-
Current stage id of the record
Return values
array —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
Parameters
- $stageRecord : StageRecord|int
-
Stage
- $selectDefaultUserField : bool = false
-
If field notification_defaults should be selected instead of responsible users
Return values
array —be_users with e-mail and name
getStageRecord()
Gets a particular stage record.
public
getStageRecord(int $stageid) : array|null
Parameters
- $stageid : int
Return values
array|nullgetStagesForWS()
Building an array with all stage ids and titles related to the given workspace
public
getStagesForWS() : array
Return values
array —id and title of the stages
getStagesForWSUser()
Returns an array of stages, the user is allowed to send to
public
getStagesForWSUser() : array
Return values
array —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
Parameters
- $backendUserGroupList : string
Return values
arraygetBackendUser()
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(StageRecord[] $stageRecords) : array
Parameters
- $stageRecords : StageRecord[]