TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
Clipboard Class Reference

Public Member Functions

 __construct ()
 
 initializeClipboard ()
 
 lockToNormal ()
 
 setCmd ($cmd)
 
 setCurrentPad ($padIdent)
 
 endClipboard ()
 
 cleanUpCBC ($CBarr, $table, $removeDeselected=0)
 
 printClipboard ()
 
 getContentFromTab ($pad)
 
 hasElements ()
 
 getLocalizations ($table, $parentRec, $bgColClass, $pad)
 
 padTitle ($pad)
 
 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 ()
 

Protected Attributes

 $iconFactory
 
 $view
 

Detailed Description

TYPO3 clipboard for records and files

Definition at line 33 of file Clipboard.php.

Constructor & Destructor Documentation

__construct ( )

Construct

Exceptions
TYPO3
InvalidArgumentException

Definition at line 100 of file Clipboard.php.

References GeneralUtility\makeInstance().

Member Function Documentation

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 846 of file Clipboard.php.

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 239 of file Clipboard.php.

clLabel (   $key,
  $Akey = 'labels' 
)

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

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

Definition at line 762 of file Clipboard.php.

Referenced by Clipboard\printClipboard().

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
Deprecated:
since TYPO3 v8, will be removed in TYPO3 v9

Definition at line 692 of file Clipboard.php.

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 712 of file Clipboard.php.

currentMode ( )

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

Returns
string "copy" or "cut

Definition at line 835 of file Clipboard.php.

Referenced by Clipboard\printClipboard().

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 634 of file Clipboard.php.

Referenced by Clipboard\printClipboard().

editUrl ( )

editUrl of all current elements ONLY database Links to FormEngine

Returns
string The URL to FormEngine with parameters.

Definition at line 656 of file Clipboard.php.

Referenced by Clipboard\printClipboard().

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 880 of file Clipboard.php.

Referenced by Clipboard\printClipboard().

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 223 of file Clipboard.php.

References Clipboard\saveClipboard().

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 772 of file Clipboard.php.

Referenced by Clipboard\printClipboard().

getBackendUser ( )
protected

Returns the current BE user.

Returns

Definition at line 1093 of file Clipboard.php.

Referenced by Clipboard\getContentFromTab(), Clipboard\initializeClipboard(), and Clipboard\printClipboard().

getContentFromTab (   $pad)
getLanguageService ( )
protected

Returns LanguageService

Returns

Definition at line 1083 of file Clipboard.php.

Referenced by Clipboard\printClipboard().

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 470 of file Clipboard.php.

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 926 of file Clipboard.php.

hasElements ( )

Returns true if the clipboard contains elements

Returns
bool

Definition at line 450 of file Clipboard.php.

initializeClipboard ( )

Initialize the clipboard from the be_user session

Returns
void

Definition at line 117 of file Clipboard.php.

References Clipboard\$clipData, Clipboard\$numberTabs, MathUtility\canBeInterpretedAsInteger(), MathUtility\forceIntegerInRange(), and Clipboard\getBackendUser().

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 946 of file Clipboard.php.

Referenced by Clipboard\setCmd(), and Clipboard\setCurrentPad().

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 911 of file Clipboard.php.

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 539 of file Clipboard.php.

Referenced by Clipboard\getContentFromTab().

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 142 of file Clipboard.php.

Referenced by Clipboard\setCurrentPad().

makeDeleteCmdArray (   $CMD)

Delete record entries in CMD array

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

Definition at line 1015 of file Clipboard.php.

makeDeleteCmdArray_file (   $FILE)

Delete files in CMD array

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

Definition at line 1066 of file Clipboard.php.

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 974 of file Clipboard.php.

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 1044 of file Clipboard.php.

padTitle (   $pad)

Warps title with number of elements if any.

Parameters
string$padPad reference
Returns
string padding

Definition at line 522 of file Clipboard.php.

Referenced by Clipboard\printClipboard().

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 609 of file Clipboard.php.

removeElement (   $el)

Removes element on clipboard

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

Definition at line 812 of file Clipboard.php.

Referenced by Clipboard\setCmd().

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 676 of file Clipboard.php.

Referenced by Clipboard\getContentFromTab().

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 825 of file Clipboard.php.

Referenced by Clipboard\endClipboard().

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 569 of file Clipboard.php.

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 588 of file Clipboard.php.

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 160 of file Clipboard.php.

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

setCurrentPad (   $padIdent)

Setting the current pad on clipboard

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

Definition at line 202 of file Clipboard.php.

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

Referenced by Clipboard\setCmd().

Member Data Documentation

$changed = 0

Definition at line 66 of file Clipboard.php.

$clipData = []

Definition at line 61 of file Clipboard.php.

Referenced by Clipboard\initializeClipboard().

$current = ''

Definition at line 71 of file Clipboard.php.

Referenced by Clipboard\setCmd(), and Clipboard\setCurrentPad().

$fileMode = 0

Definition at line 83 of file Clipboard.php.

$iconFactory
protected

Definition at line 88 of file Clipboard.php.

Definition at line 76 of file Clipboard.php.

$numberTabs = 3

Definition at line 38 of file Clipboard.php.

Referenced by Clipboard\initializeClipboard(), and Clipboard\printClipboard().

$view
protected

Definition at line 93 of file Clipboard.php.