TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
StagesService Class Reference
Inheritance diagram for StagesService:
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)
 
 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 ()
 

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 28 of file StagesService.php.

Member Function Documentation

fetchGroups (   $grList,
  $idList = '' 
)
private
Parameters
$grList
string$idList
Returns
array

Definition at line 564 of file StagesService.php.

References StagesService\fetchGroupsRecursive().

Referenced by StagesService\fetchGroupsRecursive(), and StagesService\resolveBackendUserIds().

fetchGroupsFromDB ( array  $groups)
private
Parameters
array$groups
Returns
void

Definition at line 585 of file StagesService.php.

References GeneralUtility\makeInstance().

Referenced by StagesService\fetchGroupsRecursive().

fetchGroupsRecursive (   $grList,
  $idList = '' 
)
private

Fetches particular groups recursively.

Parameters
$grList
string$idList
Returns
array

Definition at line 613 of file StagesService.php.

References $GLOBALS, StagesService\$userGroups, StagesService\fetchGroups(), StagesService\fetchGroupsFromDB(), GeneralUtility\inList(), and GeneralUtility\intExplode().

Referenced by StagesService\fetchGroups().

getBackendUser ( )
protected
Returns

Definition at line 794 of file StagesService.php.

References $GLOBALS.

Referenced by StagesService\getWorkspaceId().

getBackendUsers (   $backendUserList)

Gets backend user records from a given list of ids.

Parameters
string$backendUserList
Returns
array

Definition at line 517 of file StagesService.php.

References BackendUtility\BEenableFields(), BackendUtility\getUserNames(), and GeneralUtility\intExplode().

Referenced by StagesService\getResponsibleBeUser().

getNextStage (   $stageId)

Gets next stage in process for given stage id

Parameters
int$stageIdId of the stage to fetch the next one for
Returns
int The next stage Id
Exceptions
InvalidArgumentException

Definition at line 307 of file StagesService.php.

References $GLOBALS, MathUtility\canBeInterpretedAsInteger(), and StagesService\getStagesForWS().

Referenced by StagesService\getNextStageForElementCollection(), StagesService\getNextStages(), and StagesService\isNextStageAllowedForUser().

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 139 of file StagesService.php.

References StagesService\getNextStage(), StagesService\getStagesForWS(), and StagesService\isStageAllowedForUser().

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 345 of file StagesService.php.

References StagesService\getNextStage(), and StagesService\isStageAllowedForUser().

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 677 of file StagesService.php.

References StagesService\getStagesForWS().

getPreselectedRecipients ( StageRecord  $stageRecord)
Parameters
StageRecord$stageRecord
Returns
array

Definition at line 539 of file StagesService.php.

References StageRecord\areEditorsPreselected(), StageRecord\getPreselectedRecipients(), and StagesService\getRecordService().

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 91 of file StagesService.php.

References StagesService\getPrevStage(), StagesService\getStagesForWS(), and StagesService\isStageAllowedForUser().

getPrevStage (   $stageId)

Get next stage in process for given stage id

Parameters
int$stageIdId of the stage to fetch the previous one for
Returns
int The previous stage Id
Exceptions
InvalidArgumentException

Definition at line 377 of file StagesService.php.

References $GLOBALS, MathUtility\canBeInterpretedAsInteger(), and StagesService\getStagesForWS().

Referenced by StagesService\getPreviousStageForElementCollection(), StagesService\getPrevStages(), and StagesService\isPrevStageAllowedForUser().

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 409 of file StagesService.php.

References StagesService\getPrevStage(), and StagesService\isStageAllowedForUser().

getPropertyOfCurrentWorkspaceStage (   $stageId,
  $property 
)

Gets a property of a workspaces stage.

Parameters
int$stageId
string$property
Returns
string
Exceptions
InvalidArgumentException

Definition at line 654 of file StagesService.php.

References $GLOBALS, MathUtility\canBeInterpretedAsInteger(), and BackendUtility\getRecord().

Referenced by StagesService\getStageTitle().

getRecordService ( )
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 435 of file StagesService.php.

References StagesService\getBackendUsers(), and StagesService\getWorkspaceRecord().

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 465 of file StagesService.php.

References StagesService\resolveBackendUserIds().

getStageRecord (   $stageid)

Gets a particular stage record.

Parameters
int$stageid
Returns
array

Definition at line 295 of file StagesService.php.

References BackendUtility\getRecord().

getStageTitle (   $ver_stage)

Gets the title of a stage.

Parameters
int$ver_stage
Returns
string

Definition at line 268 of file StagesService.php.

References $GLOBALS, and StagesService\getPropertyOfCurrentWorkspaceStage().

getWorkspaceId ( )

Getter for current workspace id

Returns
int Current workspace id

Definition at line 79 of file StagesService.php.

References StagesService\getBackendUser().

Referenced by StagesService\getStagesForWS(), StagesService\getWorkspaceRecord(), and StagesService\isStageAllowedForUser().

getWorkspaceRecord ( )
protected
Returns
WorkspaceRecord

Definition at line 554 of file StagesService.php.

References WorkspaceRecord\get(), and StagesService\getWorkspaceId().

Referenced by StagesService\getResponsibleBeUser(), and StagesService\getStagesForWS().

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 728 of file StagesService.php.

References StagesService\getNextStage(), and StagesService\isStageAllowedForUser().

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 706 of file StagesService.php.

References StagesService\getPrevStage(), and StagesService\isStageAllowedForUser().

isValid (   $stageId)

Determines whether a stage Id is valid.

Parameters
int$stageIdThe stage Id to be checked
Returns
bool

Definition at line 767 of file StagesService.php.

References StagesService\getStagesForWS().

prepareStagesArray ( array  $stageRecords)
protected

Prepares simplified stages array to be used in ExtJs components.

Parameters
StageRecord[]$stageRecords
Returns
array

Definition at line 244 of file StagesService.php.

References $GLOBALS.

Referenced by StagesService\getStagesForWS().

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 477 of file StagesService.php.

References StagesService\fetchGroups(), BackendUtility\getUserNames(), GeneralUtility\inList(), and GeneralUtility\trimExplode().

Referenced by StagesService\getResponsibleUser().

Member Data Documentation

$fetchGroupsCache = []
protected

Definition at line 67 of file StagesService.php.

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

Definition at line 45 of file StagesService.php.

$recordService
protected

Definition at line 50 of file StagesService.php.

Referenced by StagesService\getRecordService().

$userGroups = []
protected

Definition at line 72 of file StagesService.php.

Referenced by StagesService\fetchGroupsRecursive().

$workspaceStageAllowedCache = []
protected

Definition at line 62 of file StagesService.php.

$workspaceStageCache = []
protected

Definition at line 57 of file StagesService.php.

const MODE_NOTIFY_ALL = 1

Definition at line 37 of file StagesService.php.

const MODE_NOTIFY_ALL_STRICT = 2

Definition at line 38 of file StagesService.php.

const MODE_NOTIFY_SOMEONE = 0

Definition at line 36 of file StagesService.php.

const STAGE_EDIT_ID = 0
const STAGE_PUBLISH_ID = -10
const TABLE_STAGE = 'sys_workspace_stage'

Definition at line 30 of file StagesService.php.

Referenced by DataHandlerHook\processCmdmap_postProcess().