TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Workspaces\Service\WorkspaceService Class Reference
Inheritance diagram for TYPO3\CMS\Workspaces\Service\WorkspaceService:
TYPO3\CMS\Core\SingletonInterface Tx_Workspaces_Service_Workspaces

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 = array()
 
 $versionsOnPageCache = array()
 

Detailed Description

Workspace service

Author
Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)

Definition at line 28 of file WorkspaceService.php.

Member Function Documentation

◆ canCreatePreviewLink()

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

Determine whether this page for the current

Parameters
integer$pageUid
integer$workspaceUid
Returns
boolean

Definition at line 585 of file WorkspaceService.php.

References $GLOBALS, $result, TYPO3\CMS\Core\Type\Enumeration\cast(), TYPO3\CMS\Core\Versioning\VersionState\DELETE_PLACEHOLDER, TYPO3\CMS\Core\Utility\GeneralUtility\inList(), and TYPO3\CMS\Backend\Utility\BackendUtility\workspaceOL().

◆ 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 656 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 49 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
integerReal workspace ID, cannot be ONLINE (zero).
booleanRun Flush (TRUE) or ClearWSID (FALSE) command
integer$pageId,...
integer$languageSelect specific language only
Returns
array Command array for tcemain

Definition at line 159 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
integerReal workspace ID, cannot be ONLINE (zero).
booleanIf set, then the currently online versions are swapped into the workspace in exchange for the offline versions. Otherwise the workspace is emptied.
integer$pageId,...
integer$languageSelect specific language only
Returns
array Command array for tcemain

Definition at line 125 of file WorkspaceService.php.

References 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
integer The current workspace ID

Definition at line 72 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 676 of file WorkspaceService.php.

References $uid.

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

◆ getMoveToPlaceHolderFromPages()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getMoveToPlaceHolderFromPages (   $table,
  $pageList,
  $wsid,
  $filter,
  $stage 
)
protected

◆ getObjectManager()

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

◆ getWorkspaceTitle()

static TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle (   $wsId)
static

◆ hasPageRecordVersions()

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

◆ 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
boolean

Definition at line 467 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
integer$idPrimary key of the page to check
integer$languageLanguage for which to check the page
Returns
boolean

Definition at line 504 of file WorkspaceService.php.

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

◆ 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
boolean

Definition at line 482 of file WorkspaceService.php.

References $GLOBALS.

◆ 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 446 of file WorkspaceService.php.

References $GLOBALS, 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
integerWorkspace ID. If -99, will select ALL versions from ANY workspace. If -98 will select all but ONLINE. >=-1 will select from the actual workspace
integerLifecycle filter: 1 = select all drafts (never-published), 2 = select all published one or more times (archive/multiple), anything else selects all.
integerStage filter: -99 means no filtering, otherwise it will be used to select only elements with that stage. For publishing, that would be "10
integerPage id: Live page for which to find versions in workspace!
integerRecursion Level - select versions recursive - parameter is only relevant if $pageId != -1
stringHow to collect records for "listing" or "modify" these tables. Support the permissions of each type of record, see ::check.
integer$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 = array()
protected

Definition at line 33 of file WorkspaceService.php.

◆ $versionsOnPageCache

TYPO3\CMS\Workspaces\Service\WorkspaceService::$versionsOnPageCache = array()
protected

Definition at line 38 of file WorkspaceService.php.

◆ LIVE_WORKSPACE_ID

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

◆ SELECT_ALL_WORKSPACES

const TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES = -98

◆ TABLE_WORKSPACE

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

Definition at line 40 of file WorkspaceService.php.