TYPO3  7.6
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
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=array())
 
 selUrlFile ($path, $copy=0, $deselect=0, $baseArray=array())
 
 pasteUrl ($table, $uid, $setRedirect=true, array $update=null)
 
 deleteUrl ($setRedirect=1, $file=0)
 
 editUrl ()
 
 removeUrl ($table, $uid)
 
 confirmMsg ($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 = array()
 
 $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 ( )

Construct

Definition at line 90 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 824 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 227 of file Clipboard.php.

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

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

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

currentMode ( )

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

Returns
string "copy" or "cut

Definition at line 813 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 638 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 660 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 858 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 211 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 750 of file Clipboard.php.

Referenced by Clipboard\printClipboard().

getBackendUser ( )
protected

Returns the current BE user.

Returns

Definition at line 1071 of file Clipboard.php.

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

getDatabaseConnection ( )
protected

Return DatabaseConnection

Returns

Definition at line 1081 of file Clipboard.php.

getLanguageService ( )
protected

Returns LanguageService

Returns

Definition at line 1061 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 479 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 904 of file Clipboard.php.

hasElements ( )

Returns true if the clipboard contains elements

Returns
bool

Definition at line 459 of file Clipboard.php.

initializeClipboard ( )

Initialize the clipboard from the be_user session

Returns
void

Definition at line 105 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 924 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 889 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 543 of file Clipboard.php.

Referenced by Clipboard\printContentFromTab().

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 Clipboard\setCurrentPad().

makeDeleteCmdArray (   $CMD)

Delete record entries in CMD array

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

Definition at line 993 of file Clipboard.php.

makeDeleteCmdArray_file (   $FILE)

Delete files in CMD array

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

Definition at line 1044 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 952 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 1022 of file Clipboard.php.

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

printClipboard ( )
printContentFromTab (   $pad)
removeElement (   $el)

Removes element on clipboard

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

Definition at line 790 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 680 of file Clipboard.php.

Referenced by Clipboard\printContentFromTab().

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

Referenced by Clipboard\endClipboard().

selUrlDB (   $table,
  $uid,
  $copy = 0,
  $deselect = 0,
  $baseArray = array() 
)

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

selUrlFile (   $path,
  $copy = 0,
  $deselect = 0,
  $baseArray = array() 
)

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 592 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 148 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 190 of file Clipboard.php.

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

Referenced by Clipboard\setCmd().

Member Data Documentation

$changed = 0

Definition at line 63 of file Clipboard.php.

$clipData = array()

Definition at line 58 of file Clipboard.php.

Referenced by Clipboard\initializeClipboard().

$current = ''
$fileMode = 0

Definition at line 80 of file Clipboard.php.

$iconFactory
protected

Definition at line 85 of file Clipboard.php.

Definition at line 73 of file Clipboard.php.

$numberTabs = 3

Definition at line 35 of file Clipboard.php.

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