TYPO3 CMS  TYPO3_6-2
UserStorageCapabilityService.php
Go to the documentation of this file.
1 <?php
3 
17 use \TYPO3\CMS\Core\Resource\ResourceFactory;
18 
23 
34  public function renderIsPublic(array $propertyArray, \TYPO3\CMS\Backend\Form\FormEngine $tceformsObj) {
35 
36  $isPublic = $GLOBALS['TCA']['sys_file_storage']['columns']['is_public']['config']['default'];
37  $fileRecord = $propertyArray['row'];
38 
39  // Makes sure the storage object can be retrieved which is not the case when new storage.
40  if ((int)$propertyArray['row']['uid'] > 0) {
41  $storage = ResourceFactory::getInstance()->getStorageObject($fileRecord['uid']);
42  $storageRecord = $storage->getStorageRecord();
43  $isPublic = $storage->isPublic() && $storageRecord['is_public'];
44 
45  // Display a warning to the BE User in case settings is not inline with storage capability.
46  if ($storageRecord['is_public'] && !$storage->isPublic()) {
47  $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
48  $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.message.storage_is_no_public'),
49  $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.header.storage_is_no_public'),
50  \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING
51  );
52 
53  \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($message);
54  }
55  }
56 
57  return $this->renderFileInformationContent($fileRecord, $isPublic);
58  }
59 
67  protected function renderFileInformationContent(array $fileRecord, $isPublic) {
68  $template = '
69  <div class="t3-form-field-item">
70  <input name="data[sys_file_storage][{uid}][is_public]" value="0" type="hidden">
71  <input class="checkbox" value="1" name="data[sys_file_storage][{uid}][is_public]_0" type="checkbox" %s>
72  </div>';
73 
74  $content = sprintf($template,
75  $isPublic ? 'checked="checked"' : ''
76  );
77 
78  return str_replace('{uid}', $fileRecord['uid'], $content);
79  }
80 
81 }
renderIsPublic(array $propertyArray, \TYPO3\CMS\Backend\Form\FormEngine $tceformsObj)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]