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

Public Member Functions

 getAvailableWorkspaces ()
 
 getCurrentWorkspace ()
 
 getCmdArrayForPublishWS ($wsid, $doSwap, $pageId=0, $language=null)
 
 getCmdArrayForFlushWS ($wsid, $flush=true, $pageId=0, $language=null)
 
 selectVersionsInWorkspace ($wsid, $filter=0, $stage=-99, $pageId=-1, $recursionLevel=0, $selectionType='tables_select', $language=null)
 
 canCreatePreviewLink ($pageUid, $workspaceUid)
 
 generateWorkspacePreviewLink ($uid)
 
 generateWorkspacePreviewLinksForAllLanguages ($uid)
 
 getLivePageUid ($uid)
 
 hasPageRecordVersions ($workspace, $pageId)
 

Static Public Member Functions

static getWorkspaceTitle ($wsId)
 
static isOldStyleWorkspaceUsed ()
 
static isNewPage ($id, $language=0)
 
static viewSingleRecord ($table, $uid, array $liveRecord=null, array $versionRecord=null)
 

Public Attributes

const TABLE_WORKSPACE = 'sys_workspace'
 
const SELECT_ALL_WORKSPACES = -98
 
const LIVE_WORKSPACE_ID = 0
 

Protected Member Functions

 selectAllVersionsFromPages ($table, $pageList, $wsid, $filter, $stage, $language=null)
 
 getMoveToPlaceHolderFromPages ($table, $pageList, $wsid, $filter, $stage)
 
 filterPermittedElements ($recs, $table)
 
 isPageAccessibleForCurrentUser ($table, array $record)
 
 isLanguageAccessibleForCurrentUser ($table, array $record)
 
 getDatabaseConnection ()
 
 getObjectManager ()
 

Protected Attributes

 $pageCache = []
 
 $versionsOnPageCache = []
 

Detailed Description

Workspace service

Definition at line 26 of file WorkspaceService.php.

Member Function Documentation

◆ canCreatePreviewLink()

TYPO3\CMS\Workspaces\Service\WorkspaceService::canCreatePreviewLink (   $pageUid,
  $workspaceUid 
)

◆ filterPermittedElements()

TYPO3\CMS\Workspaces\Service\WorkspaceService::filterPermittedElements (   $recs,
  $table 
)
protected

◆ generateWorkspacePreviewLink()

◆ generateWorkspacePreviewLinksForAllLanguages()

TYPO3\CMS\Workspaces\Service\WorkspaceService::generateWorkspacePreviewLinksForAllLanguages (   $uid)

Generate workspace preview links for all available languages of a page

Parameters
int$uid
Returns
array

Definition at line 683 of file WorkspaceService.php.

References $uid, and TYPO3\CMS\Workspaces\Service\WorkspaceService\generateWorkspacePreviewLink().

◆ getAvailableWorkspaces()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getAvailableWorkspaces ( )

retrieves the available workspaces from the database and checks whether they're available to the current BE user

Returns
array array of worspaces available to the current user

Definition at line 47 of file WorkspaceService.php.

References $GLOBALS, and TYPO3\CMS\Backend\Utility\BackendUtility\deleteClause().

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\getCurrentWorkspace().

◆ getCmdArrayForFlushWS()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getCmdArrayForFlushWS (   $wsid,
  $flush = true,
  $pageId = 0,
  $language = null 
)

Building tcemain CMD-array for releasing all versions in a workspace.

Parameters
int$wsidReal workspace ID, cannot be ONLINE (zero).
bool$flushRun Flush (TRUE) or ClearWSID (FALSE) command
int$pageIdThe page id
int$languageSelect specific language only
Returns
array Command array for tcemain

Definition at line 158 of file WorkspaceService.php.

References TYPO3\CMS\Workspaces\Service\WorkspaceService\selectVersionsInWorkspace().

◆ getCmdArrayForPublishWS()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getCmdArrayForPublishWS (   $wsid,
  $doSwap,
  $pageId = 0,
  $language = null 
)

Building tcemain CMD-array for swapping all versions in a workspace.

Parameters
int$wsidReal workspace ID, cannot be ONLINE (zero).
bool$doSwapIf set, then the currently online versions are swapped into the workspace in exchange for the offline versions. Otherwise the workspace is emptied.
int$pageIdThe page id
int$languageSelect specific language only
Returns
array Command array for tcemain

Definition at line 123 of file WorkspaceService.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\getRecord(), TYPO3\CMS\Workspaces\Service\WorkspaceService\selectVersionsInWorkspace(), and TYPO3\CMS\Workspaces\Service\StagesService\STAGE_PUBLISH_ID.

◆ getCurrentWorkspace()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getCurrentWorkspace ( )

Gets the current workspace ID.

Returns
int The current workspace ID

Definition at line 71 of file WorkspaceService.php.

References $GLOBALS, and TYPO3\CMS\Workspaces\Service\WorkspaceService\getAvailableWorkspaces().

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\generateWorkspacePreviewLink().

◆ getDatabaseConnection()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getDatabaseConnection ( )
protected

◆ getLivePageUid()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getLivePageUid (   $uid)

Find the Live-Uid for a given page, the results are cached at run-time to avoid too many database-queries

Exceptions

Definition at line 704 of file WorkspaceService.php.

References $uid, and TYPO3\CMS\Backend\Utility\BackendUtility\getRecord().

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\generateWorkspacePreviewLink().

◆ getMoveToPlaceHolderFromPages()

◆ getObjectManager()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getObjectManager ( )
protected

◆ getWorkspaceTitle()

◆ hasPageRecordVersions()

TYPO3\CMS\Workspaces\Service\WorkspaceService::hasPageRecordVersions (   $workspace,
  $pageId 
)

Checks if a page has record versions according to a given workspace

Parameters
int$workspace
int$pageId
Returns
bool

Definition at line 724 of file WorkspaceService.php.

References $GLOBALS, TYPO3\CMS\Backend\Utility\BackendUtility\deleteClause(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getDatabaseConnection(), and TYPO3\CMS\Core\Versioning\VersionState\MOVE_POINTER.

◆ isLanguageAccessibleForCurrentUser()

TYPO3\CMS\Workspaces\Service\WorkspaceService::isLanguageAccessibleForCurrentUser (   $table,
array  $record 
)
protected

Check current be users language access on given record.

Parameters
string$tableName of the table
array$recordRecord row to be checked
Returns
bool

Definition at line 471 of file WorkspaceService.php.

References $GLOBALS, and TYPO3\CMS\Backend\Utility\BackendUtility\isTableLocalizable().

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\filterPermittedElements().

◆ isNewPage()

static TYPO3\CMS\Workspaces\Service\WorkspaceService::isNewPage (   $id,
  $language = 0 
)
static

Determine whether a specific page is new and not yet available in the LIVE workspace

Parameters
int$idPrimary key of the page to check
int$languageLanguage for which to check the page
Returns
bool

Definition at line 509 of file WorkspaceService.php.

References $GLOBALS, TYPO3\CMS\Core\Type\Enumeration\cast(), TYPO3\CMS\Backend\Utility\BackendUtility\deleteClause(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecord(), and TYPO3\CMS\Core\Versioning\VersionState\NEW_PLACEHOLDER.

Referenced by TYPO3\CMS\Workspaces\Controller\PreviewController\initializeAction().

◆ isOldStyleWorkspaceUsed()

static TYPO3\CMS\Workspaces\Service\WorkspaceService::isOldStyleWorkspaceUsed ( )
static

Trivial check to see if the user already migrated his workspaces to the new style (either manually or with the migrator scripts)

Returns
bool

Definition at line 487 of file WorkspaceService.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Workspaces\Controller\ReviewController\singleIndexAction().

◆ isPageAccessibleForCurrentUser()

TYPO3\CMS\Workspaces\Service\WorkspaceService::isPageAccessibleForCurrentUser (   $table,
array  $record 
)
protected

Checking access to the page the record is on, respecting ignored root level restrictions

Parameters
string$tableName of the table
array$recordRecord row to be checked
Returns
bool

Definition at line 449 of file WorkspaceService.php.

References $GLOBALS, TYPO3\CMS\Backend\Utility\BackendUtility\getRecord(), and TYPO3\CMS\Backend\Utility\BackendUtility\isRootLevelRestrictionIgnored().

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\filterPermittedElements().

◆ selectAllVersionsFromPages()

TYPO3\CMS\Workspaces\Service\WorkspaceService::selectAllVersionsFromPages (   $table,
  $pageList,
  $wsid,
  $filter,
  $stage,
  $language = null 
)
protected

◆ selectVersionsInWorkspace()

TYPO3\CMS\Workspaces\Service\WorkspaceService::selectVersionsInWorkspace (   $wsid,
  $filter = 0,
  $stage = -99,
  $pageId = -1,
  $recursionLevel = 0,
  $selectionType = 'tables_select',
  $language = null 
)

Select all records from workspace pending for publishing Used from backend to display workspace overview User for auto-publishing for selecting versions for publication

Parameters
int$wsidWorkspace ID. If -99, will select ALL versions from ANY workspace. If -98 will select all but ONLINE. >=-1 will select from the actual workspace
int$filterLifecycle filter: 1 = select all drafts (never-published), 2 = select all published one or more times (archive/multiple), anything else selects all.
int$stageStage filter: -99 means no filtering, otherwise it will be used to select only elements with that stage. For publishing, that would be "10
int$pageIdPage id: Live page for which to find versions in workspace!
int$recursionLevelRecursion Level - select versions recursive - parameter is only relevant if $pageId != -1
string$selectionTypeHow to collect records for "listing" or "modify" these tables. Support the permissions of each type of record, see ::check.
int$languageSelect specific language only
Returns
array Array of all records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid and t3ver_oidfields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid

Definition at line 192 of file WorkspaceService.php.

References $GLOBALS, TYPO3\CMS\Workspaces\Service\WorkspaceService\filterPermittedElements(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getMoveToPlaceHolderFromPages(), and TYPO3\CMS\Workspaces\Service\WorkspaceService\selectAllVersionsFromPages().

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\getCmdArrayForFlushWS(), and TYPO3\CMS\Workspaces\Service\WorkspaceService\getCmdArrayForPublishWS().

◆ viewSingleRecord()

static TYPO3\CMS\Workspaces\Service\WorkspaceService::viewSingleRecord (   $table,
  $uid,
array  $liveRecord = null,
array  $versionRecord = null 
)
static

Member Data Documentation

◆ $pageCache

TYPO3\CMS\Workspaces\Service\WorkspaceService::$pageCache = []
protected

Definition at line 31 of file WorkspaceService.php.

◆ $versionsOnPageCache

TYPO3\CMS\Workspaces\Service\WorkspaceService::$versionsOnPageCache = []
protected

Definition at line 36 of file WorkspaceService.php.

◆ LIVE_WORKSPACE_ID

const TYPO3\CMS\Workspaces\Service\WorkspaceService::LIVE_WORKSPACE_ID = 0

◆ SELECT_ALL_WORKSPACES

◆ TABLE_WORKSPACE

const TYPO3\CMS\Workspaces\Service\WorkspaceService::TABLE_WORKSPACE = 'sys_workspace'

Definition at line 38 of file WorkspaceService.php.