TYPO3 CMS  TYPO3_6-2
ExtdirectPageCommands.php
Go to the documentation of this file.
1 <?php
3 
19 
26 
37  public function moveContentElement($sourceElement, $destinationColumn, $destinationElement) {
38  $moveElementUid = 0;
39  $afterElementUid = -1;
40  $targetColumn = 0;
41  $targetPage = 0;
42  list($_, $table, $uid) = GeneralUtility::trimExplode('-', $sourceElement);
43  if ($table === 'tt_content' && MathUtility::canBeInterpretedAsInteger($uid)) {
44  $moveElementUid = (int)$uid;
45  }
46  list($_, $table, $uid) = GeneralUtility::trimExplode('-', $destinationElement);
47  if ($table === 'tt_content' && MathUtility::canBeInterpretedAsInteger($uid)) {
48  $afterElementUid = (int)$uid;
49  } else {
50  // it's dropped in an empty column
51  $afterElementUid = -1;
52  }
53  list($prefix, $column, $prefix2, $page, $_) = GeneralUtility::trimExplode('-', $destinationColumn);
54  if ($prefix === 'colpos' && MathUtility::canBeInterpretedAsInteger($column) &&
55  $prefix2 === 'page' && MathUtility::canBeInterpretedAsInteger($page)
56  ) {
57  $targetColumn = (int)$column;
58  $targetPage = (int)$page;
59  }
60  // move to empty column
61  if ($afterElementUid === -1) {
62  $action['cmd']['tt_content'][$moveElementUid]['move'] = $targetPage;
63  } else {
64  $action['cmd']['tt_content'][$moveElementUid]['move'] = -$afterElementUid;
65  }
66 
67  $action['data']['tt_content'][$moveElementUid]['colPos'] = $targetColumn;
68 
70  'Dragdrop',
71  'core',
72  -1,
73  array (
74  'action' => $action,
75  'sourceElement' => $sourceElement,
76  'destinationColumn' => $destinationColumn,
77  'destinationElement' => $destinationElement,
78  )
79  );
81  $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
82  $tce->stripslashes_values = 0;
83  $tce->start($action['data'], $action['cmd']);
84  $tce->process_datamap();
85  $tce->process_cmdmap();
86 
87  return array('success' => TRUE);
88  }
89 }
static devLog($msg, $extKey, $severity=0, $dataVar=FALSE)
$uid
Definition: server.php:36
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)