TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Backend\Clipboard\Clipboard Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Clipboard\Clipboard:
t3lib_clipboard

Public Member Functions

 initializeClipboard ()
 
 lockToNormal ()
 
 setCmd ($cmd)
 
 setCurrentPad ($padIdent)
 
 endClipboard ()
 
 cleanUpCBC ($CBarr, $table, $removeDeselected=0)
 
 printClipboard ()
 
 printContentFromTab ($pad)
 
 hasElements ()
 
 getLocalizations ($table, $parentRec, $bgColClass, $pad)
 
 padTitleWrap ($str, $pad)
 
 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 = ''
 
 $backPath = ''
 
 $lockToNormal = 0
 
 $fileMode = 0
 

Protected Member Functions

 exportClipElementParameters ()
 

Detailed Description

TYPO3 clipboard for records and files

Author
Kasper Skårhøj kaspe.nosp@m.rYYY.nosp@m.Y@typ.nosp@m.o3.c.nosp@m.om

Definition at line 29 of file Clipboard.php.

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
Todo:
Define visibility

Definition at line 764 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.
boolean$removeDeselectedCan be set in order to remove entries which are marked for deselection.
Returns
array Processed input $CBarr
Todo:
Define visibility

Definition at line 226 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
Todo:
Define visibility

Definition at line 681 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
Todo:
Define visibility

Definition at line 636 of file Clipboard.php.

◆ currentMode()

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

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

Returns
string "copy" or "cut
Todo:
Define visibility

Definition at line 753 of file Clipboard.php.

◆ deleteUrl()

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

deleteUrl for current pad

Parameters
boolean$setRedirectIf set, then the redirect URL will point back to the current script, but with CB reset.
boolean$fileIf set, then the URL will link to the tce_file.php script in the typo3/ dir.
Returns
string
Todo:
Define visibility

Definition at line 587 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 alt_doc.php

Returns
string The URL to alt_doc.php with parameters.
Todo:
Define visibility

Definition at line 600 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.
Todo:
Define visibility

Definition at line 798 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
Todo:
Define visibility

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

◆ 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
Todo:
Define visibility

Definition at line 438 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
integer$uidElement uid
Returns
array Element record with extra field _RECORD_TITLE set to the title of the record
Todo:
Define visibility

Definition at line 844 of file Clipboard.php.

◆ hasElements()

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

Returns true if the clipboard contains elements

Returns
boolean

Definition at line 418 of file Clipboard.php.

◆ initializeClipboard()

TYPO3\CMS\Backend\Clipboard\Clipboard::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
boolean TRUE if elements exist.
Todo:
Define visibility

Definition at line 863 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...)
integer$uidElement uid (path for files)
Returns
string
Todo:
Define visibility

Definition at line 829 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
Todo:
Define visibility

Definition at line 497 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
Todo:
Define visibility

Definition at line 124 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
Todo:
Define visibility

Definition at line 932 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
Todo:
Define visibility

Definition at line 983 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
Todo:
Define visibility

Definition at line 891 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
Todo:
Define visibility

Definition at line 961 of file Clipboard.php.

◆ padTitleWrap()

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

Wraps title of pad in bold-tags and maybe the number of elements if any.

Parameters
string$strString (already htmlspecialchars()'ed)
string$padPad reference
Returns
string HTML output (htmlspecialchar'ed content inside of tags.)
Todo:
Define visibility

Definition at line 479 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)
boolean$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
Todo:
Define visibility

Definition at line 567 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
Todo:
Define visibility

Definition at line 730 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
Todo:
Define visibility

Definition at line 621 of file Clipboard.php.

◆ 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
Todo:
Define visibility

Definition at line 743 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 = array() 
)

Returns the select-url for database elements

Parameters
string$tableTable name
integer$uidUid of record
boolean$copyIf set, copymode will be enabled
boolean$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
Todo:
Define visibility

Definition at line 527 of file Clipboard.php.

◆ selUrlFile()

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

Returns the select-url for files

Parameters
string$pathFilepath
boolean$copyIf set, copymode will be enabled
boolean$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
Todo:
Define visibility

Definition at line 546 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
Todo:
Define visibility

Definition at line 142 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
Todo:
Define visibility

Definition at line 189 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

◆ $backPath

TYPO3\CMS\Backend\Clipboard\Clipboard::$backPath = ''
Todo:
Define visibility

Definition at line 73 of file Clipboard.php.

◆ $changed

TYPO3\CMS\Backend\Clipboard\Clipboard::$changed = 0
Todo:
Define visibility

Definition at line 63 of file Clipboard.php.

◆ $clipData

TYPO3\CMS\Backend\Clipboard\Clipboard::$clipData = array()

Clipboard data kept here

Keys: 'normal' 'tab_[x]' where x is >=1 and denotes the pad-number 'mode' : 'copy' means copy-mode, default = moving ('cut') 'el' : Array of elements: DB: keys = '[tablename]|[uid]' eg. 'tt_content:123' DB: values = 1 (basically insignificant) FILE: keys = '_FILE|[shortmd5 of path]' eg. '_FILE|9ebc7e5c74' FILE: values = The full filepath, eg. '/www/htdocs/typo3/32/dummy/fileadmin/sem1_3_examples/alternative_index.php' or 'C:/www/htdocs/typo3/32/dummy/fileadmin/sem1_3_examples/alternative_index.php'

'current' pointer to current tab (among the above...) '_setThumb' boolean: If set, file thumbnails are shown.

The virtual tablename '_FILE' will always indicate files/folders. When checking for elements from eg. 'all tables' (by using an empty string) '_FILE' entries are excluded (so in effect only DB elements are counted)

Todo:
Define visibility

Definition at line 58 of file Clipboard.php.

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

◆ $current

TYPO3\CMS\Backend\Clipboard\Clipboard::$current = ''

◆ $fileMode

TYPO3\CMS\Backend\Clipboard\Clipboard::$fileMode = 0
Todo:
Define visibility

Definition at line 84 of file Clipboard.php.

◆ $lockToNormal

TYPO3\CMS\Backend\Clipboard\Clipboard::$lockToNormal = 0
Todo:
Define visibility

Definition at line 78 of file Clipboard.php.

◆ $numberTabs

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