TYPO3 CMS  TYPO3_6-2
PagetreeNode.php
Go to the documentation of this file.
1 <?php
3 
18 
25 
31  protected $cachedAccessRights = array();
32 
38  protected $workspaceId = 0;
39 
45  protected $mountPoint = 0;
46 
52  protected $readableRootline = '';
53 
59  protected $isMountPoint = FALSE;
60 
66  protected $backgroundColor = '';
67 
75  $this->backgroundColor = $backgroundColor;
76  }
77 
83  public function getBackgroundColor() {
85  }
86 
93  public function setWorkspaceId($workspaceId) {
94  $this->workspaceId = (int)$workspaceId;
95  }
96 
102  public function getWorkspaceId() {
103  return $this->workspaceId;
104  }
105 
112  public function setMountPoint($mountPoint) {
113  $this->mountPoint = (int)$mountPoint;
114  }
115 
121  public function getMountPoint() {
122  return $this->mountPoint;
123  }
124 
131  public function setIsMountPoint($isMountPoint) {
132  $this->isMountPoint = $isMountPoint == TRUE;
133  }
134 
140  public function isMountPoint() {
141  return $this->isMountPoint;
142  }
143 
150  public function setReadableRootline($rootline) {
151  $this->readableRootline = $rootline;
152  }
153 
159  public function getReadableRootline() {
161  }
162 
168  protected function canCreate() {
169  if (!isset($this->cachedAccessRights['create'])) {
170  $this->cachedAccessRights['create'] = $GLOBALS['BE_USER']->doesUserHaveAccess($this->record, 8);
171  }
172  return $this->cachedAccessRights['create'];
173  }
174 
180  protected function canEdit() {
181  if (!isset($this->cachedAccessRights['edit'])) {
182  $this->cachedAccessRights['edit'] = $GLOBALS['BE_USER']->doesUserHaveAccess($this->record, 2);
183  }
184  return $this->cachedAccessRights['edit'];
185  }
186 
192  protected function canRemove() {
193  if (!isset($this->cachedAccessRights['remove'])) {
194  $this->cachedAccessRights['remove'] = $GLOBALS['BE_USER']->doesUserHaveAccess($this->record, 4);
195  if (!$this->isLeafNode() && !$GLOBALS['BE_USER']->uc['recursiveDelete']) {
196  $this->cachedAccessRights['remove'] = FALSE;
197  }
198  }
199  return $this->cachedAccessRights['remove'];
200  }
201 
207  public function canBeDisabledAndEnabled() {
208  return $this->canEdit($this->record) && $GLOBALS['BE_USER']->checkLanguageAccess(0);
209  }
210 
216  public function canBeCut() {
217  return (
218  $this->canEdit($this->record)
219  && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
220  && $GLOBALS['BE_USER']->checkLanguageAccess(0)
221  );
222  }
223 
229  public function canBeEdited() {
230  return $this->canEdit($this->record) && $GLOBALS['BE_USER']->checkLanguageAccess(0);
231  }
232 
238  public function canBeCopied() {
239  return (
240  $this->canCreate($this->record)
241  && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
242  && $GLOBALS['BE_USER']->checkLanguageAccess(0)
243  );
244  }
245 
251  public function canCreateNewPages() {
252  return $this->canCreate($this->record) && $GLOBALS['BE_USER']->checkLanguageAccess(0);
253  }
254 
260  public function canBeRemoved() {
261  return (
262  $this->canRemove($this->record)
263  && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
264  && $GLOBALS['BE_USER']->checkLanguageAccess(0)
265  );
266  }
267 
273  public function canBePastedInto() {
274  return (
275  $this->canCreate($this->record)
276  && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
277  && $GLOBALS['BE_USER']->checkLanguageAccess(0)
278  );
279  }
280 
286  public function canBePastedAfter() {
287  return (
288  $this->canCreate($this->record)
289  && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
290  && $GLOBALS['BE_USER']->checkLanguageAccess(0)
291  );
292  }
293 
299  public function canShowHistory() {
300  return $GLOBALS['BE_USER']->checkLanguageAccess(0);
301  }
302 
308  public function canBeViewed() {
309  return !$this->isDeleted();
310  }
311 
317  public function canShowInfo() {
318  return TRUE;
319  }
320 
326  public function canBeTemporaryMountPoint() {
327  return TRUE;
328  }
329 
335  public function isDeleted() {
336  return (
337  !empty($this->record['deleted'])
338  || VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
339  );
340  }
341 
348  public function calculateNodeId($prefix = 'p') {
349  return $prefix . dechex($this->getId()) . ($this->getMountPoint() ? '-' . dechex($this->getMountPoint()) : '');
350  }
351 
358  public function toArray($addChildNodes = TRUE) {
359  $arrayRepresentation = parent::toArray();
360  $arrayRepresentation['id'] = $this->calculateNodeId();
361  $arrayRepresentation['realId'] = $this->getId();
362  $arrayRepresentation['nodeData']['id'] = $this->getId();
363  $arrayRepresentation['readableRootline'] = $this->getReadableRootline();
364  $arrayRepresentation['nodeData']['readableRootline'] = $this->getReadableRootline();
365  $arrayRepresentation['nodeData']['mountPoint'] = $this->getMountPoint();
366  $arrayRepresentation['nodeData']['workspaceId'] = $this->getWorkspaceId();
367  $arrayRepresentation['nodeData']['isMountPoint'] = $this->isMountPoint();
368  $arrayRepresentation['nodeData']['backgroundColor'] = htmlspecialchars($this->getBackgroundColor());
369  $arrayRepresentation['nodeData']['serializeClassName'] = get_class($this);
370  return $arrayRepresentation;
371  }
372 
379  public function dataFromArray($data) {
380  parent::dataFromArray($data);
381  $this->setWorkspaceId($data['workspaceId']);
382  $this->setMountPoint($data['mountPoint']);
383  $this->setReadableRootline($data['readableRootline']);
384  $this->setIsMountPoint($data['isMountPoint']);
385  $this->setBackgroundColor($data['backgroundColor']);
386  }
387 
388 }
equals(\TYPO3\CMS\Backend\Tree\TreeNode $other)
Definition: TreeNode.php:149
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]