TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Backend\Clipboard\Clipboard Class Reference

Public Member Functions

 __construct ()
 
 initializeClipboard ()
 
 lockToNormal ()
 
 setCmd ($cmd)
 
 setCurrentPad ($padIdent)
 
 endClipboard ()
 
 cleanUpCBC ($CBarr, $table, $removeDeselected=0)
 
 printClipboard ()
 
 printContentFromTab ($pad)
 
 hasElements ()
 
 getLocalizations ($table, $parentRec, $bgColClass, $pad)
 
 padTitleWrap ($str, $pad, $active)
 
 linkItemText ($str, $rec, $table='')
 
 selUrlDB ($table, $uid, $copy=0, $deselect=0, $baseArray=[])
 
 selUrlFile ($path, $copy=0, $deselect=0, $baseArray=[])
 
 pasteUrl ($table, $uid, $setRedirect=true, array $update=null)
 
 deleteUrl ($setRedirect=1, $file=0)
 
 editUrl ()
 
 removeUrl ($table, $uid)
 
 confirmMsg ($table, $rec, $type, $clElements, $columnLabel='')
 
 confirmMsgText ($table, $rec, $type, $clElements, $columnLabel='')
 
 clLabel ($key, $Akey='labels')
 
 removeElement ($el)
 
 saveClipboard ()
 
 currentMode ()
 
 cleanCurrent ()
 
 elFromTable ($matchTable='', $pad='')
 
 isSelected ($table, $uid)
 
 getSelectedRecord ($table='', $uid='')
 
 isElements ()
 
 makePasteCmdArray ($ref, $CMD, array $update=null)
 
 makeDeleteCmdArray ($CMD)
 
 makePasteCmdArray_file ($ref, $FILE)
 
 makeDeleteCmdArray_file ($FILE)
 

Public Attributes

 $numberTabs = 3
 
 $clipData = []
 
 $changed = 0
 
 $current = ''
 
 $lockToNormal = 0
 
 $fileMode = 0
 

Protected Member Functions

 exportClipElementParameters ()
 
 getLanguageService ()
 
 getBackendUser ()
 
 getDatabaseConnection ()
 

Protected Attributes

 $iconFactory
 

Detailed Description

TYPO3 clipboard for records and files

Definition at line 30 of file Clipboard.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Clipboard\Clipboard::__construct ( )

Construct

Definition at line 90 of file Clipboard.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Member Function Documentation

◆ cleanCurrent()

TYPO3\CMS\Backend\Clipboard\Clipboard::cleanCurrent ( )

This traverses the elements on the current clipboard pane and unsets elements which does not exist anymore or are disabled.

Returns
void

Definition at line 863 of file Clipboard.php.

◆ cleanUpCBC()

TYPO3\CMS\Backend\Clipboard\Clipboard::cleanUpCBC (   $CBarr,
  $table,
  $removeDeselected = 0 
)

Cleans up an incoming element array $CBarr (Array selecting/deselecting elements)

Parameters
array$CBarrElement array from outside ("key" => "selected/deselected")
string$tableThe 'table which is allowed'. Must be set.
bool | int$removeDeselectedCan be set in order to remove entries which are marked for deselection.
Returns
array Processed input $CBarr

Definition at line 227 of file Clipboard.php.

◆ clLabel()

TYPO3\CMS\Backend\Clipboard\Clipboard::clLabel (   $key,
  $Akey = 'labels' 
)

Clipboard label - getting from "EXT:lang/locallang_core.xlf:"

Parameters
string$keyLabel Key
string$AkeyAlternative key to "labels
Returns
string

Definition at line 779 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard(), and TYPO3\CMS\Backend\Clipboard\Clipboard\printContentFromTab().

◆ confirmMsg()

TYPO3\CMS\Backend\Clipboard\Clipboard::confirmMsg (   $table,
  $rec,
  $type,
  $clElements,
  $columnLabel = '' 
)

Returns confirm JavaScript message

Parameters
string$tableTable name
mixed$recFor records its an array, for files its a string (path)
string$typeType-code
array$clElementsArray of selected elements
string$columnLabelName of the content column
Returns
string JavaScript "confirm" message

Definition at line 710 of file Clipboard.php.

◆ confirmMsgText()

TYPO3\CMS\Backend\Clipboard\Clipboard::confirmMsgText (   $table,
  $rec,
  $type,
  $clElements,
  $columnLabel = '' 
)

Returns confirm JavaScript message

Parameters
string$tableTable name
mixed$recFor records its an array, for files its a string (path)
string$typeType-code
array$clElementsArray of selected elements
string$columnLabelName of the content column
Returns
string the text for a confirm message

Definition at line 729 of file Clipboard.php.

◆ currentMode()

TYPO3\CMS\Backend\Clipboard\Clipboard::currentMode ( )

Returns the current mode, 'copy' or 'cut'

Returns
string "copy" or "cut

Definition at line 852 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ deleteUrl()

TYPO3\CMS\Backend\Clipboard\Clipboard::deleteUrl (   $setRedirect = 1,
  $file = 0 
)

deleteUrl for current pad

Parameters
bool | int$setRedirectIf set, then the redirect URL will point back to the current script, but with CB reset.
bool | int$fileIf set, then the URL will link to the tce_file.php script in the typo3/ dir.
Returns
string

Definition at line 653 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ editUrl()

TYPO3\CMS\Backend\Clipboard\Clipboard::editUrl ( )

editUrl of all current elements ONLY database Links to FormEngine

Returns
string The URL to FormEngine with parameters.

Definition at line 675 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ elFromTable()

TYPO3\CMS\Backend\Clipboard\Clipboard::elFromTable (   $matchTable = '',
  $pad = '' 
)

Counts the number of elements from the table $matchTable. If $matchTable is blank, all tables (except '_FILE' of course) is counted.

Parameters
string$matchTableTable to match/count for.
string$padCan optionally be used to set another pad than the current.
Returns
array Array with keys from the CB.

Definition at line 897 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ endClipboard()

TYPO3\CMS\Backend\Clipboard\Clipboard::endClipboard ( )

Call this after initialization and setCmd in order to save the clipboard to the user session. The function will check if the internal flag ->changed has been set and if so, save the clipboard. Else not.

Returns
void

Definition at line 211 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\saveClipboard().

◆ exportClipElementParameters()

TYPO3\CMS\Backend\Clipboard\Clipboard::exportClipElementParameters ( )
protected

Creates GET parameters for linking to the export module.

Returns
array GET parameters for current clipboard content to be exported

Definition at line 789 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ getBackendUser()

TYPO3\CMS\Backend\Clipboard\Clipboard::getBackendUser ( )
protected

◆ getDatabaseConnection()

TYPO3\CMS\Backend\Clipboard\Clipboard::getDatabaseConnection ( )
protected

Return DatabaseConnection

Returns

Definition at line 1120 of file Clipboard.php.

◆ getLanguageService()

TYPO3\CMS\Backend\Clipboard\Clipboard::getLanguageService ( )
protected

Returns LanguageService

Returns

Definition at line 1100 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ getLocalizations()

TYPO3\CMS\Backend\Clipboard\Clipboard::getLocalizations (   $table,
  $parentRec,
  $bgColClass,
  $pad 
)

Gets all localizations of the current record.

Parameters
string$tableThe table
array$parentRecThe current record
string$bgColClassClass for the background color of a column
string$padPad reference
Returns
string HTML table rows

Definition at line 494 of file Clipboard.php.

◆ getSelectedRecord()

TYPO3\CMS\Backend\Clipboard\Clipboard::getSelectedRecord (   $table = '',
  $uid = '' 
)

Returns item record $table,$uid if selected on current clipboard If table and uid is blank, the first element is returned. Makes sense only for DB records - not files!

Parameters
string$tableTable name
int | string$uidElement uid
Returns
array Element record with extra field _RECORD_TITLE set to the title of the record

Definition at line 943 of file Clipboard.php.

◆ hasElements()

TYPO3\CMS\Backend\Clipboard\Clipboard::hasElements ( )

Returns true if the clipboard contains elements

Returns
bool

Definition at line 474 of file Clipboard.php.

◆ initializeClipboard()

◆ isElements()

TYPO3\CMS\Backend\Clipboard\Clipboard::isElements ( )

Reports if the current pad has elements (does not check file/DB type OR if file/DBrecord exists or not. Only counting array)

Returns
bool TRUE if elements exist.

Definition at line 963 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\setCmd(), and TYPO3\CMS\Backend\Clipboard\Clipboard\setCurrentPad().

◆ isSelected()

TYPO3\CMS\Backend\Clipboard\Clipboard::isSelected (   $table,
  $uid 
)

Verifies if the item $table/$uid is on the current pad. If the pad is "normal", the mode value is returned if the element existed. Thus you'll know if the item was copy or cut moded...

Parameters
string$tableTable name, (_FILE for files...)
int$uidElement uid (path for files)
Returns
string

Definition at line 928 of file Clipboard.php.

◆ linkItemText()

TYPO3\CMS\Backend\Clipboard\Clipboard::linkItemText (   $str,
  $rec,
  $table = '' 
)

Wraps the title of the items listed in link-tags. The items will link to the page/folder where they originate from

Parameters
string$strTitle of element - must be htmlspecialchar'ed on beforehand.
mixed$recIf array, a record is expected. If string, its a path
string$tableTable name
Returns
string

Definition at line 558 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printContentFromTab().

◆ lockToNormal()

TYPO3\CMS\Backend\Clipboard\Clipboard::lockToNormal ( )

Call this method after initialization if you want to lock the clipboard to operate on the normal pad only. Trying to switch pad through ->setCmd will not work. This is used by the clickmenu since it only allows operation on single elements at a time (that is the "normal" pad)

Returns
void

Definition at line 130 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\setCurrentPad().

◆ makeDeleteCmdArray()

TYPO3\CMS\Backend\Clipboard\Clipboard::makeDeleteCmdArray (   $CMD)

Delete record entries in CMD array

Parameters
array$CMDCommand-array
Returns
array Modified Command-array

Definition at line 1032 of file Clipboard.php.

◆ makeDeleteCmdArray_file()

TYPO3\CMS\Backend\Clipboard\Clipboard::makeDeleteCmdArray_file (   $FILE)

Delete files in CMD array

Parameters
array$FILECommand-array
Returns
array Modified Command-array

Definition at line 1083 of file Clipboard.php.

◆ makePasteCmdArray()

TYPO3\CMS\Backend\Clipboard\Clipboard::makePasteCmdArray (   $ref,
  $CMD,
array  $update = null 
)

Applies the proper paste configuration in the $cmd array send to tce_db.php. $ref is the target, see description below. The current pad is pasted

$ref: [tablename]:[paste-uid]. Tablename is the name of the table from which elements on the current clipboard is pasted with the 'pid' paste-uid. No tablename means that all items on the clipboard (non-files) are pasted. This requires paste-uid to be positive though. so 'tt_content:-3' means 'paste tt_content elements on the clipboard to AFTER tt_content:3 record 'tt_content:30' means 'paste tt_content elements on the clipboard into page with id 30 ':30' means 'paste ALL database elements on the clipboard into page with id 30 ':-30' not valid.

Parameters
string$ref[tablename]:[paste-uid], see description
array$CMDCommand-array
NULL|arrayIf additional values should get set in the copied/moved record this will be an array containing key=>value pairs
Returns
array Modified Command-array

Definition at line 991 of file Clipboard.php.

◆ makePasteCmdArray_file()

TYPO3\CMS\Backend\Clipboard\Clipboard::makePasteCmdArray_file (   $ref,
  $FILE 
)

Applies the proper paste configuration in the $file array send to tce_file.php. The current pad is pasted

Parameters
string$refReference to element (splitted by "|")
array$FILECommand-array
Returns
array Modified Command-array

Definition at line 1061 of file Clipboard.php.

◆ padTitleWrap()

TYPO3\CMS\Backend\Clipboard\Clipboard::padTitleWrap (   $str,
  $pad,
  $active 
)

Wraps title of pad in bold-tag and maybe the number of elements if any. Only applies bold-tag if the item is active

Parameters
string$strString (already htmlspecialchars()'ed)
string$padPad reference
bool$activeis currently active
Returns
string HTML output (htmlspecialchar'ed content inside of tags.)

Definition at line 537 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ pasteUrl()

TYPO3\CMS\Backend\Clipboard\Clipboard::pasteUrl (   $table,
  $uid,
  $setRedirect = true,
array  $update = null 
)

pasteUrl of the element (database and file) For the meaning of $table and $uid, please read from ->makePasteCmdArray!!! The URL will point to tce_file or tce_db depending in $table

Parameters
string$tableTablename (_FILE for files)
mixed$uid"destination": can be positive or negative indicating how the paste is done (paste into / paste after)
bool$setRedirectIf set, then the redirect URL will point back to the current script, but with CB reset.
array | NULL$updateAdditional key/value pairs which should get set in the moved/copied record (via DataHandler)
Returns
string

Definition at line 628 of file Clipboard.php.

◆ printClipboard()

◆ printContentFromTab()

◆ removeElement()

TYPO3\CMS\Backend\Clipboard\Clipboard::removeElement (   $el)

Removes element on clipboard

Parameters
string$elKey of element in ->clipData array
Returns
void

Definition at line 829 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\setCmd().

◆ removeUrl()

TYPO3\CMS\Backend\Clipboard\Clipboard::removeUrl (   $table,
  $uid 
)

Returns the remove-url (file and db) for file $table='_FILE' and $uid = shortmd5 hash of path

Parameters
string$tableTablename
string$uidUid integer/shortmd5 hash
Returns
string URL

Definition at line 695 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printContentFromTab().

◆ saveClipboard()

TYPO3\CMS\Backend\Clipboard\Clipboard::saveClipboard ( )

Saves the clipboard, no questions asked. Use ->endClipboard normally (as it checks if changes has been done so saving is necessary)

private

Returns
void

Definition at line 842 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\endClipboard().

◆ selUrlDB()

TYPO3\CMS\Backend\Clipboard\Clipboard::selUrlDB (   $table,
  $uid,
  $copy = 0,
  $deselect = 0,
  $baseArray = [] 
)

Returns the select-url for database elements

Parameters
string$tableTable name
int$uidUid of record
bool | int$copyIf set, copymode will be enabled
bool | int$deselectIf set, the link will deselect, otherwise select.
array$baseArrayThe base array of GET vars to be sent in addition. Notice that current GET vars WILL automatically be included.
Returns
string URL linking to the current script but with the CB array set to select the element with table/uid

Definition at line 588 of file Clipboard.php.

◆ selUrlFile()

TYPO3\CMS\Backend\Clipboard\Clipboard::selUrlFile (   $path,
  $copy = 0,
  $deselect = 0,
  $baseArray = [] 
)

Returns the select-url for files

Parameters
string$pathFilepath
bool | int$copyIf set, copymode will be enabled
bool | int$deselectIf set, the link will deselect, otherwise select.
array$baseArrayThe base array of GET vars to be sent in addition. Notice that current GET vars WILL automatically be included.
Returns
string URL linking to the current script but with the CB array set to select the path

Definition at line 607 of file Clipboard.php.

◆ setCmd()

TYPO3\CMS\Backend\Clipboard\Clipboard::setCmd (   $cmd)

The array $cmd may hold various keys which notes some action to take. Normally perform only one action at a time. In scripts like db_list.php / filelist/mod1/index.php the GET-var CB is used to control the clipboard.

Selecting / Deselecting elements Array $cmd['el'] has keys = element-ident, value = element value (see description of clipData array in header) Selecting elements for 'copy' should be done by simultaneously setting setCopyMode.

Parameters
array$cmdArray of actions, see function description
Returns
void

Definition at line 148 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\$current, TYPO3\CMS\Backend\Clipboard\Clipboard\isElements(), TYPO3\CMS\Backend\Clipboard\Clipboard\removeElement(), and TYPO3\CMS\Backend\Clipboard\Clipboard\setCurrentPad().

◆ setCurrentPad()

TYPO3\CMS\Backend\Clipboard\Clipboard::setCurrentPad (   $padIdent)

Setting the current pad on clipboard

Parameters
string$padIdentKey in the array $this->clipData
Returns
void

Definition at line 190 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\$current, TYPO3\CMS\Backend\Clipboard\Clipboard\isElements(), and TYPO3\CMS\Backend\Clipboard\Clipboard\lockToNormal().

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\setCmd().

Member Data Documentation

◆ $changed

TYPO3\CMS\Backend\Clipboard\Clipboard::$changed = 0

Definition at line 63 of file Clipboard.php.

◆ $clipData

TYPO3\CMS\Backend\Clipboard\Clipboard::$clipData = []

◆ $current

◆ $fileMode

TYPO3\CMS\Backend\Clipboard\Clipboard::$fileMode = 0

Definition at line 80 of file Clipboard.php.

◆ $iconFactory

TYPO3\CMS\Backend\Clipboard\Clipboard::$iconFactory
protected

Definition at line 85 of file Clipboard.php.

◆ $lockToNormal

TYPO3\CMS\Backend\Clipboard\Clipboard::$lockToNormal = 0

Definition at line 73 of file Clipboard.php.

◆ $numberTabs

TYPO3\CMS\Backend\Clipboard\Clipboard::$numberTabs = 3