com\setasign\SetaSite\Page

PageHistory

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

Class hierarchy

Summary

Constants

TYPE_APPROVE

public const PageHistory::TYPE_APPROVE = 3

TYPE_CREATE

public const PageHistory::TYPE_CREATE = 0

TYPE_DELETE

public const PageHistory::TYPE_DELETE = 5

TYPE_MOVE

public const PageHistory::TYPE_MOVE = 2

TYPE_REVERT

public const PageHistory::TYPE_REVERT = 4

TYPE_UPDATE

public const PageHistory::TYPE_UPDATE = 1

Properties

$historyTable


Methods

__construct()

public PageHistory::__construct (
\com\setasign\SetaFramework\Database\Table\Table $historyTable
)
Parameters
$historyTable : \com\setasign\SetaFramework\Database\Table\Table
 

cleanupHistory()

private PageHistory::cleanupHistory (
int $pageId,
string $language
): void

Cleanup the history for $pageId since the last approve/revert. If one user saves the same page multiple times after each other those changes will be merged to one single change. The merges are user based. If the changes are over multiple days the last copy of each day will be kept.

E.g. UserA saves 5 times -> UserB saves 4 times -> UserA saves 2 times -> UserC approves the pages (all on the same day). This will result in 3 updates (2 by UserA and 1 by UserB) and 1 approve (by UserC).

Parameters
$pageId : int
 
$language : string
 
Exceptions

Throws \Exception

createHistoryEntry()

public PageHistory::createHistoryEntry (
int $pageId,
string $pageLanguage,
int $userId,
int $type,
array $typeData = array ( )
): int

Creates a history entry.

Parameters
$pageId : int
 
$pageLanguage : string
 
$userId : int
 
$type : int
 
$typeData : array

Type dependent data.

Return Values

History id

Exceptions

Throws \com\setasign\SetaSite\Exception

Throws \com\setasign\SetaFramework\Exception

Throws \JsonException

Throws \Exception

deleteHistoryEntries()

public PageHistory::deleteHistoryEntries (
int[] $ids
): void

Delete multiple history entries. It doesn't matter whether the ids do exist.

Parameters
$ids : int[]
 

editNote()

public PageHistory::editNote (
int $historyId,
string $note
): void
Parameters
$historyId : int
 
$note : string
 
Exceptions

Throws \com\setasign\SetaFramework\Exception

getAllHistoryEntries()

public PageHistory::getAllHistoryEntries (
?int $limit = null,
?int $offset = null
): array
Parameters
$limit : ?int
 
$offset : ?int
 

getAllHistoryEntriesCount()

public PageHistory::getAllHistoryEntriesCount (
string $language
): int
Parameters
$language : string
 

getHistoryEntriesByPage()

public PageHistory::getHistoryEntriesByPage (
int $pageId,
string $language
): array

Get all history entries ordered by datetime (descending).

Parameters
$pageId : int
 
$language : string
 
Return Values

Array with the keys ['historyId', 'datetime', 'note', 'userId']

loadHistoryEntry()

public PageHistory::loadHistoryEntry (
Page $page,
int $historyId
): void
Parameters
$page : Page
 
$historyId : int
 
Exceptions

Throws \com\setasign\SetaSite\Exception