TYPO3  7.6
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
StagesService Class Reference
Inheritance diagram for StagesService:
SingletonInterface

Public Member Functions

 getWorkspaceId ()
 
 getPreviousStageForElementCollection ($workspaceItems, array $byTableName=array('tt_content', 'pages', 'pages_language_overlay'))
 
 getNextStageForElementCollection ($workspaceItems, array $byTableName=array('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 = array()
 
 $workspaceStageAllowedCache = array()
 
 $fetchGroupsCache = array()
 
 $userGroups = array()
 

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 (   $grList,
  $idList = '' 
)
private
Parameters
$grList
string$idList
Returns
array

Definition at line 556 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 577 of file StagesService.php.

References $GLOBALS.

Referenced by StagesService\fetchGroupsRecursive().

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

Fetches particular groups recursively.

Parameters
$grList
string$idList
Returns
array

Definition at line 595 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 809 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 509 of file StagesService.php.

References BackendUtility\BEenableFields(), StagesService\getDatabaseConnection(), and BackendUtility\getUserNames().

Referenced by StagesService\getResponsibleBeUser().

getDatabaseConnection ( )
protected
Returns

Definition at line 817 of file StagesService.php.

References $GLOBALS.

Referenced by StagesService\getBackendUsers().

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

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

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

getNextStageForElementCollection (   $workspaceItems,
array  $byTableName = array('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 StagesService\getNextStage(), and StagesService\getStagesForWS().

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

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

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
\InvalidArgumentException

Definition at line 771 of file StagesService.php.

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

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

References StagesService\getStagesForWS().

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

Definition at line 531 of file StagesService.php.

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

getPreviousStageForElementCollection (   $workspaceItems,
array  $byTableName = array('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 StagesService\getPrevStage(), and StagesService\getStagesForWS().

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 372 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 401 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 636 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 427 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 457 of file StagesService.php.

References StagesService\resolveBackendUserIds().

getStageRecord (   $stageid)

Gets a particular stage record.

Parameters
int$stageid
Returns
array

Definition at line 292 of file StagesService.php.

References BackendUtility\getRecord().

getStagesForWS ( )
getStageTitle (   $ver_stage)

Gets the title of a stage.

Parameters
int$ver_stage
Returns
string

Definition at line 264 of file StagesService.php.

References $GLOBALS, and StagesService\getPropertyOfCurrentWorkspaceStage().

getWorkspaceId ( )

Getter for current workspace id

Returns
int Current workspace id

Definition at line 77 of file StagesService.php.

References StagesService\getBackendUser().

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

getWorkspaceRecord ( )
protected
Returns
WorkspaceRecord

Definition at line 546 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 707 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 685 of file StagesService.php.

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

isStageAllowedForUser (   $stageId)
protected
isValid (   $stageId)

Determines whether a stage Id is valid.

Parameters
int$stageIdThe stage Id to be checked
Returns
bool

Definition at line 746 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 240 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 469 of file StagesService.php.

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

Referenced by StagesService\getResponsibleUser().

Member Data Documentation

$fetchGroupsCache = array()
protected

Definition at line 65 of file StagesService.php.

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

Definition at line 43 of file StagesService.php.

$recordService
protected

Definition at line 48 of file StagesService.php.

Referenced by StagesService\getRecordService().

$userGroups = array()
protected

Definition at line 70 of file StagesService.php.

Referenced by StagesService\fetchGroupsRecursive().

$workspaceStageAllowedCache = array()
protected

Definition at line 60 of file StagesService.php.

$workspaceStageCache = array()
protected

Definition at line 55 of file StagesService.php.

const MODE_NOTIFY_ALL = 1

Definition at line 35 of file StagesService.php.

const MODE_NOTIFY_ALL_STRICT = 2

Definition at line 36 of file StagesService.php.

const MODE_NOTIFY_SOMEONE = 0

Definition at line 34 of file StagesService.php.

const STAGE_EDIT_ID = 0

Definition at line 33 of file StagesService.php.

Referenced by WorkspaceRecord\getStages(), and StageRecord\isEditStage().

const STAGE_PUBLISH_EXECUTE_ID = -20
const STAGE_PUBLISH_ID = -10

Definition at line 32 of file StagesService.php.

Referenced by WorkspaceRecord\getStages(), and StageRecord\isPublishStage().

const TABLE_STAGE = 'sys_workspace_stage'

Definition at line 28 of file StagesService.php.