com\setasign\SetaSite\Page

Pages

File: /SetaSite/src/Page/Pages.php

Class hierarchy

Summary

Constants

CHANGE_CREATE

public const Pages::CHANGE_CREATE = 1

CHANGE_MOVE

public const Pages::CHANGE_MOVE = 2

CHANGE_UPDATE

public const Pages::CHANGE_UPDATE = 3

EVENT_AFTER_DELETE

public const Pages::EVENT_AFTER_DELETE = 'setasite.pages.after_delete'

Will be called after a page was finally deleted.


Type: Event
extraParams:
'ids' => int[] The page ids of the deleted pages
'language' => string

EVENT_AFTER_RENDER_DATA_SAVE

public const Pages::EVENT_AFTER_RENDER_DATA_SAVE = 'setasite.pages.after_render_data_save'

Will be called after a render data save was executed


Type: PageEvent

EVENT_AFTER_SAVE

public const Pages::EVENT_AFTER_SAVE = 'setasite.pages.after_save'

Will be called after a page and it's changes was successfully saved.


Type: PageEvent
extraParams:
'pageRow' => Row
'newPage' => boolean

EVENT_SAVE

public const Pages::EVENT_SAVE = 'setasite.pages.save'

Will be called when the permission is needed whether the page can be created.


Type: PageEvent
extraParams:
'pageRow' => &Row
'newPage' => boolean

PATHORDER_STEPS

private const Pages::PATHORDER_STEPS = 200

PATH_HOME

public const Pages::PATH_HOME = '/'

PATH_ID_HOME

public const Pages::PATH_ID_HOME = 1

PATH_ID_TEMPLATE

public const Pages::PATH_ID_TEMPLATE = -2

PATH_ID_TRASH

public const Pages::PATH_ID_TRASH = -1

PATH_TEMPLATE

public const Pages::PATH_TEMPLATE = '/_$/templates/'

PATH_TRASH

public const Pages::PATH_TRASH = '/_$/trash/'

Properties

$changesTable

protected \com\setasign\SetaFramework\Database\Table\Table Pages::$changesTable

$changesTableOptions

protected array Pages::$changesTableOptions

$db

protected \com\setasign\SetaFramework\Database\Database Pages::$db

$eventManager

protected \com\setasign\SetaFramework\EventManager\EventManager Pages::$eventManager

$pageHistory

$pageSettings

$pageTable

protected \com\setasign\SetaFramework\Database\JoinedTable\JoinedTable Pages::$pageTable

$pageTableOptions

protected string[] Pages::$pageTableOptions

$propertiesConfig

protected \com\setasign\SetaFramework\Config\Config Pages::$propertiesConfig

Methods

__construct()

public Pages::__construct (
\com\setasign\SetaSite\Block\BlockFactory $blockFactory,
\com\setasign\SetaSite\Config\PageProperties $pageProperties,
\com\setasign\SetaFramework\Database\Database $db,
\com\setasign\SetaFramework\EventManager\EventManager $eventManager,
PageHistory $pageHistory,
PageSettings $pageSettings,
\com\setasign\SetaFramework\Database\JoinedTable\JoinedTable $pageTable,
\com\setasign\SetaFramework\Database\Table\Table $changesTable
)
Parameters
$blockFactory : \com\setasign\SetaSite\Block\BlockFactory
 
$pageProperties : \com\setasign\SetaSite\Config\PageProperties
 
$db : \com\setasign\SetaFramework\Database\Database
 
$eventManager : \com\setasign\SetaFramework\EventManager\EventManager
 
$pageHistory : PageHistory
 
$pageSettings : PageSettings
 
$pageTable : \com\setasign\SetaFramework\Database\JoinedTable\JoinedTable
 
$changesTable : \com\setasign\SetaFramework\Database\Table\Table
 

addChange()

public Pages::addChange (
int $pageId,
string $language,
int $userId,
int $changeType,
bool $finished
): void
Parameters
$pageId : int
 
$language : string
 
$userId : int
 
$changeType : int
 
$finished : bool
 
Exceptions

Throws \com\setasign\SetaFramework\Exception

approveChange()

public Pages::approveChange (
Page $page,
\com\setasign\SetaSite\User\User $user,
?int $onlyType = null
): void
Parameters
$page : Page
 
$user : \com\setasign\SetaSite\User\User
 
$onlyType : ?int
 
Exceptions

Throws \com\setasign\SetaSite\BlockManager\BlockFinalException

Throws \com\setasign\SetaSite\Exception

Throws UnapprovedException

Throws \com\setasign\SetaSite\BlockManager\UnknownBlockException

Throws UnknownPageException

Throws \Throwable

Throws \com\setasign\SetaFramework\Exception

checkPathExist()

public Pages::checkPathExist (
string $path,
?int $id = null,
?int $version = null,
?string $language = null
): bool
Parameters
$path : string
 
$id : ?int
 
$version : ?int
 
$language : ?string
 

checkTemplateIsInUse()

public Pages::checkTemplateIsInUse (
int $templateId,
string $ignorePath,
?string $language = null
): bool
Parameters
$templateId : int
 
$ignorePath : string
 
$language : ?string
 

create()

public Pages::create (
int $parentId,
string $path,
bool $isTemplate,
?string $language = null,
string|int|null $template = null,
?int $beforePageId = null
): Page
Parameters
$parentId : int
 
$path : string
 
$isTemplate : bool
 
$language : ?string
 
$template : string|int|null
 
$beforePageId : ?int
 
Exceptions

Throws \com\setasign\SetaSite\Exception

Throws UnknownPageException

createByPage()

public Pages::createByPage (
Page $page
): Page
Parameters
$page : Page
 
Exceptions

Throws \com\setasign\SetaSite\Exception

createPageObjectByRow()

public Pages::createPageObjectByRow (
\com\setasign\SetaFramework\Database\Table\Row $row
): Page
Parameters
$row : \com\setasign\SetaFramework\Database\Table\Row
 

delete()

public Pages::delete (): void

Beim finalen Löschen -> Sonderfall, dass Kindelemente eventuell noch ausstehende Änderungen haben muss beachtet werden. Finales Löschen muss verhindert werden bis keine ausstehenden Änderungen mehr vorhanden sind.

Parameters
$page : Page
 
$user : \com\setasign\SetaSite\User\User
 
Exceptions

Throws \com\setasign\SetaSite\Exception

Throws UnapprovedException

Throws UnknownPageException

Throws \Throwable

Throws \com\setasign\SetaFramework\Exception

Throws \com\setasign\SetaSite\BlockManager\BlockFinalException

Throws \com\setasign\SetaSite\BlockManager\UnknownBlockException

findTemplatePageUsages()

public Pages::findTemplatePageUsages (
string $templatePath,
?int $version = null,
?string $language = null
): array
Parameters
$templatePath : string
 
$version : ?int
 
$language : ?string
 

getAllChanges()

public Pages::getAllChanges (
void
): array

getAllPages()

public Pages::getAllPages (
int $version,
string $language
): array

Only some special uses

Parameters
$version : int
 
$language : string
 

getChanges()

public Pages::getChanges (
int $pageId,
string $language
): array

Get all changes of the page

Parameters
$pageId : int
 
$language : string
 

getChangesTable()

public Pages::getChangesTable (
void
): \com\setasign\SetaFramework\Database\TableInterface

getChildIdsByPath()

public Pages::getChildIdsByPath (
string $path,
?int $version = null,
?string $language = null
): array

Returns all ids of all childs(recursive) in $path

Parameters
$path : string
 
$version : ?int
 
$language : ?string
 

getMultiplePagePathsByIds()

public Pages::getMultiplePagePathsByIds (
array<int, array{id: int, language: string}> $pages,
?int $version = null
): array
Parameters
$pages : array<int, array{id: int, language: string}>
 
$version : ?int
 

getNewOrder()

public Pages::getNewOrder (
int $parentId,
?int $beforePageId = null,
?string $language = null
): float
Parameters
$parentId : int
 
$beforePageId : ?int
 
$language : ?string
 
Exceptions

Throws \com\setasign\SetaSite\Exception

getNextPageInOrder()

public Pages::getNextPageInOrder (
int $pageId,
int $parentId,
?int $version = null,
?string $language = null
): ?int

This method will return the id of the next page in order or NULL

Parameters
$pageId : int
 
$parentId : int
 
$version : ?int
 
$language : ?string
 
Exceptions

Throws UnknownPageException

getPageSettings()

getPageTable()

public Pages::getPageTable (
void
): \com\setasign\SetaFramework\Database\JoinedTable\JoinedTable

getPageTree()

public Pages::getPageTree (
?int $rootNodeId = Pages::PATH_ID_HOME,
?int $version = null,
?string $language = null,
bool $recursive = true
): array
Parameters
$rootNodeId : ?int
 
$version : ?int
 
$language : ?string
 
$recursive : bool
 

getParentPath()

public Pages::getParentPath (
int $parentId,
?int $version = null,
?string $language = null
): string
Parameters
$parentId : int
 
$version : ?int
 
$language : ?string
 

getPathById()

public Pages::getPathById (
int $id,
?int $version = null,
?string $language = null
): ?string
Parameters
$id : int
 
$version : ?int
 
$language : ?string
 
Return Values

NULL if ID doesn't exists.

hasChange()

public Pages::hasChange (
int $pageId,
string $language,
int[] &$types = null
): bool

Check whether the page has a change

Parameters
$pageId : int
 
$language : string
 
$types : int[]

Reference to used types

hasChildChanges()

public Pages::hasChildChanges (
Page $page,
?int $user = null
): bool
Parameters
$page : Page
 
$user : ?int
 

hasChildren()

public Pages::hasChildren (
int $parentId,
?int $version = null,
?string $language = null
): bool
Parameters
$parentId : int
 
$version : ?int
 
$language : ?string
 

hasTemplateChange()

public Pages::hasTemplateChange (
Page $page
): bool
Parameters
$page : Page
 
Exceptions

Throws \com\setasign\SetaSite\PropertyContainer\InvalidValueException

loadById()

public Pages::loadById (
int $id,
?int $version = null,
?string $language = null,
bool $onlyActive = false
): Page

Load a page or a template by its ID.

Parameters
$id : int
 
$version : ?int
 
$language : ?string
 
$onlyActive : bool

If false inactive pages count as not existing.

Exceptions

Throws UnknownPageException

loadByPath()

public Pages::loadByPath (
string $path,
?int $version = null,
?string $language = null,
bool $catchControllerRoutes = true
): Page

Load a page by its path.

If not in backendMode(version == 1), you can't find pages in trash or template and you can only find active pages.

If in backendMode(version == 0), you can find only workingVersions of the pages.

Parameters
$path : string
 
$version : ?int
 
$language : ?string
 
$catchControllerRoutes : bool

If this is false only pages with the exact same path will be matched

Exceptions

Throws UnknownPageException

revertChange()

public Pages::revertChange (
Page $page,
\com\setasign\SetaSite\User\User $user,
?int $onlyType = null
): void
Parameters
$page : Page
 
$user : \com\setasign\SetaSite\User\User
 
$onlyType : ?int
 
Exceptions

Throws \com\setasign\SetaSite\Exception

Throws \Throwable

save()

public Pages::save (
Page $page,
\com\setasign\SetaSite\User\User $user,
bool $changeFinished = true,
bool $logChanges = true,
bool $skipValidation = false
): void
Parameters
$page : Page
 
$user : \com\setasign\SetaSite\User\User
 
$changeFinished : bool
 
$logChanges : bool
 
$skipValidation : bool

Be careful with this option!!

Exceptions

Throws \com\setasign\SetaSite\PropertyContainer\InvalidValueException

Throws UnknownPageException

Throws \Throwable

Throws \com\setasign\SetaFramework\Exception

Throws \com\setasign\SetaSite\BlockManager\BlockFinalException

Throws \com\setasign\SetaSite\BlockManager\UnknownBlockException

saveRenderData()

public Pages::saveRenderData (
Page $page
): void

Saves the blocks, the renderData and the blocksActualFlag without creating a change!

Parameters
$page : Page
 
Exceptions

Throws \com\setasign\SetaSite\PropertyContainer\InvalidValueException

Throws UnknownPageException

Throws \com\setasign\SetaFramework\Exception

Throws \com\setasign\SetaSite\BlockManager\BlockFinalException

Throws \com\setasign\SetaSite\BlockManager\UnknownBlockException

updatePath()

public Pages::updatePath (
int $version,
string $oldPath,
string $newPath,
?string $language = null
): void
Parameters
$version : int
 
$oldPath : string
 
$newPath : string
 
$language : ?string