TYPO3 CMS  TYPO3_6-2
AbstractHandler.php
Go to the documentation of this file.
1 <?php
3 
21 abstract class AbstractHandler {
22 
28  protected function getCurrentWorkspace() {
29  return $this->getWorkspaceService()->getCurrentWorkspace();
30  }
31 
40  protected function getErrorResponse($errorLabel, $errorCode = 0, $successFlagValue = FALSE) {
41  $localLangFile = 'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf';
42  $response = array(
43  'error' => array(
44  'code' => $errorCode,
45  'message' => $GLOBALS['LANG']->sL($localLangFile . ':' . $errorLabel)
46  ),
47  'success' => $successFlagValue
48  );
49  return $response;
50  }
51 
57  protected function getWorkspaceService() {
58  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\WorkspaceService');
59  }
60 
68  protected function validateLanguageParameter(\stdClass $parameters) {
69  $language = NULL;
70  if (isset($parameters->language) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($parameters->language)) {
71  $language = $parameters->language;
72  }
73  return $language;
74  }
75 
85  protected function getAffectedElements(\stdClass $parameters) {
86  $affectedElements = array();
87  if ($parameters->type === 'selection') {
88  foreach ((array) $parameters->selection as $element) {
89  $affectedElements[] = \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::create($element->table, $element->liveId, $element->versionId);
90  }
91  } elseif ($parameters->type === 'all') {
92  $versions = $this->getWorkspaceService()->selectVersionsInWorkspace($this->getCurrentWorkspace(), 0, -99, -1, 0, 'tables_select', $this->validateLanguageParameter($parameters));
93  foreach ($versions as $table => $tableElements) {
94  foreach ($tableElements as $element) {
95  $affectedElement = \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::create($table, $element['t3ver_oid'], $element['uid']);
96  $affectedElement->getVersionRecord()->setRow($element);
97  $affectedElements[] = $affectedElement;
98  }
99  }
100  }
101  return $affectedElements;
102  }
103 
112  protected function createIntegrityService(array $affectedElements) {
114  $integrityService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\IntegrityService');
115  $integrityService->setAffectedElements($affectedElements);
116  return $integrityService;
117  }
118 
119 }
$parameters
Definition: FileDumpEID.php:15
getErrorResponse($errorLabel, $errorCode=0, $successFlagValue=FALSE)
static create($table, $liveId, $versionId)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]