当前位置: 首页>>代码示例>>PHP>>正文


PHP BackendUtility::date方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::date方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::date方法的具体用法?PHP BackendUtility::date怎么用?PHP BackendUtility::date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Backend\Utility\BackendUtility的用法示例。


在下文中一共展示了BackendUtility::date方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tt_content_drawItem

    /**
     * Draws the preview content for a content element
     *
     * @param array $row Content element
     * @return string HTML
     * @throws \UnexpectedValueException
     */
    public function tt_content_drawItem($row)
    {
        $out = '';
        $outHeader = '';
        // Make header:
        if ($row['header']) {
            $infoArr = array();
            $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
            $hiddenHeaderNote = '';
            // If header layout is set to 'hidden', display an accordant note:
            if ($row['header_layout'] == 100) {
                $hiddenHeaderNote = ' <em>[' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.hidden', true) . ']</em>';
            }
            $outHeader = $row['date'] ? htmlspecialchars($this->itemLabels['date'] . ' ' . BackendUtility::date($row['date'])) . '<br />' : '';
            $outHeader .= '<strong>' . $this->linkEditContent($this->renderText($row['header']), $row) . $hiddenHeaderNote . '</strong><br />';
        }
        // Make content:
        $infoArr = array();
        $drawItem = true;
        // Hook: Render an own preview of a record
        $drawItemHooks =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'];
        if (is_array($drawItemHooks)) {
            foreach ($drawItemHooks as $hookClass) {
                $hookObject = GeneralUtility::getUserObj($hookClass);
                if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface) {
                    throw new \UnexpectedValueException('$hookObject must implement interface ' . \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface::class, 1218547409);
                }
                $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
            }
        }
        // If the previous hook did not render something,
        // then check if a Fluid-based preview template was defined for this CType
        // and render it via Fluid. Possible option:
        // mod.web_layout.tt_content.preview.media = EXT:site_mysite/Resources/Private/Templates/Preview/Media.html
        if ($drawItem) {
            $tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod.web_layout.tt_content.preview');
            if (!empty($tsConfig['properties'][$row['CType']])) {
                $fluidTemplateFile = $tsConfig['properties'][$row['CType']];
                $fluidTemplateFile = GeneralUtility::getFileAbsFileName($fluidTemplateFile);
                if ($fluidTemplateFile) {
                    try {
                        /** @var StandaloneView $view */
                        $view = GeneralUtility::makeInstance(StandaloneView::class);
                        $view->setTemplatePathAndFilename($fluidTemplateFile);
                        $view->assignMultiple($row);
                        if (!empty($row['pi_flexform'])) {
                            /** @var FlexFormService $flexFormService */
                            $flexFormService = GeneralUtility::makeInstance(FlexFormService::class);
                            $view->assign('pi_flexform_transformed', $flexFormService->convertFlexFormContentToArray($row['pi_flexform']));
                        }
                        $out = $view->render();
                        $drawItem = false;
                    } catch (\Exception $e) {
                        // Catch any exception to avoid breaking the view
                    }
                }
            }
        }
        // Draw preview of the item depending on its CType (if not disabled by previous hook):
        if ($drawItem) {
            switch ($row['CType']) {
                case 'header':
                    if ($row['subheader']) {
                        $out .= $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
                    }
                    break;
                case 'bullets':
                case 'table':
                    if ($row['bodytext']) {
                        $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                    }
                    break;
                case 'uploads':
                    if ($row['media']) {
                        $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'media'), $row) . '<br />';
                    }
                    break;
                case 'menu':
                    $contentType = $this->CType_labels[$row['CType']];
                    $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
                    // Add Menu Type
                    $menuTypeLabel = $this->getLanguageService()->sL(BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'menu_type', $row['menu_type']));
                    $menuTypeLabel = $menuTypeLabel ?: 'invalid menu type';
                    $out .= $this->linkEditContent($menuTypeLabel, $row);
                    if ($row['menu_type'] !== '2' && ($row['pages'] || $row['selected_categories'])) {
                        // Show pages if menu type is not "Sitemap"
                        $out .= ':' . $this->linkEditContent($this->generateListForCTypeMenu($row), $row) . '<br />';
                    }
                    break;
                case 'shortcut':
                    if (!empty($row['records'])) {
                        $shortcutContent = array();
                        $recordList = explode(',', $row['records']);
//.........这里部分代码省略.........
开发者ID:Audibene-GMBH,项目名称:TYPO3.CMS,代码行数:101,代码来源:PageLayoutView.php

示例2: tt_content_drawItem

    /**
     * Draws the preview content for a content element
     *
     * @param string $row Content element
     * @param boolean $isRTE Set if the RTE link can be created.
     * @return string HTML
     * @throws \UnexpectedValueException
     * @todo Define visibility
     */
    public function tt_content_drawItem($row, $isRTE = FALSE)
    {
        $out = '';
        $outHeader = '';
        // Make header:
        if ($row['header']) {
            $infoArr = array();
            $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
            $hiddenHeaderNote = '';
            // If header layout is set to 'hidden', display an accordant note:
            if ($row['header_layout'] == 100) {
                $hiddenHeaderNote = ' <em>[' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.hidden', TRUE) . ']</em>';
            }
            $outHeader = $row['date'] ? htmlspecialchars($this->itemLabels['date'] . ' ' . BackendUtility::date($row['date'])) . '<br />' : '';
            $outHeader .= '<strong>' . $this->linkEditContent($this->renderText($row['header']), $row) . $hiddenHeaderNote . '</strong><br />';
        }
        // Make content:
        $infoArr = array();
        $drawItem = TRUE;
        // Hook: Render an own preview of a record
        $drawItemHooks =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'];
        if (is_array($drawItemHooks)) {
            foreach ($drawItemHooks as $hookClass) {
                $hookObject = GeneralUtility::getUserObj($hookClass);
                if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface) {
                    throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\View\\PageLayoutViewDrawItemHookInterface', 1218547409);
                }
                $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
            }
        }
        // Draw preview of the item depending on its CType (if not disabled by previous hook):
        if ($drawItem) {
            switch ($row['CType']) {
                case 'header':
                    if ($row['subheader']) {
                        $out .= $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
                    }
                    break;
                case 'text':
                case 'textpic':
                case 'image':
                    if ($row['CType'] == 'text' || $row['CType'] == 'textpic') {
                        if ($row['bodytext']) {
                            $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                        }
                    }
                    if ($row['CType'] == 'textpic' || $row['CType'] == 'image') {
                        if ($row['image']) {
                            $out .= $this->thumbCode($row, 'tt_content', 'image') . '<br />';
                            if ($row['imagecaption']) {
                                $out .= $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
                            }
                        }
                    }
                    break;
                case 'bullets':
                case 'table':
                case 'mailform':
                    if ($row['bodytext']) {
                        $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                    }
                    break;
                case 'uploads':
                    if ($row['media']) {
                        $out .= $this->thumbCode($row, 'tt_content', 'media') . '<br />';
                    }
                    break;
                case 'multimedia':
                    if ($row['multimedia']) {
                        $out .= $this->renderText($row['multimedia']) . '<br />';
                        $out .= $this->renderText($row['parameters']) . '<br />';
                    }
                    break;
                case 'menu':
                    if ($row['pages']) {
                        $out .= $this->linkEditContent($row['pages'], $row) . '<br />';
                    }
                    break;
                case 'shortcut':
                    if (!empty($row['records'])) {
                        $shortcutContent = array();
                        $recordList = explode(',', $row['records']);
                        foreach ($recordList as $recordIdentifier) {
                            $split = BackendUtility::splitTable_Uid($recordIdentifier);
                            $tableName = empty($split[0]) ? 'tt_content' : $split[0];
                            $shortcutRecord = BackendUtility::getRecord($tableName, $split[1]);
                            if (is_array($shortcutRecord)) {
                                $icon = IconUtility::getSpriteIconForRecord($tableName, $shortcutRecord);
                                $onClick = $this->getPageLayoutController()->doc->wrapClickMenuOnIcon($icon, $tableName, $shortcutRecord['uid'], 1, '', '+copy,info,edit,view', TRUE);
                                $shortcutContent[] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $icon . '</a>' . htmlspecialchars(BackendUtility::getRecordTitle($tableName, $shortcutRecord));
                            }
//.........这里部分代码省略.........
开发者ID:allipierre,项目名称:Typo3,代码行数:101,代码来源:PageLayoutView.php

示例3: formatFileList

 /**
  * This returns tablerows for the files in the array $items['sorting'].
  *
  * @param File[] $files File items
  * @return string HTML table rows.
  */
 public function formatFileList(array $files)
 {
     $out = '';
     // first two keys are "0" (default) and "-1" (multiple), after that comes the "other languages"
     $allSystemLanguages = GeneralUtility::makeInstance(TranslationConfigurationProvider::class)->getSystemLanguages();
     $systemLanguages = array_filter($allSystemLanguages, function ($languageRecord) {
         if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$this->getBackendUser()->checkLanguageAccess($languageRecord['uid'])) {
             return FALSE;
         } else {
             return TRUE;
         }
     });
     foreach ($files as $fileObject) {
         // Initialization
         $this->counter++;
         $this->totalbytes += $fileObject->getSize();
         $ext = $fileObject->getExtension();
         $fileName = trim($fileObject->getName());
         // The icon with link
         $theIcon = IconUtility::getSpriteIconForResource($fileObject, array('title' => $fileName . ' [' . (int) $fileObject->getUid() . ']'));
         if ($this->clickMenus) {
             $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier());
         }
         // Preparing and getting the data-array
         $theData = array();
         foreach ($this->fieldArray as $field) {
             switch ($field) {
                 case 'size':
                     $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $this->getLanguageService()->getLL('byteSizeUnits', TRUE));
                     break;
                 case 'rw':
                     $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('read', TRUE) . '</strong>') . (!$fileObject->checkActionPermission('write') ? '' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('write', TRUE) . '</strong>');
                     break;
                 case 'fileext':
                     $theData[$field] = strtoupper($ext);
                     break;
                 case 'tstamp':
                     $theData[$field] = BackendUtility::date($fileObject->getModificationTime());
                     break;
                 case '_CONTROL_':
                     $theData[$field] = $this->makeEdit($fileObject);
                     break;
                 case '_CLIPBOARD_':
                     $theData[$field] = $this->makeClip($fileObject);
                     break;
                 case '_LOCALIZATION_':
                     if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission('write') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata')) {
                         $metaDataRecord = $fileObject->_getMetaData();
                         $translations = $this->getTranslationsForMetaData($metaDataRecord);
                         $languageCode = '';
                         foreach ($systemLanguages as $language) {
                             $languageId = $language['uid'];
                             $flagIcon = $language['flagIcon'];
                             if (array_key_exists($languageId, $translations)) {
                                 $flagButtonIcon = IconUtility::getSpriteIcon('actions-document-open', array('title' => sprintf($GLOBALS['LANG']->getLL('editMetadataForLanguage'), $language['title'])), array($flagIcon . '-overlay' => array()));
                                 $data = array('sys_file_metadata' => array($translations[$languageId]['uid'] => 'edit'));
                                 $editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl());
                                 $languageCode .= '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) . '">' . $flagButtonIcon . '</a>';
                             } else {
                                 $parameters = ['justLocalized' => 'sys_file_metadata:' . $metaDataRecord['uid'] . ':' . $languageId, 'returnUrl' => $this->listURL()];
                                 $returnUrl = BackendUtility::getModuleUrl('record_edit', $parameters, $this->backPath) . BackendUtility::getUrlToken('editRecord');
                                 $href = $GLOBALS['SOBE']->doc->issueCommand('&cmd[sys_file_metadata][' . $metaDataRecord['uid'] . '][localize]=' . $languageId, $returnUrl);
                                 $flagButtonIcon = IconUtility::getSpriteIcon($flagIcon, array('title' => sprintf($GLOBALS['LANG']->getLL('createMetadataForLanguage'), $language['title'])), array($flagIcon . '-overlay' => array()));
                                 $languageCode .= '<a href="' . htmlspecialchars($href) . '" class="btn btn-default">' . $flagButtonIcon . '</a> ';
                             }
                         }
                         // Hide flag button bar when not translated yet
                         $theData[$field] = ' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() . '"' . (empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>';
                         $theData[$field] .= '<a class="btn btn-default filelist-translationToggler" data-fileid="' . $fileObject->getUid() . '">' . IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay', array('title' => $GLOBALS['LANG']->getLL('translateMetadata'))) . '</a>';
                     }
                     break;
                 case '_REF_':
                     $theData[$field] = $this->makeRef($fileObject);
                     break;
                 case 'file':
                     // Edit metadata of file
                     $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject);
                     if ($fileObject->isMissing()) {
                         $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
                         $theData[$field] .= $flashMessage->render();
                         // Thumbnails?
                     } elseif ($this->thumbs && $this->isImage($ext)) {
                         $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
                         if ($processedFile) {
                             $thumbUrl = $processedFile->getPublicUrl(TRUE);
                             $theData[$field] .= '<br /><img src="' . $thumbUrl . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'title="' . htmlspecialchars($fileName) . '" alt="" />';
                         }
                     }
                     break;
                 default:
                     $theData[$field] = '';
                     if ($fileObject->hasProperty($field)) {
                         $theData[$field] = htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getProperty($field), $this->fixedL));
                     }
//.........这里部分代码省略.........
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:101,代码来源:FileList.php

示例4: getLastModified

 /**
  * @return string
  */
 public function getLastModified()
 {
     return BackendUtility::date($this->resource->getModificationTime());
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:7,代码来源:FileFacade.php

示例5: getRecordTitleForInputType

 /**
  * Returns the record title for input fields
  *
  * @param mixed $value Current database value of this field
  * @param array $fieldConfig TCA field configuration
  * @return string
  */
 protected function getRecordTitleForInputType($value, $fieldConfig)
 {
     if (!isset($value)) {
         return '';
     }
     $title = $value;
     if (GeneralUtility::inList($fieldConfig['eval'], 'date')) {
         if (isset($fieldConfig['dbType']) && $fieldConfig['dbType'] === 'date') {
             $value = $value === '0000-00-00' ? 0 : (int) strtotime($value);
         } else {
             $value = (int) $value;
         }
         if (!empty($value)) {
             $ageSuffix = '';
             // Generate age suffix as long as not explicitly suppressed
             if (!isset($fieldConfig['disableAgeDisplay']) || (bool) $fieldConfig['disableAgeDisplay'] === false) {
                 $ageDelta = $GLOBALS['EXEC_TIME'] - $value;
                 $calculatedAge = BackendUtility::calcAge(abs($ageDelta), $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears'));
                 $ageSuffix = ' (' . ($ageDelta > 0 ? '-' : '') . $calculatedAge . ')';
             }
             $title = BackendUtility::date($value) . $ageSuffix;
         }
     } elseif (GeneralUtility::inList($fieldConfig['eval'], 'time')) {
         if (!empty($value)) {
             $title = BackendUtility::time((int) $value, false);
         }
     } elseif (GeneralUtility::inList($fieldConfig['eval'], 'timesec')) {
         if (!empty($value)) {
             $title = BackendUtility::time((int) $value);
         }
     } elseif (GeneralUtility::inList($fieldConfig['eval'], 'datetime')) {
         // Handle native date/time field
         if (isset($fieldConfig['dbType']) && $fieldConfig['dbType'] === 'datetime') {
             $value = $value === '0000-00-00 00:00:00' ? 0 : (int) strtotime($value);
         } else {
             $value = (int) $value;
         }
         if (!empty($value)) {
             $title = BackendUtility::datetime($value);
         }
     }
     return $title;
 }
开发者ID:hlop,项目名称:TYPO3.CMS,代码行数:50,代码来源:TcaRecordTitle.php

示例6: makeListDMail

 /**
  * List all direct mail, which have not been sent (first step)
  *
  * @param string $boxId ID name for the HTML element
  * @param int $totalBox Total of the boxes
  * @param bool $open State of the box
  *
  * @return string HTML lists of all existing dmail records
  */
 public function makeListDMail($boxId, $totalBox, $open = false)
 {
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,subject,tstamp,issent,renderedsize,attachment,type', 'sys_dmail', 'pid = ' . intval($this->id) . ' AND scheduled=0 AND issent=0' . BackendUtility::deleteClause('sys_dmail'), '', $GLOBALS['TYPO3_DB']->stripOrderBy($GLOBALS['TCA']['sys_dmail']['ctrl']['default_sortby']));
     $tblLines = array();
     $tblLines[] = array('', $this->getLanguageService()->getLL('nl_l_subject'), $this->getLanguageService()->getLL('nl_l_lastM'), $this->getLanguageService()->getLL('nl_l_sent'), $this->getLanguageService()->getLL('nl_l_size'), $this->getLanguageService()->getLL('nl_l_attach'), $this->getLanguageService()->getLL('nl_l_type'), '');
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $tblLines[] = array($this->iconFactory->getIconForRecord('sys_dmail', $row, Icon::SIZE_SMALL)->render(), $this->linkDMail_record($row['subject'], $row['uid']), BackendUtility::date($row['tstamp']), $row['issent'] ? $this->getLanguageService()->getLL('dmail_yes') : $this->getLanguageService()->getLL('dmail_no'), $row['renderedsize'] ? GeneralUtility::formatSize($row['renderedsize']) : '', $row['attachment'] ? $this->iconFactory->getIcon('directmail-attachment', Icon::SIZE_SMALL) : '', ($row['type'] & 0x1 ? $this->getLanguageService()->getLL('nl_l_tUrl') : $this->getLanguageService()->getLL('nl_l_tPage')) . ($row['type'] & 0x2 ? ' (' . $this->getLanguageService()->getLL('nl_l_tDraft') . ')' : ''), $this->deleteLink($row['uid']));
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     $imgSrc = $this->getNewsletterTabIcon($open);
     $output = '<div id="header" class="box"><div class="toggleTitle">';
     $output .= '<a href="#" onclick="toggleDisplay(\'' . $boxId . '\', event, ' . $totalBox . ')">' . $imgSrc . $this->getLanguageService()->getLL('dmail_wiz1_list_dmail') . '</a>';
     $output .= '</div><div id="' . $boxId . '" class="toggleBox" style="display:' . ($open ? 'block' : 'none') . '">';
     $output .= '<h3>' . $this->getLanguageService()->getLL('dmail_wiz1_list_header') . '</h3>';
     $output .= DirectMailUtility::formatTable($tblLines, array(), 1, array(1, 1, 1, 0, 0, 1, 0, 1));
     $output .= '</div></div>';
     return $output;
 }
开发者ID:kartolo,项目名称:direct_mail,代码行数:27,代码来源:Dmail.php

示例7: formatFileList

 /**
  * This returns tablerows for the files in the array $items['sorting'].
  *
  * @param \TYPO3\CMS\Core\Resource\File[] $files File items
  * @return string HTML table rows.
  * @todo Define visibility
  */
 public function formatFileList(array $files)
 {
     $out = '';
     // first two keys are "0" (default) and "-1" (multiple), after that comes the "other languages"
     $allSystemLanguages = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Configuration\\TranslationConfigurationProvider')->getSystemLanguages();
     $systemLanguages = array_filter($allSystemLanguages, function ($languageRecord) {
         if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$GLOBALS['BE_USER']->checkLanguageAccess($languageRecord['uid'])) {
             return FALSE;
         } else {
             return TRUE;
         }
     });
     foreach ($files as $fileObject) {
         list($flag, $code) = $this->fwd_rwd_nav();
         $out .= $code;
         if ($flag) {
             // Initialization
             $this->counter++;
             $this->totalbytes += $fileObject->getSize();
             $ext = $fileObject->getExtension();
             $fileName = trim($fileObject->getName());
             // The icon with link
             $theIcon = IconUtility::getSpriteIconForResource($fileObject, array('title' => $fileName));
             if ($this->clickMenus) {
                 $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier());
             }
             // Preparing and getting the data-array
             $theData = array();
             foreach ($this->fieldArray as $field) {
                 switch ($field) {
                     case 'size':
                         $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $GLOBALS['LANG']->getLL('byteSizeUnits', TRUE));
                         break;
                     case 'rw':
                         $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<span class="typo3-red"><strong>' . $GLOBALS['LANG']->getLL('read', TRUE) . '</strong></span>') . (!$fileObject->checkActionPermission('write') ? '' : '<span class="typo3-red"><strong>' . $GLOBALS['LANG']->getLL('write', TRUE) . '</strong></span>');
                         break;
                     case 'fileext':
                         $theData[$field] = strtoupper($ext);
                         break;
                     case 'tstamp':
                         $theData[$field] = BackendUtility::date($fileObject->getProperty('modification_date'));
                         break;
                     case '_CLIPBOARD_':
                         $temp = '';
                         if ($this->bigControlPanel) {
                             $temp .= $this->makeEdit($fileObject);
                         }
                         $temp .= $this->makeClip($fileObject);
                         if (!empty($systemLanguages)) {
                             $temp .= '<a class="filelist-translationToggler" data-fileid="' . $fileObject->getUid() . '">' . IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay') . '</a>';
                         }
                         $theData[$field] = $temp;
                         break;
                     case '_REF_':
                         $theData[$field] = $this->makeRef($fileObject);
                         break;
                     case 'file':
                         $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject);
                         if ($fileObject->isMissing()) {
                             $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
                             $theData[$field] .= $flashMessage->render();
                             // Thumbnails?
                         } elseif ($this->thumbs && $this->isImage($ext)) {
                             $processedFile = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
                             if ($processedFile) {
                                 $thumbUrl = $processedFile->getPublicUrl(TRUE);
                                 $theData[$field] .= '<br /><img src="' . $thumbUrl . '" title="' . htmlspecialchars($fileName) . '" alt="" />';
                             }
                         }
                         if (!empty($systemLanguages)) {
                             $metaDataRecord = $fileObject->_getMetaData();
                             $translations = $this->getTranslationsForMetaData($metaDataRecord);
                             $languageCode = '';
                             foreach ($systemLanguages as $language) {
                                 $languageId = $language['uid'];
                                 $flagIcon = $language['flagIcon'];
                                 if (array_key_exists($languageId, $translations)) {
                                     $flagButtonIcon = IconUtility::getSpriteIcon('actions-document-open', array('title' => $fileName), array($flagIcon . '-overlay' => array()));
                                     $data = array('sys_file_metadata' => array($translations[$languageId]['uid'] => 'edit'));
                                     $editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl());
                                     $languageCode .= sprintf('<a href="#" onclick="%s">%s</a>', htmlspecialchars($editOnClick), $flagButtonIcon);
                                 } else {
                                     $href = $GLOBALS['SOBE']->doc->issueCommand('&cmd[sys_file_metadata][' . $metaDataRecord['uid'] . '][localize]=' . $languageId, $this->backPath . 'alt_doc.php?justLocalized=' . rawurlencode('sys_file_metadata:' . $metaDataRecord['uid'] . ':' . $languageId) . '&returnUrl=' . rawurlencode($this->listURL()) . BackendUtility::getUrlToken('editRecord'));
                                     $flagButtonIcon = IconUtility::getSpriteIcon($flagIcon);
                                     $languageCode .= sprintf('<a href="%s">%s</a> ', htmlspecialchars($href), $flagButtonIcon);
                                 }
                             }
                             // Hide flag button bar when not translated yet
                             $theData[$field] .= '<div class="localisationData" data-fileid="' . $fileObject->getUid() . '"' . (empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>';
                         }
                         break;
                     default:
                         $theData[$field] = '';
//.........这里部分代码省略.........
开发者ID:allipierre,项目名称:Typo3,代码行数:101,代码来源:FileList.php

示例8: formatFileList

 /**
  * This returns tablerows for the files in the array $items['sorting'].
  *
  * @param \TYPO3\CMS\Core\Resource\File[] $files File items
  * @return string HTML table rows.
  * @todo Define visibility
  */
 public function formatFileList(array $files)
 {
     $out = '';
     foreach ($files as $fileObject) {
         list($flag, $code) = $this->fwd_rwd_nav();
         $out .= $code;
         if ($flag) {
             // Initialization
             $this->counter++;
             $fileInfo = $fileObject->getStorage()->getFileInfo($fileObject);
             $this->totalbytes += $fileObject->getSize();
             $ext = $fileObject->getExtension();
             $fileName = trim($fileObject->getName());
             // The icon with link
             $theIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForFile($ext, array('title' => $fileName));
             if ($this->clickMenus) {
                 $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier());
             }
             // Preparing and getting the data-array
             $theData = array();
             foreach ($this->fieldArray as $field) {
                 switch ($field) {
                     case 'size':
                         $theData[$field] = \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($fileObject->getSize(), $GLOBALS['LANG']->getLL('byteSizeUnits', TRUE));
                         break;
                     case 'rw':
                         $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<span class="typo3-red"><strong>' . $GLOBALS['LANG']->getLL('read', TRUE) . '</strong></span>') . (!$fileObject->checkActionPermission('write') ? '' : '<span class="typo3-red"><strong>' . $GLOBALS['LANG']->getLL('write', TRUE) . '</strong></span>');
                         break;
                     case 'fileext':
                         $theData[$field] = strtoupper($ext);
                         break;
                     case 'tstamp':
                         $theData[$field] = \TYPO3\CMS\Backend\Utility\BackendUtility::date($fileInfo['mtime']);
                         break;
                     case '_CLIPBOARD_':
                         $temp = '';
                         if ($this->bigControlPanel) {
                             $temp .= $this->makeEdit($fileObject);
                         }
                         $temp .= $this->makeClip($fileObject);
                         $theData[$field] = $temp;
                         break;
                     case '_REF_':
                         $theData[$field] = $this->makeRef($fileObject);
                         break;
                     case 'file':
                         $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject);
                         // Thumbnails?
                         if ($this->thumbs && $this->isImage($ext)) {
                             $processedFile = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
                             if ($processedFile) {
                                 $thumbUrl = $processedFile->getPublicUrl(TRUE);
                                 $theData[$field] .= '<br /><img src="' . $thumbUrl . '" hspace="2" title="' . htmlspecialchars($fileName) . '" alt="" />';
                             }
                         }
                         break;
                     default:
                         // @todo: fix the access on the array
                         $theData[$field] = htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($theFile[$field], $this->fixedL));
                         break;
                 }
             }
             $out .= $this->addelement(1, $theIcon, $theData, ' class="file_list_normal"');
         }
         $this->eCounter++;
     }
     return $out;
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:75,代码来源:FileList.php

示例9: flattenResultDataValue

 /**
  * Flatten result value from FileProcessor
  *
  * The value can be a File, Folder or boolean
  *
  * @param bool|\TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $result
  * @return bool|string|array
  */
 protected function flattenResultDataValue($result)
 {
     if ($result instanceof \TYPO3\CMS\Core\Resource\File) {
         $thumbUrl = '';
         if (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $result->getExtension())) {
             $processedFile = $result->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
             if ($processedFile) {
                 $thumbUrl = $processedFile->getPublicUrl(true);
             }
         }
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         $result = array_merge($result->toArray(), array('date' => BackendUtility::date($result->getModificationTime()), 'icon' => $iconFactory->getIconForFileExtension($result->getExtension(), Icon::SIZE_SMALL)->render(), 'thumbUrl' => $thumbUrl));
     } elseif ($result instanceof \TYPO3\CMS\Core\Resource\Folder) {
         $result = $result->getIdentifier();
     }
     return $result;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:25,代码来源:FileController.php

示例10: makeListDMail

 /**
  * list all direct mail, which have not been sent (first step)
  *
  * @param	string		$boxID: ID name for the HTML element
  * @param	integer		$totalBox: total of the boxes
  * @param	bool		$open: state of the box
  * @return	string		HTML lists of all existing dmail records
  */
 function makeListDMail($boxID, $totalBox, $open = FALSE)
 {
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,subject,tstamp,issent,renderedsize,attachment,type', 'sys_dmail', 'pid = ' . intval($this->id) . ' AND scheduled=0 AND issent=0' . BackendUtility::deleteClause('sys_dmail'), '', $GLOBALS['TYPO3_DB']->stripOrderBy($GLOBALS['TCA']['sys_dmail']['ctrl']['default_sortby']));
     $tblLines = array();
     $tblLines[] = array('', $GLOBALS['LANG']->getLL('nl_l_subject'), $GLOBALS['LANG']->getLL('nl_l_lastM'), $GLOBALS['LANG']->getLL('nl_l_sent'), $GLOBALS['LANG']->getLL('nl_l_size'), $GLOBALS['LANG']->getLL('nl_l_attach'), $GLOBALS['LANG']->getLL('nl_l_type'), '');
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $tblLines[] = array(IconUtility::getSpriteIconForRecord('sys_dmail', $row), $this->linkDMail_record($row['subject'], $row['uid']), BackendUtility::date($row['tstamp']), $row['issent'] ? $GLOBALS['LANG']->getLL('dmail_yes') : $GLOBALS['LANG']->getLL('dmail_no'), $row['renderedsize'] ? GeneralUtility::formatSize($row['renderedsize']) : '', $row['attachment'] ? '<img ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], ExtensionManagementUtility::extRelPath($this->extKey) . 'res/gfx/attach.gif', 'width="9" height="13"') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('nl_l_attach')) . '" title="' . htmlspecialchars($row['attachment']) . '" width="9" height="13">' : '', ($row['type'] & 0x1 ? $GLOBALS['LANG']->getLL('nl_l_tUrl') : $GLOBALS['LANG']->getLL('nl_l_tPage')) . ($row['type'] & 0x2 ? ' (' . $GLOBALS['LANG']->getLL('nl_l_tDraft') . ')' : ''), $this->deleteLink($row['uid']));
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     $imgSrc = IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/button_' . ($open ? 'down' : 'right') . '.gif');
     $output = '<div id="header" class="box"><div class="toggleTitle">';
     $output .= '<a href="#" onclick="toggleDisplay(\'' . $boxID . '\', event, ' . $totalBox . ')"><img id="' . $boxID . '_toggle" ' . $imgSrc . ' alt="" >' . $GLOBALS['LANG']->getLL('dmail_wiz1_list_dmail') . '</a>';
     $output .= '</div><div id="' . $boxID . '" class="toggleBox" style="display:' . ($open ? 'block' : 'none') . '">';
     $output .= '<h3>' . $GLOBALS['LANG']->getLL('dmail_wiz1_list_header') . '</h3>';
     $output .= DirectMailUtility::formatTable($tblLines, array(), 1, array(1, 1, 1, 0, 0, 1, 0, 1), 'border="0" cellspacing="0" cellpadding="3"');
     $output .= '</div></div>';
     return $output;
 }
开发者ID:preinboth,项目名称:direct_mail,代码行数:26,代码来源:Dmail.php

示例11: renderListRow

 /**
  * Rendering a single row for the list
  *
  * @param string $table Table name
  * @param array $row Current record
  * @param int $cc Counter, counting for each time an element
  * 	is rendered (used for alternating colors)
  * @param string $titleCol Table field (column) where header value is found
  * @param string $thumbsCol Table field (column) where (possible)
  * 	thumbnails can be found
  * @param int $indent Indent from left.
  *
  * @return string Table row for the element
  * @see getTable()
  */
 public function renderListRow($table, array $row, $cc, $titleCol, $thumbsCol, $indent = 0)
 {
     $backendUser = $this->getBackendUser();
     $iOut = '';
     $extConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['extConf'];
     if (substr(TYPO3_version, 0, 3) >= '4.0') {
         // In offline workspace, look for alternative record:
         BackendUtility::workspaceOL($table, $row, $GLOBALS['BE_USER']->workspace);
     }
     $rowBackgroundColor = '';
     if ($this->alternateBgColors) {
         $rowBackgroundColor = $cc % 2 ? '' : ' bgcolor="' . GeneralUtility::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4, 10, 10, 10) . '"';
     }
     if ($backendUser->getModuleData('commerce_orders/index.php/userid', 'ses') == $row['uid']) {
         $rowBackgroundColor = ' bgcolor="' . GeneralUtility::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4, 30, 30, 30) . '"';
     }
     // Overriding with versions background color if any:
     $rowBackgroundColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $rowBackgroundColor;
     // Initialization
     $alttext = BackendUtility::getRecordIconAltText($row, $table);
     // Incr. counter.
     $this->counter++;
     // The icon with link
     $iconImg = IconUtility::skinImg($this->backPath, IconUtility::getIcon($table, $row), 'title="' . htmlspecialchars($alttext) . '"' . ($indent ? ' style="margin-left: ' . $indent . 'px;"' : ''));
     $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg;
     // Preparing and getting the data-array
     $theData = array();
     foreach ($this->fieldArray as $fCol) {
         if ($fCol == 'pid') {
             $theData[$fCol] = $row[$fCol];
         }
         if ($fCol == 'username') {
             $theData[$fCol] = $row[$fCol];
         } elseif ($fCol == 'crdate') {
             $theData[$fCol] = BackendUtility::date($row[$fCol]);
         } elseif ($fCol == '_PATH_') {
             $theData[$fCol] = $this->recPath($row['pid']);
         } elseif ($fCol == '_CONTROL_') {
             $theData[$fCol] = $this->makeControl($table, $row);
         } elseif ($fCol == '_CLIPBOARD_') {
             $theData[$fCol] = $this->makeClip($table, $row);
         } elseif ($fCol == '_LOCALIZATION_') {
             list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row);
             $theData[$fCol] = $lC1;
             $theData[$fCol . 'b'] = $lC2;
         } elseif ($fCol == '_LOCALIZATION_b') {
             // Do nothing, has been done above.
             $theData[$fCol] .= '';
         } else {
             /**
              * Use own method, if typo3 4.0.0 is not installed
              */
             if (substr(TYPO3_version, 0, 3) >= '4.0') {
                 $theData[$fCol] = $this->linkUrlMail(htmlspecialchars(BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'])), $row[$fCol]);
             } else {
                 $theData[$fCol] = $this->myLinkUrlMail(htmlspecialchars(BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'])), $row[$fCol]);
             }
         }
     }
     // Add row to CSV list:
     if ($this->csvOutput) {
         // Charset Conversion
         /**
          * Charset converter
          *
          * @var \TYPO3\CMS\Core\Charset\CharsetConverter $csObj
          */
         $csObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter');
         $csObj->initCharset($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']);
         if (!$extConf['BECSVCharset']) {
             $extConf['BECSVCharset'] = 'iso-8859-1';
         }
         $csObj->initCharset($extConf['BECSVCharset']);
         $csObj->convArray($row, $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'], $extConf['BECSVCharset']);
         $this->addToCSV($row);
     }
     // Create element in table cells:
     $iOut .= $this->addelement(1, $theIcon, $theData, $rowBackgroundColor);
     // Render thumbsnails if a thumbnail column exists and there is content in it:
     if ($this->thumbs && trim($row[$thumbsCol])) {
         $iOut .= $this->addelement(4, '', array($titleCol => $this->thumbCode($row, $table, $thumbsCol)), $rowBackgroundColor);
     }
     // Finally, return table row element:
     return $iOut;
 }
开发者ID:AndreasA,项目名称:commerce,代码行数:100,代码来源:FeuserRecordList.php

示例12: flattenResultDataValue

 /**
  * Flatten result value from FileProcessor
  *
  * The value can be a File, Folder or boolean
  *
  * @param bool|\TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $result
  * @return bool|string|array
  */
 protected function flattenResultDataValue($result)
 {
     if ($result instanceof \TYPO3\CMS\Core\Resource\File) {
         $result = array_merge($result->toArray(), array('date' => BackendUtility::date($result->getModificationTime()), 'iconClasses' => \TYPO3\CMS\Backend\Utility\IconUtility::mapFileExtensionToSpriteIconClass($result->getExtension())));
     } elseif ($result instanceof \TYPO3\CMS\Core\Resource\Folder) {
         $result = $result->getIdentifier();
     }
     return $result;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:17,代码来源:FileController.php

示例13: renderListRow

 /**
  * Rendering a single row for the list.
  *
  * @param string $table Table name
  * @param array $row Current record
  * @param int $cc Counter, counting for each time an element is rendered
  *      (used for alternating colors)
  * @param string $titleCol Table field (column) where header value is found
  * @param string $thumbsCol Table field (column) where (possible) thumbnails
  *      can be found
  * @param int $indent Indent from left.
  *
  * @return string Table row for the element
  */
 public function renderListRow($table, array $row, $cc, $titleCol, $thumbsCol, $indent = 0)
 {
     $database = $this->getDatabaseConnection();
     $language = $this->getLanguageService();
     $iOut = '';
     if (substr(TYPO3_version, 0, 3) >= '4.0') {
         // In offline workspace, look for alternative record:
         BackendUtility::workspaceOL($table, $row, $this->getBackendUser()->workspace);
     }
     // Background color, if any:
     $rowBackgroundColor = '';
     if ($this->alternateBgColors) {
         $rowBackgroundColor = $cc % 2 ? '' : ' bgcolor="' . GeneralUtility::modifyHTMLColor($this->getControllerDocumentTemplate()->bgColor4, 10, 10, 10) . '"';
     }
     // Overriding with versions background color if any:
     $rowBackgroundColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $rowBackgroundColor;
     // Initialization
     $alttext = BackendUtility::getRecordIconAltText($row, $table);
     // Incr. counter.
     ++$this->counter;
     $indentStyle = $indent ? ' style="margin-left: ' . $indent . 'px;"' : '';
     $iconAttributes = 'title="' . htmlspecialchars($alttext) . '"' . $indentStyle;
     // Icon for order comment and delivery address
     $iconPath = '';
     $iconImg = '';
     if ($row['comment'] != '' && $row['internalcomment'] != '') {
         if ($row['tx_commerce_address_type_id'] == 2) {
             $iconPath = 'orders_add_user_int.gif';
         } else {
             $iconPath = 'orders_user_int.gif';
         }
     } elseif ($row['comment'] != '') {
         if ($row['tx_commerce_address_type_id'] == 2) {
             $iconPath = 'orders_add_user.gif';
         } else {
             $iconPath = 'orders_user.gif';
         }
     } elseif ($row['internalcomment'] != '') {
         if ($row['tx_commerce_address_type_id'] == 2) {
             $iconPath = 'orders_add_int.gif';
         } else {
             $iconPath = 'orders_int.gif';
         }
     } else {
         if ($row['tx_commerce_address_type_id'] == 2) {
             $iconPath = 'orders_add.gif';
         } else {
             $iconImg = '<img ' . IconUtility::skinImg($this->backPath, IconUtility::getIcon($table, $row), $iconAttributes) . ' />';
         }
     }
     if ($iconPath != '') {
         $iconImg = '<img' . IconUtility::skinImg($this->backPath, PATH_TXCOMMERCE_REL . 'Resources/Public/Icons/Table/' . $iconPath, $iconAttributes) . '/>';
     }
     $theIcon = $this->clickMenuEnabled ? $this->getControllerDocumentTemplate()->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg;
     // Preparing and getting the data-array
     $theData = array();
     foreach ($this->fieldArray as $fCol) {
         if ($fCol == 'pid') {
             $theData[$fCol] = $row[$fCol];
         } elseif ($fCol == 'sum_price_gross') {
             if ($this->csvOutput) {
                 $row[$fCol] = $row[$fCol] / 100;
             } else {
                 $theData[$fCol] = \CommerceTeam\Commerce\ViewHelpers\Money::format($row[$fCol], $row['cu_iso_3'], false);
             }
         } elseif ($fCol == 'crdate') {
             $theData[$fCol] = BackendUtility::date($row[$fCol]);
             $row[$fCol] = BackendUtility::date($row[$fCol]);
         } elseif ($fCol == 'tstamp') {
             $theData[$fCol] = BackendUtility::date($row[$fCol]);
             $row[$fCol] = BackendUtility::date($row[$fCol]);
         } elseif ($fCol == 'articles') {
             $articleNumber = array();
             $articleName = array();
             $resArticles = $database->exec_SELECTquery('article_number, title, order_uid', 'tx_commerce_order_articles', 'order_uid = ' . (int) $row['uid']);
             $articles = array();
             while ($lokalRow = $database->sql_fetch_assoc($resArticles)) {
                 $articles[] = $lokalRow['article_number'] . ':' . $lokalRow['title'];
                 $articleNumber[] = $lokalRow['article_number'];
                 $articleName[] = $lokalRow['title'];
             }
             if ($this->csvOutput) {
                 $theData[$fCol] = implode(',', $articles);
                 $row[$fCol] = implode(',', $articles);
             } else {
                 $theData[$fCol] = '<input type="checkbox" name="orderUid[]" value="' . $row['uid'] . '">';
//.........这里部分代码省略.........
开发者ID:BenjaminBeck,项目名称:commerce,代码行数:101,代码来源:OrderRecordList.php

示例14: formatFileList

 /**
  * This returns tablerows for the files in the array $items['sorting'].
  *
  * @param File[] $files File items
  * @return string HTML table rows.
  */
 public function formatFileList(array $files)
 {
     $out = '';
     // first two keys are "0" (default) and "-1" (multiple), after that comes the "other languages"
     $allSystemLanguages = GeneralUtility::makeInstance(TranslationConfigurationProvider::class)->getSystemLanguages();
     $systemLanguages = array_filter($allSystemLanguages, function ($languageRecord) {
         if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$this->getBackendUser()->checkLanguageAccess($languageRecord['uid'])) {
             return false;
         } else {
             return true;
         }
     });
     foreach ($files as $fileObject) {
         // Initialization
         $this->counter++;
         $this->totalbytes += $fileObject->getSize();
         $ext = $fileObject->getExtension();
         $fileName = trim($fileObject->getName());
         // The icon with link
         $theIcon = '<span title="' . htmlspecialchars($fileName . ' [' . (int) $fileObject->getUid() . ']') . '">' . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render() . '</span>';
         if ($this->clickMenus) {
             $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier());
         }
         // Preparing and getting the data-array
         $theData = array();
         foreach ($this->fieldArray as $field) {
             switch ($field) {
                 case 'size':
                     $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $this->getLanguageService()->getLL('byteSizeUnits', true));
                     break;
                 case 'rw':
                     $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('read', true) . '</strong>') . (!$fileObject->checkActionPermission('write') ? '' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('write', true) . '</strong>');
                     break;
                 case 'fileext':
                     $theData[$field] = strtoupper($ext);
                     break;
                 case 'tstamp':
                     $theData[$field] = BackendUtility::date($fileObject->getModificationTime());
                     break;
                 case '_CONTROL_':
                     $theData[$field] = $this->makeEdit($fileObject);
                     break;
                 case '_CLIPBOARD_':
                     $theData[$field] = $this->makeClip($fileObject);
                     break;
                 case '_LOCALIZATION_':
                     if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission('write') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata')) {
                         $metaDataRecord = $fileObject->_getMetaData();
                         $translations = $this->getTranslationsForMetaData($metaDataRecord);
                         $languageCode = '';
                         foreach ($systemLanguages as $language) {
                             $languageId = $language['uid'];
                             $flagIcon = $language['flagIcon'];
                             if (array_key_exists($languageId, $translations)) {
                                 $title = htmlspecialchars(sprintf($this->getLanguageService()->getLL('editMetadataForLanguage'), $language['title']));
                                 // @todo the overlay for the flag needs to be added ($flagIcon . '-overlay')
                                 $urlParameters = ['edit' => ['sys_file_metadata' => [$translations[$languageId]['uid'] => 'edit']], 'returnUrl' => $this->listURL()];
                                 $flagButtonIcon = $this->iconFactory->getIcon($flagIcon, Icon::SIZE_SMALL, 'overlay-edit')->render();
                                 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
                                 $languageCode .= '<a href="' . htmlspecialchars($url) . '" class="btn btn-default" title="' . $title . '">' . $flagButtonIcon . '</a>';
                             } else {
                                 $parameters = ['justLocalized' => 'sys_file_metadata:' . $metaDataRecord['uid'] . ':' . $languageId, 'returnUrl' => $this->listURL()];
                                 $returnUrl = BackendUtility::getModuleUrl('record_edit', $parameters);
                                 $href = BackendUtility::getLinkToDataHandlerAction('&cmd[sys_file_metadata][' . $metaDataRecord['uid'] . '][localize]=' . $languageId, $returnUrl);
                                 $flagButtonIcon = '<span title="' . htmlspecialchars(sprintf($this->getLanguageService()->getLL('createMetadataForLanguage'), $language['title'])) . '">' . $this->iconFactory->getIcon($flagIcon, Icon::SIZE_SMALL, 'overlay-new')->render() . '</span>';
                                 $languageCode .= '<a href="' . htmlspecialchars($href) . '" class="btn btn-default">' . $flagButtonIcon . '</a> ';
                             }
                         }
                         // Hide flag button bar when not translated yet
                         $theData[$field] = ' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() . '"' . (empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>';
                         $theData[$field] .= '<a class="btn btn-default filelist-translationToggler" data-fileid="' . $fileObject->getUid() . '">' . '<span title="' . $this->getLanguageService()->getLL('translateMetadata', true) . '">' . $this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL)->render() . '</span>' . '</a>';
                     }
                     break;
                 case '_REF_':
                     $theData[$field] = $this->makeRef($fileObject);
                     break;
                 case 'file':
                     // Edit metadata of file
                     $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject);
                     if ($fileObject->isMissing()) {
                         $theData[$field] .= '<span class="label label-danger label-space-left">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing')) . '</span>';
                         // Thumbnails?
                     } elseif ($this->thumbs && ($this->isImage($ext) || $this->isMediaFile($ext))) {
                         $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
                         if ($processedFile) {
                             $thumbUrl = $processedFile->getPublicUrl(true);
                             $theData[$field] .= '<br /><img src="' . $thumbUrl . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'title="' . htmlspecialchars($fileName) . '" alt="" />';
                         }
                     }
                     break;
                 default:
                     $theData[$field] = '';
                     if ($fileObject->hasProperty($field)) {
                         $theData[$field] = htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getProperty($field), $this->fixedL));
//.........这里部分代码省略.........
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:101,代码来源:FileList.php


注:本文中的TYPO3\CMS\Backend\Utility\BackendUtility::date方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。