TYPO3  7.6
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
RecordHistory Class Reference

Public Member Functions

 __construct ()
 
 main ()
 
 toggleHighlight ($uid)
 
 performRollback ($diff)
 
 displaySettings ()
 
 displayMultipleDiff ($diff)
 
 renderDiff ($entry, $table, $rollbackUid=0)
 
 createMultipleDiff ()
 
 createChangeLog ()
 
 getHistoryData ($table, $uid)
 
 generateTitle ($table, $uid)
 
 createRollbackLink ($key, $alt= '', $type=0)
 
 linkPage ($str, $inparams=array(), $anchor= '', $title= '')
 
 removeFilefields ($table, $dataArray)
 
 resolveElement ($table, $uid)
 
 resolveShUid ()
 

Public Attributes

 $maxSteps = 20
 
 $showDiff = 1
 
 $showSubElements = 1
 
 $showInsertDelete = 1
 
 $element
 
 $lastSyslogId
 
 $returnUrl
 
 $changeLog = array()
 
 $showMarked = false
 

Protected Member Functions

 hasPageAccess ($table, $uid)
 
 hasTableAccess ($table)
 
 getRecord ($table, $uid)
 
 getBackendUser ()
 
 getArgument ($name)
 
 getLanguageService ()
 
 getDatabaseConnection ()
 

Protected Attributes

 $recordCache = array()
 
 $pageAccessCache = array()
 
 $iconFactory
 

Detailed Description

Class for the record history display module show_rechis

Definition at line 29 of file RecordHistory.php.

Constructor & Destructor Documentation

__construct ( )

Constructor for the class

Definition at line 106 of file RecordHistory.php.

References RecordHistory\getArgument(), GeneralUtility\makeInstance(), and RecordHistory\resolveShUid().

Member Function Documentation

createChangeLog ( )

Creates change log including sub-elements, filling $this->changeLog

Returns
int

Definition at line 713 of file RecordHistory.php.

References RecordHistory\$changeLog, $GLOBALS, RecordHistory\getDatabaseConnection(), RecordHistory\getHistoryData(), and RecordHistory\hasPageAccess().

Referenced by RecordHistory\main(), and RecordHistory\performRollback().

createMultipleDiff ( )

Creates a diff between the current version of the records and the selected version

Returns
array Diff for many elements, 0 if no changelog is found

Definition at line 651 of file RecordHistory.php.

Referenced by RecordHistory\main().

createRollbackLink (   $key,
  $alt = '',
  $type = 0 
)

Creates a link for the rollback

Parameters
string$keyParameter which is set to rollbackFields
string$altOptional, alternative label and title tag of image
int$typeOptional, type of rollback: 0 - ALL; 1 - element; 2 - field
Returns
string HTML output

Definition at line 861 of file RecordHistory.php.

References RecordHistory\linkPage().

Referenced by RecordHistory\displayMultipleDiff(), and RecordHistory\renderDiff().

displayMultipleDiff (   $diff)

Displays a diff over multiple fields including rollback links

Parameters
array$diffDifference array
Returns
string HTML output

Definition at line 556 of file RecordHistory.php.

References RecordHistory\createRollbackLink(), elseif, RecordHistory\generateTitle(), RecordHistory\getLanguageService(), and RecordHistory\renderDiff().

Referenced by RecordHistory\main().

displaySettings ( )
generateTitle (   $table,
  $uid 
)

Generates the title and puts the record title behind

Parameters
string$table
string$uid
Returns
string

Definition at line 843 of file RecordHistory.php.

References $GLOBALS, RecordHistory\getRecord(), and BackendUtility\getRecordTitle().

Referenced by RecordHistory\displayMultipleDiff().

getArgument (   $name)
protected

Fetches GET/POST arguments and sanitizes the values for the expected disposal. Invalid values will be converted to an empty string.

Parameters
string$nameName of the argument
Returns
array|string|integer

Definition at line 1017 of file RecordHistory.php.

References GeneralUtility\_GP(), and GeneralUtility\sanitizeLocalUrl().

Referenced by RecordHistory\__construct(), RecordHistory\displaySettings(), RecordHistory\main(), and RecordHistory\resolveShUid().

getBackendUser ( )
protected

Gets the current backend user.

Returns

Definition at line 1004 of file RecordHistory.php.

References $GLOBALS.

Referenced by RecordHistory\displaySettings(), RecordHistory\hasPageAccess(), RecordHistory\hasTableAccess(), and RecordHistory\resolveElement().

getDatabaseConnection ( )
protected
getHistoryData (   $table,
  $uid 
)

Gets history and delete/insert data from sys_log and sys_history

Parameters
string$tableDB table name
int$uidUID of record
Returns
array|int Array of history data of the record or 0 if no history could be fetched

Definition at line 756 of file RecordHistory.php.

References RecordHistory\$changeLog, $GLOBALS, debug(), RecordHistory\getDatabaseConnection(), RecordHistory\hasPageAccess(), RecordHistory\hasTableAccess(), and RecordHistory\resolveElement().

Referenced by RecordHistory\createChangeLog().

getLanguageService ( )
protected
getRecord (   $table,
  $uid 
)
protected

Gets a database record.

Parameters
string$table
int$uid
Returns
array|NULL

Definition at line 991 of file RecordHistory.php.

References BackendUtility\getRecord().

Referenced by RecordHistory\displaySettings(), RecordHistory\generateTitle(), and RecordHistory\hasPageAccess().

hasPageAccess (   $table,
  $uid 
)
protected

Determines whether user has access to a page.

Parameters
string$table
int$uid
Returns
bool

Definition at line 953 of file RecordHistory.php.

References RecordHistory\getBackendUser(), RecordHistory\getRecord(), and BackendUtility\readPageAccess().

Referenced by RecordHistory\createChangeLog(), RecordHistory\displaySettings(), and RecordHistory\getHistoryData().

hasTableAccess (   $table)
protected

Determines whether user has access to a table.

Parameters
string$table
Returns
bool

Definition at line 979 of file RecordHistory.php.

References RecordHistory\getBackendUser().

Referenced by RecordHistory\getHistoryData().

linkPage (   $str,
  $inparams = array(),
  $anchor = '',
  $title = '' 
)

Creates a link to the same page.

Parameters
string$strString to wrap in tags (must be htmlspecialchars()'ed prior to calling function)
array$inparamsArray of key/value pairs to override the default values with.
string$anchorPossible anchor value.
string$titlePossible title.
Returns
string Link. private

Definition at line 876 of file RecordHistory.php.

References RecordHistory\$element, RecordHistory\$lastSyslogId, and RecordHistory\$returnUrl.

Referenced by RecordHistory\createRollbackLink(), and RecordHistory\displaySettings().

main ( )

Main function for the listing of history. It detects incoming variables like element reference, history element uid etc. and renders the correct screen.

Returns
string HTML content for the module

Definition at line 124 of file RecordHistory.php.

References RecordHistory\$element, RecordHistory\createChangeLog(), RecordHistory\createMultipleDiff(), RecordHistory\displayMultipleDiff(), RecordHistory\displaySettings(), RecordHistory\getArgument(), RecordHistory\getDatabaseConnection(), RecordHistory\performRollback(), HttpUtility\redirect(), and RecordHistory\toggleHighlight().

performRollback (   $diff)

perform rollback

Parameters
array$diffDiff array to rollback
Returns
string private

Definition at line 196 of file RecordHistory.php.

References RecordHistory\createChangeLog(), elseif, GeneralUtility\makeInstance(), and RecordHistory\removeFilefields().

Referenced by RecordHistory\main().

removeFilefields (   $table,
  $dataArray 
)

Will traverse the field names in $dataArray and look in $GLOBALS['TCA'] if the fields are of types which cannot be handled by the sys_history (that is currently group types with internal_type set to "file")

Parameters
string$tableTable name
array$dataArrayThe data array
Returns
array The modified data array private

Definition at line 898 of file RecordHistory.php.

References $GLOBALS.

Referenced by RecordHistory\performRollback().

renderDiff (   $entry,
  $table,
  $rollbackUid = 0 
)

Renders HTML table-rows with the comparison information of an sys_history entry record

Parameters
array$entrysys_history entry record.
string$tableThe table name
int$rollbackUidIf set to UID of record, display rollback links
Returns
string|NULL HTML table private

Definition at line 609 of file RecordHistory.php.

References $GLOBALS, RecordHistory\createRollbackLink(), BackendUtility\getItemLabel(), RecordHistory\getLanguageService(), and GeneralUtility\makeInstance().

Referenced by RecordHistory\displayMultipleDiff().

resolveElement (   $table,
  $uid 
)

Convert input element reference to workspace version if any.

Parameters
string$tableTable of input element
int$uidUID of record
Returns
int converted UID of record

Definition at line 917 of file RecordHistory.php.

References $GLOBALS, RecordHistory\getBackendUser(), and BackendUtility\getWorkspaceVersionOfRecord().

Referenced by RecordHistory\getHistoryData().

resolveShUid ( )

Resolve sh_uid (used from log)

Returns
void

Definition at line 932 of file RecordHistory.php.

References RecordHistory\getArgument(), and RecordHistory\getDatabaseConnection().

Referenced by RecordHistory\__construct().

toggleHighlight (   $uid)

Toggles highlight state of record

Parameters
int$uidUid of sys_history entry
Returns
void

Definition at line 180 of file RecordHistory.php.

References RecordHistory\getDatabaseConnection().

Referenced by RecordHistory\main().

Member Data Documentation

$changeLog = array()
$element

Definition at line 64 of file RecordHistory.php.

Referenced by RecordHistory\linkPage(), and RecordHistory\main().

$iconFactory
protected

Definition at line 101 of file RecordHistory.php.

$lastSyslogId

Definition at line 71 of file RecordHistory.php.

Referenced by RecordHistory\linkPage().

$maxSteps = 20

Definition at line 36 of file RecordHistory.php.

$pageAccessCache = array()
protected

Definition at line 96 of file RecordHistory.php.

$recordCache = array()
protected

Definition at line 91 of file RecordHistory.php.

$returnUrl

Definition at line 76 of file RecordHistory.php.

Referenced by RecordHistory\linkPage().

$showDiff = 1

Definition at line 43 of file RecordHistory.php.

$showInsertDelete = 1

Definition at line 57 of file RecordHistory.php.

$showMarked = false

Definition at line 86 of file RecordHistory.php.

$showSubElements = 1

Definition at line 50 of file RecordHistory.php.