/** * Render javascript in header * * @return string the rendered page info icon * @see template::getPageInfo() Note: can't call this method as it's protected! */ public function render() { $doc = $this->getDocInstance(); $id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'); $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1)); // Add icon with clickmenu, etc: if ($pageRecord['uid']) { // If there IS a real page $alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages'); $iconImg = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext))); // Make Icon: $theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']); } else { // On root-level of page tree // Make Icon $iconImg = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_website.gif') . ' alt="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '" />'; if ($GLOBALS['BE_USER']->user['admin']) { $theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', 0); } else { $theIcon = $iconImg; } } // Setting icon with clickmenu + uid $pageInfo = $theIcon . '<em>[pid: ' . $pageRecord['uid'] . ']</em>'; return $pageInfo; }
/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $id = GeneralUtility::_GP('id'); $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1)); // Add icon with clickmenu, etc: /** @var IconFactory $iconFactory */ $iconFactory = GeneralUtility::makeInstance(IconFactory::class); if ($pageRecord['uid']) { // If there IS a real page $altText = BackendUtility::getRecordIconAltText($pageRecord, 'pages'); $theIcon = '<span title="' . $altText . '">' . $iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>'; // Make Icon: $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']); // Setting icon with clickmenu + uid $theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>'; } else { // On root-level of page tree // Make Icon $theIcon = '<span title="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $iconFactory->getIcon('apps-pagetree-page-domain', Icon::SIZE_SMALL)->render() . '</span>'; if ($GLOBALS['BE_USER']->user['admin']) { $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', 0); } } return $theIcon; }
/** * Iterates through elements of $each and renders child nodes * * @param array $record The tt_content record * @param boolean $oncludeTitle If title should be included in output, * @return string */ public function render($record) { $shortcutContent = ''; $tableName = 'tt_content'; if (is_array($record)) { $altText = BackendUtility::getRecordIconAltText($record, $tableName); $iconImg = IconUtility::getSpriteIconForRecord($tableName, $record, array('title' => $altText)); if ($this->getBackendUser()->recordEditAccessInternals($tableName, $record)) { $iconImg = BackendUtility::wrapClickMenuOnIcon($iconImg, $tableName, $record['uid'], 1, '', '+copy,info,edit,view'); } $link = $this->linkEditContent(htmlspecialchars(BackendUtility::getRecordTitle($tableName, $record)), $record); $shortcutContent = $iconImg . $link; } return $shortcutContent; }
/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $doc = GeneralUtility::makeInstance(DocumentTemplate::class); $id = GeneralUtility::_GP('id'); $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1)); // Add icon with clickmenu, etc: if ($pageRecord['uid']) { // If there IS a real page $alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages'); $theIcon = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext))); // Make Icon: $theIcon = $doc->wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']); // Setting icon with clickmenu + uid $theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>'; } else { // On root-level of page tree // Make Icon $theIcon = IconUtility::getSpriteIcon('apps-pagetree-page-domain', array('title' => htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']))); if ($GLOBALS['BE_USER']->user['admin']) { $theIcon = $doc->wrapClickMenuOnIcon($theIcon, 'pages', 0); } } return $theIcon; }
/** * 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; }
/** * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu. * * @param string $table Table name * @param array $row Record array * @return string HTML for the icon */ public function getIcon($table, $row) { // Initialization $altText = BackendUtility::getRecordIconAltText($row, $table); $icon = '<span title="' . $altText . '">' . $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '</span>'; $this->counter++; // The icon with link if ($this->getBackendUser()->recordEditAccessInternals($table, $row)) { $icon = $this->getPageLayoutController()->getModuleTemplate()->wrapClickMenuOnIcon($icon, $table, $row['uid']); } return $icon; }
/** * Rendering a single row for the list * * @param string $table Table name * @param mixed[] $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 * @access private * @see getTable() */ public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent = 0) { if (!is_array($row)) { return ''; } $rowOutput = ''; $id_orig = null; // If in search mode, make sure the preview will show the correct page if ((string) $this->searchString !== '') { $id_orig = $this->id; $this->id = $row['pid']; } // Add special classes for first and last row $rowSpecial = ''; if ($cc == 1 && $indent == 0) { $rowSpecial .= ' firstcol'; } if ($cc == $this->totalRowCount || $cc == $this->iLimit) { $rowSpecial .= ' lastcol'; } $row_bgColor = ' class="' . $rowSpecial . '"'; // Overriding with versions background color if any: $row_bgColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $row_bgColor; // Incr. counter. $this->counter++; // The icon with link $altText = BackendUtility::getRecordIconAltText($row, $table); $additionalStyle = $indent ? ' style="margin-left: ' . $indent . 'px;"' : ''; $iconImg = '<span title="' . $altText . '" ' . $additionalStyle . '>' . $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '</span>'; $theIcon = $this->clickMenuEnabled ? $this->getModule()->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg; // Preparing and getting the data-array $theData = array(); $localizationMarkerClass = ''; foreach ($this->fieldArray as $fCol) { if ($fCol == $titleCol) { $recTitle = BackendUtility::getRecordTitle($table, $row, false, true); $warning = ''; // If the record is edit-locked by another user, we will show a little warning sign: $lockInfo = BackendUtility::isRecordLocked($table, $row['uid']); if ($lockInfo) { $warning = '<a href="#" onclick="alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . '); return false;" title="' . htmlspecialchars($lockInfo['msg']) . '">' . $this->iconFactory->getIcon('status-warning-in-use', Icon::SIZE_SMALL)->render() . '</a>'; } $theData[$fCol] = $theData['__label'] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row); // Render thumbnails, if: // - a thumbnail column exists // - there is content in it // - the thumbnail column is visible for the current type $type = 0; if (isset($GLOBALS['TCA'][$table]['ctrl']['type'])) { $typeColumn = $GLOBALS['TCA'][$table]['ctrl']['type']; $type = $row[$typeColumn]; } // If current type doesn't exist, set it to 0 (or to 1 for historical reasons, // if 0 doesn't exist) if (!isset($GLOBALS['TCA'][$table]['types'][$type])) { $type = isset($GLOBALS['TCA'][$table]['types'][0]) ? 0 : 1; } $visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem']; if ($this->thumbs && trim($row[$thumbsCol]) && preg_match('/(^|(.*(;|,)?))' . $thumbsCol . '(((;|,).*)|$)/', $visibleColumns) === 1) { $theData[$fCol] .= '<br />' . $this->thumbCode($row, $table, $thumbsCol); } if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0 && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0) { // It's a translated record with a language parent $localizationMarkerClass = ' localization'; } } elseif ($fCol == 'pid') { $theData[$fCol] = $row[$fCol]; } elseif ($fCol == '_PATH_') { $theData[$fCol] = $this->recPath($row['pid']); } elseif ($fCol == '_REF_') { $theData[$fCol] = $this->createReferenceHtml($table, $row['uid']); } 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') { // deliberately empty } else { $pageId = $table === 'pages' ? $row['uid'] : $row['pid']; $tmpProc = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'], true, $pageId); $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]); if ($this->csvOutput) { $row[$fCol] = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid']); } } } // Reset the ID if it was overwritten if ((string) $this->searchString !== '') { $this->id = $id_orig; } // Add row to CSV list: if ($this->csvOutput) { $this->addToCSV($row); } // Add classes to table cells $this->addElement_tdCssClass[$titleCol] = 'col-title' . $localizationMarkerClass; $this->addElement_tdCssClass['_CONTROL_'] = 'col-control'; if ($this->getModule()->MOD_SETTINGS['clipBoard']) { $this->addElement_tdCssClass['_CLIPBOARD_'] = 'col-clipboard'; } $this->addElement_tdCssClass['_PATH_'] = 'col-path'; $this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa'; $this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb'; // Create element in table cells: $theData['uid'] = $row['uid']; if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) && !isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) { $theData['parent'] = $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]; } $rowOutput .= $this->addElement(1, $theIcon, $theData, $row_bgColor); // Finally, return table row element: return $rowOutput; }
/** * Create record header (includes teh record icon, record title etc.) * * @param array $row Record row. * @return string HTML */ public function getRecordHeader($row) { $line = IconUtility::getSpriteIconForRecord('tt_content', $row, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($row, 'tt_content')))); $line .= BackendUtility::getRecordTitle('tt_content', $row, TRUE); return $this->wrapRecordTitle($line, $row); }
/** * Make 2nd level clickmenu (only for DBmenus) * * @param string $table Table name * @param integer $uid UID for the current record. * @return string HTML content * @todo Define visibility */ public function printNewDBLevel($table, $uid) { // Setting internal record to the table/uid : $this->rec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $uid); $menuItems = array(); $root = 0; // Rootlevel if ($table == 'pages' && !strcmp($uid, '0')) { $root = 1; } // If record was found, check permissions and get menu items. if (is_array($this->rec) || $root) { $lCP = $GLOBALS['BE_USER']->calcPerms(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $table == 'pages' ? $this->rec['uid'] : $this->rec['pid'])); // Edit: if (!$root && ($GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') || $GLOBALS['BE_USER']->isPSet($lCP, $table, 'editcontent'))) { $this->editOK = 1; } $menuItems = $this->processingByExtClassArray($menuItems, $table, $uid); } // Return the printed elements: if (!is_array($menuItems)) { $menuItems = array(); } return $this->printItems($menuItems, $root ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-pagetree-root') . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) : \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $this->rec, array('title' => htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($this->rec, $table)))) . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $this->rec, TRUE)); }
/** * Setting page icon with clickmenu + uid for docheader * * @param array $pageRecord Current page * @return string Page info */ protected function getPageInfo($pageRecord) { // Add icon with clickmenu, etc: // If there IS a real page if (is_array($pageRecord) && $pageRecord['uid']) { $alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages'); $iconImg = '<span title="' . htmlspecialchars($alttext) . '">' . $this->iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>'; // Make Icon: $theIcon = BackendUtility::wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']); $uid = $pageRecord['uid']; $title = BackendUtility::getRecordTitle('pages', $pageRecord); } else { // On root-level of page tree // Make Icon $iconImg = '<span title="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $this->iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render() . '</span>'; if ($GLOBALS['BE_USER']->user['admin']) { $theIcon = BackendUtility::wrapClickMenuOnIcon($iconImg, 'pages', 0); } else { $theIcon = $iconImg; } $uid = '0'; $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } // Setting icon with clickmenu + uid $pageInfo = $theIcon . '<strong>' . htmlspecialchars($title) . ' [' . $uid . ']</strong>'; return $pageInfo; }
/** * Renders the HTML header for a foreign record, such as the title, toggle-function, drag'n'drop, etc. * Later on the command-icons are inserted here. * * @param array $data Current data * @return string The HTML code of the header */ protected function renderForeignRecordHeader(array $data) { $languageService = $this->getLanguageService(); $inlineConfig = $data['inlineParentConfig']; $foreignTable = $inlineConfig['foreign_table']; $rec = $data['databaseRow']; // Init: $domObjectId = $this->inlineStackProcessor->getCurrentStructureDomObjectIdPrefix($data['inlineFirstPid']); $objectId = $domObjectId . '-' . $foreignTable . '-' . $rec['uid']; $recordTitle = $data['recordTitle']; if (empty($recordTitle)) { $recordTitle = '<em>[' . $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', true) . ']</em>'; } $altText = BackendUtility::getRecordIconAltText($rec, $foreignTable); $iconImg = '<span title="' . $altText . '" id="' . htmlspecialchars($objectId) . '_icon' . '">' . $this->iconFactory->getIconForRecord($foreignTable, $rec, Icon::SIZE_SMALL)->render() . '</span>'; $label = '<span id="' . $objectId . '_label">' . $recordTitle . '</span>'; $ctrl = $this->renderForeignRecordHeaderControl($data); $thumbnail = false; // Renders a thumbnail for the header if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && !empty($inlineConfig['appearance']['headerThumbnail']['field'])) { $fieldValue = $rec[$inlineConfig['appearance']['headerThumbnail']['field']]; $firstElement = array_shift(GeneralUtility::trimExplode('|', array_shift(GeneralUtility::trimExplode(',', $fieldValue)))); $fileUid = array_pop(BackendUtility::splitTable_Uid($firstElement)); if (!empty($fileUid)) { try { $fileObject = ResourceFactory::getInstance()->getFileObject($fileUid); } catch (\InvalidArgumentException $e) { $fileObject = null; } if ($fileObject && $fileObject->isMissing()) { $thumbnail .= '<span class="label label-danger">' . htmlspecialchars(static::getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing')) . '</span> ' . htmlspecialchars($fileObject->getName()) . '<br />'; } elseif ($fileObject) { $imageSetup = $inlineConfig['appearance']['headerThumbnail']; unset($imageSetup['field']); if (!empty($rec['crop'])) { $imageSetup['crop'] = $rec['crop']; } $imageSetup = array_merge(array('width' => '45', 'height' => '45c'), $imageSetup); $processedImage = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, $imageSetup); // Only use a thumbnail if the processing process was successful by checking if image width is set if ($processedImage->getProperty('width')) { $imageUrl = $processedImage->getPublicUrl(true); $thumbnail = '<img src="' . $imageUrl . '" ' . 'width="' . $processedImage->getProperty('width') . '" ' . 'height="' . $processedImage->getProperty('height') . '" ' . 'alt="' . htmlspecialchars($altText) . '" ' . 'title="' . htmlspecialchars($altText) . '">'; } } } } if (!empty($inlineConfig['appearance']['headerThumbnail']['field']) && $thumbnail) { $mediaContainer = '<div class="form-irre-header-cell form-irre-header-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</div>'; } else { $mediaContainer = '<div class="form-irre-header-cell form-irre-header-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</div>'; } $header = $mediaContainer . ' <div class="form-irre-header-cell form-irre-header-body">' . $label . '</div> <div class="form-irre-header-cell form-irre-header-control t3js-formengine-irre-control">' . $ctrl . '</div>'; return $header; }
/** * Renders the HTML header for a foreign record, such as the title, toggle-function, drag'n'drop, etc. * Later on the command-icons are inserted here. * * @param string $parentUid The uid of the parent (embedding) record (uid or NEW...) * @param string $foreign_table The foreign_table we create a header for * @param array $data Current data * @param array $config content of $PA['fieldConf']['config'] * @param bool $isVirtualRecord * @return string The HTML code of the header */ protected function renderForeignRecordHeader($parentUid, $foreign_table, $data, $config, $isVirtualRecord = false) { $rec = $data['databaseRow']; // Init: $domObjectId = $this->inlineStackProcessor->getCurrentStructureDomObjectIdPrefix($this->data['inlineFirstPid']); $objectId = $domObjectId . '-' . $foreign_table . '-' . $rec['uid']; // We need the returnUrl of the main script when loading the fields via AJAX-call (to correct wizard code, so include it as 3rd parameter) // Pre-Processing: $isOnSymmetricSide = RelationHandler::isOnSymmetricSide($parentUid, $config, $rec); $hasForeignLabel = (bool) (!$isOnSymmetricSide && $config['foreign_label']); $hasSymmetricLabel = (bool) $isOnSymmetricSide && $config['symmetric_label']; // Get the record title/label for a record: // Try using a self-defined user function only for formatted labels if (isset($GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc'])) { $params = array('table' => $foreign_table, 'row' => $rec, 'title' => '', 'isOnSymmetricSide' => $isOnSymmetricSide, 'options' => isset($GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc_options']) ? $GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc_options'] : array(), 'parent' => array('uid' => $parentUid, 'config' => $config)); // callUserFunction requires a third parameter, but we don't want to give $this as reference! $null = null; GeneralUtility::callUserFunction($GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc'], $params, $null); $recTitle = $params['title']; // Try using a normal self-defined user function } elseif (isset($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc'])) { $recTitle = $data['recordTitle']; } elseif ($hasForeignLabel || $hasSymmetricLabel) { $titleCol = $hasForeignLabel ? $config['foreign_label'] : $config['symmetric_label']; // Render title for everything else than group/db: if (isset($this->data['processedTca']['columns'][$titleCol]['config']['type']) && $this->data['processedTca']['columns'][$titleCol]['config']['type'] === 'group' && isset($this->data['processedTca']['columns'][$titleCol]['config']['internal_type']) && $this->data['processedTca']['columns'][$titleCol]['config']['internal_type'] === 'db') { $recTitle = BackendUtility::getProcessedValueExtra($foreign_table, $titleCol, $rec[$titleCol], 0, 0, false); } else { // $recTitle could be something like: "tx_table_123|...", $valueParts = GeneralUtility::trimExplode('|', $rec[$titleCol]); $itemParts = GeneralUtility::revExplode('_', $valueParts[0], 2); $recTemp = BackendUtility::getRecordWSOL($itemParts[0], $itemParts[1]); $recTitle = BackendUtility::getRecordTitle($itemParts[0], $recTemp, false); } $recTitle = BackendUtility::getRecordTitlePrep($recTitle); if (trim($recTitle) === '') { $recTitle = BackendUtility::getNoRecordTitle(true); } } else { $recTitle = BackendUtility::getRecordTitle($foreign_table, FormEngineUtility::databaseRowCompatibility($rec), true); } $altText = BackendUtility::getRecordIconAltText($rec, $foreign_table); $iconImg = '<span title="' . $altText . '" id="' . htmlspecialchars($objectId) . '_icon' . '">' . $this->iconFactory->getIconForRecord($foreign_table, $rec, Icon::SIZE_SMALL)->render() . '</span>'; $label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>'; $ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $data, $config, $isVirtualRecord); $thumbnail = false; // Renders a thumbnail for the header if (!empty($config['appearance']['headerThumbnail']['field'])) { $fieldValue = $rec[$config['appearance']['headerThumbnail']['field']]; $firstElement = array_shift(GeneralUtility::trimExplode('|', array_shift(GeneralUtility::trimExplode(',', $fieldValue)))); $fileUid = array_pop(BackendUtility::splitTable_Uid($firstElement)); if (!empty($fileUid)) { $fileObject = ResourceFactory::getInstance()->getFileObject($fileUid); if ($fileObject && $fileObject->isMissing()) { $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject); $thumbnail = $flashMessage->render(); } elseif ($fileObject) { $imageSetup = $config['appearance']['headerThumbnail']; unset($imageSetup['field']); if (!empty($rec['crop'])) { $imageSetup['crop'] = $rec['crop']; } $imageSetup = array_merge(array('width' => '45', 'height' => '45c'), $imageSetup); $processedImage = $fileObject->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $imageSetup); // Only use a thumbnail if the processing process was successful by checking if image width is set if ($processedImage->getProperty('width')) { $imageUrl = $processedImage->getPublicUrl(true); $thumbnail = '<img src="' . $imageUrl . '" ' . 'width="' . $processedImage->getProperty('width') . '" ' . 'height="' . $processedImage->getProperty('height') . '" ' . 'alt="' . htmlspecialchars($altText) . '" ' . 'title="' . htmlspecialchars($altText) . '">'; } } } } if (!empty($config['appearance']['headerThumbnail']['field']) && $thumbnail) { $mediaContainer = '<div class="form-irre-header-cell form-irre-header-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</div>'; } else { $mediaContainer = '<div class="form-irre-header-cell form-irre-header-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</div>'; } $header = $mediaContainer . ' <div class="form-irre-header-cell form-irre-header-body">' . $label . '</div> <div class="form-irre-header-cell form-irre-header-control t3js-formengine-irre-control">' . $ctrl . '</div>'; return $header; }
/** * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu. * * @param string $table Table name * @param array $row Record array * @return string HTML for the icon * @todo Define visibility */ public function getIcon($table, $row) { // Initialization $altText = BackendUtility::getRecordIconAltText($row, $table); $icon = IconUtility::getSpriteIconForRecord($table, $row, array('title' => $altText)); $this->counter++; // The icon with link if ($this->getBackendUser()->recordEditAccessInternals($table, $row)) { $icon = $this->getPageLayoutController()->doc->wrapClickMenuOnIcon($icon, $table, $row['uid']); } return $icon; }
/** * Creating the module output. * * @return void * @todo Define visibility */ public function main() { if ($this->page_id) { // Get record for element: $elRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($this->table, $this->moveUid); // Headerline: Icon, record title: $hline = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($this->table, $elRow, array('id' => 'c-recIcon', 'title' => htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($elRow, $this->table)))); $hline .= \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($this->table, $elRow, TRUE); // Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently): $hline .= $this->doc->spacer(5); $onClick = 'window.location.href=\'' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('makeCopy' => !$this->makeCopy)) . '\';'; $hline .= $this->doc->spacer(5); $hline .= '<input type="hidden" name="makeCopy" value="0" />' . '<input type="checkbox" name="makeCopy" id="makeCopy" value="1"' . ($this->makeCopy ? ' checked="checked"' : '') . ' onclick="' . htmlspecialchars($onClick) . '" /> <label for="makeCopy" class="t3-label-valign-top">' . $GLOBALS['LANG']->getLL('makeCopy', 1) . '</label>'; // Add the header-content to the module content: $this->content .= $this->doc->section('', $hline, FALSE, TRUE); $this->content .= $this->doc->spacer(20); // Reset variable to pick up the module content in: $code = ''; // IF the table is "pages": if ((string) $this->table == 'pages') { // Get page record (if accessible): $pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->page_id, $this->perms_clause); if (is_array($pageinfo) && $GLOBALS['BE_USER']->isInWebMount($pageinfo['pid'], $this->perms_clause)) { // Initialize the position map: $posMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('ext_posMap_pages'); $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move'; // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page). if ($pageinfo['pid']) { $pidPageInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($pageinfo['pid'], $this->perms_clause); if (is_array($pidPageInfo)) { if ($GLOBALS['BE_USER']->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) { $code .= '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-up') . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />'; } else { $code .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />'; } } } // Create the position tree: $code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI); } } // IF the table is "tt_content": if ((string) $this->table == 'tt_content') { // First, get the record: $tt_content_rec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('tt_content', $this->moveUid); // ? if (!$this->input_moveUid) { $this->page_id = $tt_content_rec['pid']; } // Checking if the parent page is readable: $pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->page_id, $this->perms_clause); if (is_array($pageinfo) && $GLOBALS['BE_USER']->isInWebMount($pageinfo['pid'], $this->perms_clause)) { // Initialize the position map: $posMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('ext_posMap_tt_content'); $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move'; $posMap->cur_sys_language = $this->sys_language; // Headerline for the parent page: Icon, record title: $hline = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $pageinfo, array('title' => htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($pageinfo, 'pages')))); $hline .= \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pageinfo, TRUE); // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable: // SHARED page-TSconfig settings. $modTSconfig_SHARED = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->page_id, 'mod.SHARED'); $colPosArray = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getColPosListItemsParsed', $this->page_id, $this); foreach ($colPosArray as $colPos) { $colPosList .= $colPosList != '' ? ',' . $colPos[1] : $colPos[1]; } // Removing duplicates, if any $colPosList = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $colPosList))); // Adding parent page-header and the content element columns from position-map: $code = $hline . '<br />'; $code .= $posMap->printContentElementColumns($this->page_id, $this->moveUid, $colPosList, 1, $this->R_URI); // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page). $code .= '<br />'; $code .= '<br />'; if ($pageinfo['pid']) { $pidPageInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($pageinfo['pid'], $this->perms_clause); if (is_array($pidPageInfo)) { if ($GLOBALS['BE_USER']->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) { $code .= '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-up') . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />'; } else { $code .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />'; } } } // Create the position tree (for pages): $code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI); } } // Add the $code content as a new section to the module: $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('selectPositionOfElement'), $code, FALSE, TRUE); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('movingElement')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Renders the HTML header for a foreign record, such as the title, toggle-function, drag'n'drop, etc. * Later on the command-icons are inserted here. * * @param string $parentUid The uid of the parent (embedding) record (uid or NEW...) * @param string $foreign_table The foreign_table we create a header for * @param array $rec The current record of that foreign_table * @param array $config content of $PA['fieldConf']['config'] * @param boolean $isVirtualRecord * @return string The HTML code of the header * @todo Define visibility */ public function renderForeignRecordHeader($parentUid, $foreign_table, $rec, $config, $isVirtualRecord = FALSE) { // Init: $objectId = $this->inlineNames['object'] . self::Structure_Separator . $foreign_table . self::Structure_Separator . $rec['uid']; // We need the returnUrl of the main script when loading the fields via AJAX-call (to correct wizard code, so include it as 3rd parameter) // Pre-Processing: $isOnSymmetricSide = \TYPO3\CMS\Core\Database\RelationHandler::isOnSymmetricSide($parentUid, $config, $rec); $hasForeignLabel = !$isOnSymmetricSide && $config['foreign_label'] ? TRUE : FALSE; $hasSymmetricLabel = $isOnSymmetricSide && $config['symmetric_label'] ? TRUE : FALSE; // Get the record title/label for a record: // render using a self-defined user function if ($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc']) { $params = array('table' => $foreign_table, 'row' => $rec, 'title' => '', 'isOnSymmetricSide' => $isOnSymmetricSide, 'parent' => array('uid' => $parentUid, 'config' => $config)); // callUserFunction requires a third parameter, but we don't want to give $this as reference! $null = NULL; \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc'], $params, $null); $recTitle = $params['title']; } elseif ($hasForeignLabel || $hasSymmetricLabel) { $titleCol = $hasForeignLabel ? $config['foreign_label'] : $config['symmetric_label']; $foreignConfig = $this->getPossibleRecordsSelectorConfig($config, $titleCol); // Render title for everything else than group/db: if ($foreignConfig['type'] != 'groupdb') { $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($foreign_table, $titleCol, $rec[$titleCol], 0, 0, FALSE); } else { // $recTitle could be something like: "tx_table_123|...", $valueParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $rec[$titleCol]); $itemParts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $valueParts[0], 2); $recTemp = \t3lib_befunc::getRecordWSOL($itemParts[0], $itemParts[1]); $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($itemParts[0], $recTemp, FALSE); } $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitlePrep($recTitle); if (!strcmp(trim($recTitle), '')) { $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getNoRecordTitle(TRUE); } } else { $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($foreign_table, $rec, TRUE); } // Renders a thumbnail for the header if (!empty($config['appearance']['headerThumbnail']['field'])) { $fieldValue = $rec[$config['appearance']['headerThumbnail']['field']]; $firstElement = array_shift(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $fieldValue)); $fileUid = array_pop(\TYPO3\CMS\Backend\Utility\BackendUtility::splitTable_Uid($firstElement)); if (!empty($fileUid)) { $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileObject($fileUid); if ($fileObject) { $imageSetup = $config['appearance']['headerThumbnail']; unset($imageSetup['field']); $imageSetup = array_merge(array('width' => 64, 'height' => 64), $imageSetup); $imageUrl = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, $imageSetup)->getPublicUrl(TRUE); $thumbnail = '<img src="' . $imageUrl . '" alt="' . htmlspecialchars($recTitle) . '">'; } else { $thumbnail = FALSE; } } } $altText = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($rec, $foreign_table); $iconImg = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($foreign_table, $rec, array('title' => htmlspecialchars($altText), 'id' => $objectId . '_icon')); $label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>'; $ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord); $header = '<table>' . '<tr>' . (!empty($config['appearance']['headerThumbnail']['field']) && $thumbnail ? '<td class="t3-form-field-header-inline-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</td>' : '<td class="t3-form-field-header-inline-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</td>') . '<td class="t3-form-field-header-inline-summary">' . $label . '</td>' . '<td clasS="t3-form-field-header-inline-ctrl">' . $ctrl . '</td>' . '</tr>' . '</table>'; return $header; }
/** * Rendering a single row for the list * * @param string $table Table name * @param mixed[] $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. * @param integer $level * @param string $expanded * * @return string Table row for the element * @access private * @see getTable() */ public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent = 0, $level = 0, $expanded = '') { if (!is_array($row)) { return ''; } $rowOutput = ''; $id_orig = null; // If in search mode, make sure the preview will show the correct page if ((string) $this->searchString !== '') { $id_orig = $this->id; $this->id = $row['pid']; } // Add special classes for first and last row $rowSpecial = ''; if ($cc == 1 && $indent == 0) { $rowSpecial .= ' firstcol'; } if ($cc == $this->totalRowCount || $cc == $this->iLimit) { $rowSpecial .= ' lastcol'; } $row_bgColor = ' class="' . $rowSpecial . '"'; // Overriding with versions background color if any: $row_bgColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $row_bgColor; // Incr. counter. $this->counter++; // The icon with link $altText = BackendUtility::getRecordIconAltText($row, $table); $additionalStyle = $indent ? ' style="margin-left: ' . $indent . 'px;"' : ''; $iconImg = '<span title="' . $altText . '" ' . $additionalStyle . '>' . $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '</span>'; $theIcon = $this->clickMenuEnabled ? BackendUtility::wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg; // Preparing and getting the data-array $theData = array(); $localizationMarkerClass = ''; $lC2 = ''; foreach ($this->fieldArray as $fCol) { if ($fCol == $titleCol) { $recTitle = BackendUtility::getRecordTitle($table, $row, false, true); $warning = ''; // If the record is edit-locked by another user, we will show a little warning sign: $lockInfo = BackendUtility::isRecordLocked($table, $row['uid']); if ($lockInfo) { $warning = '<a href="#" onclick="alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . '); return false;" title="' . htmlspecialchars($lockInfo['msg']) . '">' . $this->iconFactory->getIcon('status-warning-in-use', Icon::SIZE_SMALL)->render() . '</a>'; } $theData[$fCol] = $theData['__label'] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row); // Render thumbnails, if: // - a thumbnail column exists // - there is content in it // - the thumbnail column is visible for the current type $type = 0; if (isset($GLOBALS['TCA'][$table]['ctrl']['type'])) { $typeColumn = $GLOBALS['TCA'][$table]['ctrl']['type']; $type = $row[$typeColumn]; } // If current type doesn't exist, set it to 0 (or to 1 for historical reasons, // if 0 doesn't exist) if (!isset($GLOBALS['TCA'][$table]['types'][$type])) { $type = isset($GLOBALS['TCA'][$table]['types'][0]) ? 0 : 1; } $visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem']; if ($this->thumbs && trim($row[$thumbsCol]) && preg_match('/(^|(.*(;|,)?))' . $thumbsCol . '(((;|,).*)|$)/', $visibleColumns) === 1) { $theData[$fCol] .= '<br />' . $this->thumbCode($row, $table, $thumbsCol); } if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0 && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0) { // It's a translated record with a language parent $localizationMarkerClass = ' localization'; } } elseif ($fCol == 'pid') { $theData[$fCol] = $row[$fCol]; } elseif ($fCol == '_PATH_') { $theData[$fCol] = $this->recPath($row['pid']); } elseif ($fCol == '_REF_') { $theData[$fCol] = $this->createReferenceHtml($table, $row['uid']); } elseif ($fCol == '_CONTROL_') { $theData[$fCol] = $this->makeControl($table, $row, $level); } elseif ($fCol == '_CLIPBOARD_') { $theData[$fCol] = $this->makeClip($table, $row); } elseif ($fCol == '_LOCALIZATION_') { list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row); $theData[$fCol] = $lC1; } elseif ($fCol != '_LOCALIZATION_b') { $tmpProc = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid']); $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]); if ($this->csvOutput) { $row[$fCol] = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid']); } } elseif ($fCol == '_LOCALIZATION_b') { $theData[$fCol] = $lC2; } else { $theData[$fCol] = htmlspecialchars(BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid'])); } } // Reset the ID if it was overwritten if ((string) $this->searchString !== '') { $this->id = $id_orig; } // Add row to CSV list: if ($this->csvOutput) { $this->addToCSV($row); } // Add classes to table cells $this->addElement_tdCssClass[$titleCol] = 'col-title' . $localizationMarkerClass; $this->addElement_tdCssClass['_CONTROL_'] = 'col-control'; if ($this->getModule()->MOD_SETTINGS['clipBoard']) { $this->addElement_tdCssClass['_CLIPBOARD_'] = 'col-clipboard'; } $this->addElement_tdCssClass['_PATH_'] = 'col-path'; $this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa'; $this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb'; /** * @hook checkChildren * @date 2014-02-11 * @request Alexander Grein <*****@*****.**> */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (is_object($hookObject) && method_exists($hookObject, 'checkChildren')) { $hookObject->checkChildren($table, $row, $level, $theData, $this); } } } // Create element in table cells: $theData['uid'] = $row['uid']; if ($table === 'tt_content') { $theData['tx_gridelements_container'] = $row['tx_gridelements_container']; } if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) && !isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) { $theData['parent'] = $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]; } $rowOutput .= $this->addElement(1, $theIcon, $theData, $row_bgColor, '', '', '', $level); if ($this->localizationView && $this->l10nEnabled) { // For each available translation, render the record: if (is_array($this->translations)) { foreach ($this->translations as $lRow) { // $lRow isn't always what we want - if record was moved we've to work with the // placeholder records otherwise the list is messed up a bit if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) { $where = 't3ver_move_id="' . (int) $lRow['uid'] . '" AND pid="' . $row['_MOVE_PLH_pid'] . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . BackendUtility::deleteClause($table); $tmpRow = BackendUtility::getRecordRaw($table, $where, $this->selFieldList); $lRow = is_array($tmpRow) ? $tmpRow : $lRow; } // In offline workspace, look for alternative record: BackendUtility::workspaceOL($table, $lRow, $this->backendUser->workspace, true); if (is_array($lRow) && $this->backendUser->checkLanguageAccess($lRow[$GLOBALS['TCA'][$table]['ctrl']['languageField']])) { $this->currentIdList[] = $lRow['uid']; if ($row['tx_gridelements_container']) { $lRow['_CSSCLASS'] = 't3-gridelements-child" data-trigger-container="' . $row['tx_gridelements_container'] . $expanded; } $rowOutput .= $this->renderListRow($table, $lRow, $cc, $titleCol, $thumbsCol, 20, $level); } } } } if ($theData['_EXPANDABLE_'] && $level < 8 && ($row['l18n_parent'] == 0 || !$this->localizationView)) { if (!empty($theData['_CHILDREN_'])) { $expanded = $this->expandedGridelements[$row['uid']] ? '" style="display: table-row;' : ''; $lastGridColumn = ''; $originalMoveUp = $this->showMoveUp; $originalMoveDown = $this->showMoveDown; $prevPrevUid = (int) $theData['_CHILDREN_'][0]['uid']; $prevUid = (int) $theData['_CHILDREN_'][1]['uid']; foreach ($theData['_CHILDREN_'] as $key => $child) { if ($key > 1) { if ($prevUid) { $this->currentTable['prev'][$child['uid']] = $prevPrevUid; $this->currentTable['next'][$prevUid] = -(int) $child['uid']; $this->currentTable['prevUid'][$child['uid']] = $prevUid; } $prevPrevUid = isset($this->currentTable['prev'][$child['uid']]) ? -$prevUid : $row['pid']; $prevUid = $child['uid']; } } foreach ($theData['_CHILDREN_'] as $key => $child) { if (isset($child['tx_gridelements_columns']) && $child['tx_gridelements_columns'] != $lastGridColumn) { $lastGridColumn = $child['tx_gridelements_columns']; $this->showMoveUp = false; $rowOutput .= '<tr class="t3-gridelements-child" data-trigger-container="' . ($this->localizationView && $row['l18n_parent'] ? $row['l18n_parent'] : $row['uid']) . $expanded . '" data-grid-container="' . $row['uid'] . '"> <td colspan="2"></td> <td colspan="' . (count($this->fieldArray) - 1 + $this->maxDepth) . '" style="padding:5px;"> <br /> <strong>' . $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:list.columnName') . ' ' . ($backendLayoutColumns[$child['tx_gridelements_columns']] ? $backendLayoutColumns[$child['tx_gridelements_columns']] : (int) $child['tx_gridelements_columns']) . '</strong> </td> </tr>'; } else { $this->showMoveUp = true; } if (isset($child['tx_gridelements_columns']) && isset($theData['_CHILDREN_'][$key + 1]) && $child['tx_gridelements_columns'] != $theData['_CHILDREN_'][$key + 1]['tx_gridelements_columns']) { $this->showMoveDown = false; } else { $this->showMoveDown = true; } $this->currentIdList[] = $child['uid']; if ($row['CType'] === 'gridelements_pi1') { $this->currentContainerIdList[] = $row['uid']; } $child['_CSSCLASS'] = 't3-gridelements-child" data-trigger-container="' . ($this->localizationView && $row['l18n_parent'] ? $row['l18n_parent'] : $row['uid']) . $expanded; $rowOutput .= $this->renderListRow($table, $child, $cc, $titleCol, $thumbsCol, 0, $level + 1, $expanded); } $this->showMoveUp = $originalMoveUp; $this->showMoveDown = $originalMoveDown; } } // Finally, return table row element: return $rowOutput; }
/** * 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'] . '">'; } } elseif ($fCol == 'numarticles') { $resArticles = $database->exec_SELECTquery('sum(amount) amount', 'tx_commerce_order_articles', 'order_uid = ' . (int) $row['uid'] . ' AND article_type_uid = ' . NORMALARTICLETYPE); if ($lokalRow = $database->sql_fetch_assoc($resArticles)) { $theData[$fCol] = $lokalRow['amount']; $row[$fCol] = $lokalRow['amount']; } } elseif ($fCol == 'article_number') { $articleNumber = array(); $resArticles = $database->exec_SELECTquery('article_number', 'tx_commerce_order_articles', 'order_uid = ' . (int) $row['uid'] . ' AND article_type_uid = ' . NORMALARTICLETYPE); while ($lokalRow = $database->sql_fetch_assoc($resArticles)) { $articleNumber[] = $lokalRow['article_number'] ? $lokalRow['article_number'] : $language->sL('no_article_number'); } $theData[$fCol] = implode(',', $articleNumber); } elseif ($fCol == 'article_name') { $articleName = array(); $resArticles = $database->exec_SELECTquery('title', 'tx_commerce_order_articles', 'order_uid = ' . (int) $row['uid'] . ' AND article_type_uid = ' . NORMALARTICLETYPE); while ($lokalRow = $database->sql_fetch_assoc($resArticles)) { $articleName[] = $lokalRow['title'] ? $lokalRow['title'] : $language->sL('no_article_title'); } $theData[$fCol] = implode(',', $articleName); } elseif ($fCol == 'order_type_uid_noName') { $typesResult = $database->exec_SELECTquery('*', 'tx_commerce_order_types', 'uid = ' . (int) $row['order_type_uid_noName']); while ($localRow = $database->sql_fetch_assoc($typesResult)) { if ($localRow['icon']) { $filepath = $this->backPath . SettingsFactory::getInstance()->getTcaValue('tx_commerce_order_types.columns.icon.config.uploadfolder') . '/' . $localRow['icon']; $theData[$fCol] = '<img ' . IconUtility::skinImg($this->backPath, $filepath, ' title="' . htmlspecialchars($localRow['title']) . '"' . $indentStyle); } else { $theData[$fCol] = $localRow['title']; } } } 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] .= ''; } elseif ($fCol == 'order_id') { $theData[$fCol] = $row[$fCol]; } else { $theData[$fCol] = $this->linkUrlMail(htmlspecialchars(BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'])), $row[$fCol]); } } // Add row to CSV list: if ($this->csvOutput) { $beCsvCharset = SettingsFactory::getInstance()->getExtConf('BECSVCharset'); // 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 (!$beCsvCharset) { $beCsvCharset = 'iso-8859-1'; } $csObj->initCharset($beCsvCharset); $csObj->convArray($row, $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'], $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; }
/** * Make 2nd level clickmenu (only for DBmenus) * * @param string $table Table name * @param int $uid UID for the current record. * @return string HTML content */ public function printNewDBLevel($table, $uid) { $localItems = []; $uid = (int) $uid; // Setting internal record to the table/uid : $this->rec = BackendUtility::getRecordWSOL($table, $uid); $menuItems = array(); $root = 0; // Rootlevel if ($table === 'pages' && $uid === 0) { $root = 1; } // If record was found, check permissions and get menu items. if (is_array($this->rec) || $root) { $lCP = $this->backendUser->calcPerms(BackendUtility::getRecord('pages', $table === 'pages' ? $this->rec['uid'] : $this->rec['pid'])); // Edit: if (!$root && ($this->backendUser->isPSet($lCP, $table, 'edit') || $this->backendUser->isPSet($lCP, $table, 'editcontent'))) { $this->editOK = TRUE; } $menuItems = $this->processingByExtClassArray($menuItems, $table, $uid); } $subname = GeneralUtility::_GP('subname'); if ($subname === 'moreoptions') { // If the page can be edited, then show this: if ($this->editOK) { if (($table === 'pages' || $table === 'tt_content') && !in_array('move_wizard', $this->disabledItems, TRUE)) { $localItems['move_wizard'] = $this->DB_moveWizard($table, $uid, $this->rec); } if (($table === 'pages' || $table === 'tt_content') && !in_array('new_wizard', $this->disabledItems, TRUE)) { $localItems['new_wizard'] = $this->DB_newWizard($table, $uid, $this->rec); } if ($table === 'pages' && !in_array('perms', $this->disabledItems, TRUE) && $this->backendUser->check('modules', 'system_BeuserTxPermission')) { $localItems['perms'] = $this->DB_perms($table, $uid, $this->rec); } if (!in_array('db_list', $this->disabledItems, TRUE) && $this->backendUser->check('modules', 'web_list')) { $localItems['db_list'] = $this->DB_db_list($table, $uid, $this->rec); } } // Temporary mount point item: if ($table === 'pages') { $localItems['temp_mount_point'] = $this->DB_tempMountPoint($uid); } // Merge the locally created items into the current menu items passed to this function. $menuItems = array_merge($menuItems, $localItems); } // Return the printed elements: if (!is_array($menuItems)) { $menuItems = array(); } return $this->printItems($menuItems, $root ? IconUtility::getSpriteIcon('apps-pagetree-root') . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) : IconUtility::getSpriteIconForRecord($table, $this->rec, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($this->rec, $table)))) . BackendUtility::getRecordTitle($table, $this->rec, TRUE)); }
/** * Creating the module output. * * @return void */ public function main() { $lang = $this->getLanguageService(); if ($this->page_id) { $backendUser = $this->getBackendUser(); // Get record for element: $elRow = BackendUtility::getRecordWSOL($this->table, $this->moveUid); // Headerline: Icon, record title: $headerLine = '<span title="' . BackendUtility::getRecordIconAltText($elRow, $this->table) . '">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($this->table, $elRow, Icon::SIZE_SMALL)->render() . '</span>'; $headerLine .= BackendUtility::getRecordTitle($this->table, $elRow, true); // Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently): $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(GeneralUtility::linkThisScript(array('makeCopy' => !$this->makeCopy))) . ';'; $headerLine .= '<input type="hidden" name="makeCopy" value="0" />' . '<input type="checkbox" name="makeCopy" id="makeCopy" value="1"' . ($this->makeCopy ? ' checked="checked"' : '') . ' onclick="' . htmlspecialchars($onClick) . '" /> <label for="makeCopy" class="t3-label-valign-top">' . $lang->getLL('makeCopy', 1) . '</label>'; // Add the header-content to the module content: $this->content .= $this->moduleTemplate->section('', $headerLine, false, true); // Reset variable to pick up the module content in: $code = ''; // IF the table is "pages": if ((string) $this->table == 'pages') { // Get page record (if accessible): $pageInfo = BackendUtility::readPageAccess($this->page_id, $this->perms_clause); if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo['pid'], $this->perms_clause)) { // Initialize the position map: $posMap = GeneralUtility::makeInstance(PageMovingPagePositionMap::class); $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move'; // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page). if ($pageInfo['pid']) { $pidPageInfo = BackendUtility::readPageAccess($pageInfo['pid'], $this->perms_clause); if (is_array($pidPageInfo)) { if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) { $code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int) $pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-up', Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, true) . '</a><br />'; } else { $code .= $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', $pidPageInfo, Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, true) . '<br />'; } } } // Create the position tree: $code .= $posMap->positionTree($this->page_id, $pageInfo, $this->perms_clause, $this->R_URI); } } // IF the table is "tt_content": if ((string) $this->table == 'tt_content') { // First, get the record: $tt_content_rec = BackendUtility::getRecord('tt_content', $this->moveUid); // ? if (!$this->input_moveUid) { $this->page_id = $tt_content_rec['pid']; } // Checking if the parent page is readable: $pageInfo = BackendUtility::readPageAccess($this->page_id, $this->perms_clause); if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo['pid'], $this->perms_clause)) { // Initialize the position map: $posMap = GeneralUtility::makeInstance(ContentMovingPagePositionMap::class); $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move'; $posMap->cur_sys_language = $this->sys_language; // Headerline for the parent page: Icon, record title: $headerLine = '<span title="' . BackendUtility::getRecordIconAltText($pageInfo, 'pages') . '">' . $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', $pageInfo, Icon::SIZE_SMALL)->render() . '</span>'; $headerLine .= BackendUtility::getRecordTitle('pages', $pageInfo, true); // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable: // SHARED page-TSconfig settings. // $modTSconfig_SHARED = BackendUtility::getModTSconfig($this->pageId, 'mod.SHARED'); $colPosArray = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $this->page_id, $this); $colPosIds = array(); foreach ($colPosArray as $colPos) { $colPosIds[] = $colPos[1]; } // Removing duplicates, if any $colPosList = implode(',', array_unique($colPosIds)); // Adding parent page-header and the content element columns from position-map: $code = $headerLine . '<br />'; $code .= $posMap->printContentElementColumns($this->page_id, $this->moveUid, $colPosList, 1, $this->R_URI); // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page). $code .= '<br /><br />'; if ($pageInfo['pid']) { $pidPageInfo = BackendUtility::readPageAccess($pageInfo['pid'], $this->perms_clause); if (is_array($pidPageInfo)) { if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) { $code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int) $pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-up', Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, true) . '</a><br />'; } else { $code .= $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', $pidPageInfo, Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, true) . '<br />'; } } } // Create the position tree (for pages): $code .= $posMap->positionTree($this->page_id, $pageInfo, $this->perms_clause, $this->R_URI); } } // Add the $code content as a new section to the module: $this->content .= $this->moduleTemplate->section($lang->getLL('selectPositionOfElement'), $code, false, true); } // Setting up the buttons and markers for docheader $this->getButtons(); // Build the <body> for the module $this->moduleTemplate->setTitle($lang->getLL('movingElement')); }
/** * Rendering a single row for the list * * @param string $table Table name * @param array $row Current record * @param integer $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 integer $indent Indent from left. * @param integer $level * @return string Table row for the element * @access private * @see getTable() */ public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent = 0, $level = 0) { $iOut = ''; // If in search mode, make sure the preview will show the correct page if (strlen($this->searchString)) { $id_orig = $this->id; $this->id = $row['pid']; } if (is_array($row)) { // Add special classes for first and last row $rowSpecial = ''; if ($cc == 1 && $indent == 0) { $rowSpecial .= ' firstcol'; } if ($cc == $this->totalRowCount || $cc == $this->iLimit) { $rowSpecial .= ' lastcol'; } // Background color, if any: if ($this->alternateBgColors) { $row_bgColor = $cc % 2 ? ' class="db_list_normal' . $rowSpecial . '"' : ' class="db_list_alt' . $rowSpecial . '"'; } else { $row_bgColor = ' class="db_list_normal' . $rowSpecial . '"'; } // Overriding with versions background color if any: $row_bgColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $row_bgColor; // Incr. counter. $this->counter++; // The icon with link $alttext = BackendUtility::getRecordIconAltText($row, $table); $iconImg = IconUtility::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($alttext), 'style' => $indent ? ' 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 == $titleCol) { $recTitle = BackendUtility::getRecordTitle($table, $row, FALSE, TRUE); // If the record is edit-locked by another user, we will show a little warning sign: if ($lockInfo = BackendUtility::isRecordLocked($table, $row['uid'])) { $warning = '<a href="#" onclick="alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . '); return false;" title="' . htmlspecialchars($lockInfo['msg']) . '">' . IconUtility::getSpriteIcon('status-warning-in-use') . '</a>'; } $theData[$fCol] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row); // Render thumbnails, if: // - a thumbnail column exists // - there is content in it // - the thumbnail column is visible for the current type $type = 0; if (isset($GLOBALS['TCA'][$table]['ctrl']['type'])) { $typeColumn = $GLOBALS['TCA'][$table]['ctrl']['type']; $type = $row[$typeColumn]; } // If current type doesn't exist, set it to 0 (or to 1 for historical reasons, if 0 doesn't exist) if (!isset($GLOBALS['TCA'][$table]['types'][$type])) { $type = isset($GLOBALS['TCA'][$table]['types'][0]) ? 0 : 1; } $visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem']; if ($this->thumbs && trim($row[$thumbsCol]) && preg_match('/(^|(.*(;|,)?))' . $thumbsCol . '(((;|,).*)|$)/', $visibleColumns) === 1) { $theData[$fCol] .= '<br />' . $this->thumbCode($row, $table, $thumbsCol); } $localizationMarkerClass = ''; if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0 && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0) { // It's a translated record with a language parent $localizationMarkerClass = ' localization'; } } elseif ($fCol == 'pid') { $theData[$fCol] = $row[$fCol]; } elseif ($fCol == '_PATH_') { $theData[$fCol] = $this->recPath($row['pid']); } elseif ($fCol == '_REF_') { $theData[$fCol] = $this->createReferenceHtml($table, $row['uid']); } elseif ($fCol == '_CONTROL_') { $theData[$fCol] = $this->makeControl($table, $row, $level); } elseif ($fCol == '_AFTERCONTROL_' || $fCol == '_AFTERREF_') { $theData[$fCol] = ' '; } elseif ($fCol == '_CLIPBOARD_') { $theData[$fCol] = $this->makeClip($table, $row); } elseif ($fCol == '_LOCALIZATION_') { list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row); $theData[$fCol] = $lC1; } elseif (!$fCol == '_LOCALIZATION_b') { $tmpProc = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid']); $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]); if ($this->csvOutput) { $row[$fCol] = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid']); } } elseif ($fCol == '_LOCALIZATION_b') { $theData[$fCol] = $lC2; } else { $tmpProc = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid']); $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]); if ($this->csvOutput) { $row[$fCol] = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid']); } } } // Reset the ID if it was overwritten if (strlen($this->searchString)) { $this->id = $id_orig; } // Add row to CSV list: if ($this->csvOutput) { $this->addToCSV($row, $table); } // Add classes to table cells $this->addElement_tdCssClass[$titleCol] = 'col-title' . $localizationMarkerClass; if (!$this->dontShowClipControlPanels) { $this->addElement_tdCssClass['_CONTROL_'] = 'col-control'; $this->addElement_tdCssClass['_AFTERCONTROL_'] = 'col-control-space'; $this->addElement_tdCssClass['_CLIPBOARD_'] = 'col-clipboard'; } $this->addElement_tdCssClass['_PATH_'] = 'col-path'; $this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa'; $this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb'; /** * @hook checkChildren * @date 2014-02-11 * @request Alexander Grein <*****@*****.**> */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { $hookObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classData); if (!$this->searchString && is_object($hookObject) && method_exists($hookObject, 'checkChildren')) { $hookObject->checkChildren($table, $row, $level, $theData, $this); } } } // Create element in table cells: $iOut .= $this->addelement(1, $theIcon, $theData, $row_bgColor, '', '', $level); // Finally, return table row element: if ($cc > 0 || !$this->csvOutput) { return $iOut; } else { return ''; } } }
/** * Setting page icon with clickmenu + uid for docheader * * @param array $pageRecord Current page * @return string Page info */ protected function getPageInfo($pageRecord) { // Add icon with clickmenu, etc: // If there IS a real page if (is_array($pageRecord) && $pageRecord['uid']) { $alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages'); $iconImg = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => $alttext)); // Make Icon: $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']); $uid = $pageRecord['uid']; $title = BackendUtility::getRecordTitle('pages', $pageRecord); } else { // On root-level of page tree // Make Icon $iconImg = IconUtility::getSpriteIcon('apps-pagetree-root', array('title' => htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']))); if ($GLOBALS['BE_USER']->user['admin']) { $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', 0); } else { $theIcon = $iconImg; } $uid = '0'; $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } // Setting icon with clickmenu + uid $pageInfo = $theIcon . '<strong>' . htmlspecialchars($title) . ' [' . $uid . ']</strong>'; return $pageInfo; }
/** * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu. * * @param string $table Table name * @param array $row Record array * @return string HTML for the icon * @todo Define visibility */ public function getIcon($table, $row) { // Initialization $alttext = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($row, $table); $iconImg = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $row, array('title' => $alttext)); $this->counter++; // The icon with link $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']); return $theIcon; }
/** * Create record header (includes teh record icon, record title etc.) * * @param array $row Record row. * @return string HTML */ public function getRecordHeader($row) { $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $toolTip = BackendUtility::getRecordToolTip($row, 'tt_content'); $line = '<span ' . $toolTip . ' title="' . BackendUtility::getRecordIconAltText($row, 'tt_content') . '">' . $iconFactory->getIconForRecord('tt_content', $row, Icon::SIZE_SMALL)->render() . '</span>'; $line .= BackendUtility::getRecordTitle('tt_content', $row, true); return $this->wrapRecordTitle($line, $row); }
/** * Print the content on a pad. Called from ->printClipboard() * * @access private * @param string $pad Pad reference * @return array Array with table rows for the clipboard. */ public function printContentFromTab($pad) { $lines = array(); if (is_array($this->clipData[$pad]['el'])) { foreach ($this->clipData[$pad]['el'] as $k => $v) { if ($v) { list($table, $uid) = explode('|', $k); $bgColClass = $table == '_FILE' && $this->fileMode || $table != '_FILE' && !$this->fileMode ? 'bgColor4-20' : 'bgColor4'; // Rendering files/directories on the clipboard if ($table == '_FILE') { $fileObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($v); if ($fileObject) { $thumb = ''; $folder = $fileObject instanceof \TYPO3\CMS\Core\Resource\Folder; $size = $folder ? '' : '(' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes)'; $icon = IconUtility::getSpriteIconForResource($fileObject, array('title' => $fileObject->getName() . ' ' . $size)); if (!$folder && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileObject->getExtension())) { $processedFile = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array()); if ($processedFile) { $thumbUrl = $processedFile->getPublicUrl(TRUE); $thumb = '<br /><img src="' . htmlspecialchars($thumbUrl) . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'title="' . htmlspecialchars($fileObject->getName()) . '" alt="" />'; } } $lines[] = ' <tr> <td nowrap="nowrap" class="col-icon">' . $icon . '</td> <td nowrap="nowrap" width="95%">' . $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getName(), $this->getBackendUser()->uc['titleLen'])), $fileObject->getName()) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . ' ' . $thumb . '</td> <td nowrap="nowrap" class="col-control"> <div class="btn-group"> <a class="btn btn-default" href="#" onclick="' . htmlspecialchars('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($v) . '); return false;') . '">' . IconUtility::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a class="btn btn-default" href="' . htmlspecialchars($this->removeUrl('_FILE', GeneralUtility::shortmd5($v))) . '#clip_head">' . IconUtility::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a> </div> </td> </tr>'; } else { // If the file did not exist (or is illegal) then it is removed from the clipboard immediately: unset($this->clipData[$pad]['el'][$k]); $this->changed = 1; } } else { // Rendering records: $rec = BackendUtility::getRecordWSOL($table, $uid); if (is_array($rec)) { $lines[] = ' <tr> <td nowrap="nowrap" class="col-icon">' . $this->linkItemText(IconUtility::getSpriteIconForRecord($table, $rec, array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars(BackendUtility::getRecordIconAltText($rec, $table)))), $rec, $table) . '</td> <td nowrap="nowrap" width="95%">' . $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . ' </td> <td nowrap="nowrap" class="col-control"> <div class="btn-group"> <a class="btn btn-default" href="#" onclick="' . htmlspecialchars('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', \'' . (int) $uid . '\'); return false;') . '">' . IconUtility::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a class="btn btn-default" href="' . htmlspecialchars($this->removeUrl($table, $uid)) . '#clip_head">' . IconUtility::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a> </div> </td> </tr>'; $localizationData = $this->getLocalizations($table, $rec, $bgColClass, $pad); if ($localizationData) { $lines[] = $localizationData; } } else { unset($this->clipData[$pad]['el'][$k]); $this->changed = 1; } } } } } if (!count($lines)) { $lines[] = ' <tr> <td class="col-icon"></td> <td colspan="2 nowrap="nowrap" width="95%"><em>(' . $this->clLabel('clipNoEl') . ')</em> </td> </tr>'; } $this->endClipboard(); return $lines; }
/** * Rendering a single row for the list * * @param string $table Table name * @param array $row Current record * @param integer $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 integer $indent Indent from left. * @return string Table row for the element * @access private * @see getTable() * @todo Define visibility */ public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent = 0) { $iOut = ''; // If in search mode, make sure the preview will show the correct page if (strlen($this->searchString)) { $id_orig = $this->id; $this->id = $row['pid']; } if (is_array($row)) { // Add special classes for first and last row $rowSpecial = ''; if ($cc == 1 && $indent == 0) { $rowSpecial .= ' firstcol'; } if ($cc == $this->totalRowCount || $cc == $this->iLimit) { $rowSpecial .= ' lastcol'; } // Background color, if any: if ($this->alternateBgColors) { $row_bgColor = $cc % 2 ? ' class="db_list_normal' . $rowSpecial . '"' : ' class="db_list_alt' . $rowSpecial . '"'; } else { $row_bgColor = ' class="db_list_normal' . $rowSpecial . '"'; } // Overriding with versions background color if any: $row_bgColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $row_bgColor; // Incr. counter. $this->counter++; // The icon with link $alttext = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($row, $table); $iconImg = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($alttext), 'style' => $indent ? ' 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 == $titleCol) { $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row, FALSE, TRUE); // If the record is edit-locked by another user, we will show a little warning sign: if ($lockInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::isRecordLocked($table, $row['uid'])) { $warning = '<a href="#" onclick="' . htmlspecialchars('alert(' . $GLOBALS['LANG']->JScharCode($lockInfo['msg']) . '); return false;') . '" title="' . htmlspecialchars($lockInfo['msg']) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-warning-in-use') . '</a>'; } $theData[$fCol] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row); // Render thumbsnails if a thumbnail column exists and there is content in it: if ($this->thumbs && trim($row[$thumbsCol])) { $theData[$fCol] .= '<br />' . $this->thumbCode($row, $table, $thumbsCol); } $localizationMarkerClass = ''; if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0 && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0) { // It's a translated record with a language parent $localizationMarkerClass = ' localization'; } } elseif ($fCol == 'pid') { $theData[$fCol] = $row[$fCol]; } elseif ($fCol == '_PATH_') { $theData[$fCol] = $this->recPath($row['pid']); } elseif ($fCol == '_REF_') { $theData[$fCol] = $this->createReferenceHtml($table, $row['uid']); } elseif ($fCol == '_CONTROL_') { $theData[$fCol] = $this->makeControl($table, $row); } elseif ($fCol == '_AFTERCONTROL_' || $fCol == '_AFTERREF_') { $theData[$fCol] = ' '; } 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') { } else { $tmpProc = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid']); $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]); if ($this->csvOutput) { $row[$fCol] = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid']); } } } // Reset the ID if it was overwritten if (strlen($this->searchString)) { $this->id = $id_orig; } // Add row to CSV list: if ($this->csvOutput) { $this->addToCSV($row, $table); } // Add classes to table cells $this->addElement_tdCssClass[$titleCol] = 'col-title' . $localizationMarkerClass; if (!$this->dontShowClipControlPanels) { $this->addElement_tdCssClass['_CONTROL_'] = 'col-control'; $this->addElement_tdCssClass['_AFTERCONTROL_'] = 'col-control-space'; $this->addElement_tdCssClass['_CLIPBOARD_'] = 'col-clipboard'; } $this->addElement_tdCssClass['_PATH_'] = 'col-path'; $this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa'; $this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb'; // Create element in table cells: $iOut .= $this->addelement(1, $theIcon, $theData, $row_bgColor); // Finally, return table row element: return $iOut; } }
/** * Setting page icon with clickMenu + uid for docheader * * @return string Record info */ public function getRecordInformation() { $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class); $pageRecord = $this->recordArray; $uid = ''; $additionalInfo = !empty($pageRecord['_additional_info']) ? $pageRecord['_additional_info'] : ''; // Add icon with clickMenu, etc: // If there IS a real page if (is_array($pageRecord) && $pageRecord['uid']) { $altText = BackendUtility::getRecordIconAltText($pageRecord, 'pages'); $iconImg = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => $altText)); // Make Icon: $theIcon = $moduleTemplate->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']); $uid = $pageRecord['uid']; $title = BackendUtility::getRecordTitle('pages', $pageRecord); // If the module is about a FAL resource } elseif (is_array($pageRecord) && !empty($pageRecord['combined_identifier'])) { try { $resourceObject = ResourceFactory::getInstance()->getInstance()->getObjectFromCombinedIdentifier($pageRecord['combined_identifier']); $title = $resourceObject->getName(); // If this is a folder but not in within file mount boundaries this is the root folder if ($resourceObject instanceof FolderInterface && !$resourceObject->getStorage()->isWithinFileMountBoundaries($resourceObject)) { $iconImg = '<span title="' . htmlspecialchars($title) . '">' . $iconFactory->getIconForResource($resourceObject, Icon::SIZE_SMALL, null, array('mount-root' => true))->render() . '</span>'; } else { $iconImg = '<span title="' . htmlspecialchars($title) . '">' . $iconFactory->getIconForResource($resourceObject, Icon::SIZE_SMALL)->render() . '</span>'; } $theIcon = $moduleTemplate->wrapClickMenuOnIcon($iconImg, $pageRecord['combined_identifier']); } catch (ResourceDoesNotExistException $e) { $theIcon = ''; } } else { // On root-level of page tree // Make Icon $iconImg = '<span title="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render() . '</span>'; if ($this->getBackendUser()->isAdmin()) { $theIcon = $moduleTemplate->wrapClickMenuOnIcon($iconImg, 'pages', 0); } else { $theIcon = $iconImg; } $uid = '0'; $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } // Setting icon with clickMenu + uid return $theIcon . ' <strong>' . htmlspecialchars($title) . ($uid !== '' ? ' [' . $uid . ']' : '') . '</strong>' . (!empty($additionalInfo) ? ' ' . htmlspecialchars($additionalInfo) : ''); }
/** * Print the content on a pad. Called from ->printClipboard() * * @access private * @param string $pad Pad reference * @return array Array with table rows for the clipboard. * @todo Define visibility */ public function printContentFromTab($pad) { $lines = array(); if (is_array($this->clipData[$pad]['el'])) { foreach ($this->clipData[$pad]['el'] as $k => $v) { if ($v) { list($table, $uid) = explode('|', $k); $bgColClass = $table == '_FILE' && $this->fileMode || $table != '_FILE' && !$this->fileMode ? 'bgColor4-20' : 'bgColor4'; // Rendering files/directories on the clipboard if ($table == '_FILE') { $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($v); if ($fileObject) { $thumb = ''; $folder = $fileObject instanceof \TYPO3\CMS\Core\Resource\Folder; $size = $folder ? '' : '(' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($fileObject->getSize()) . 'bytes)'; $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForFile($folder ? 'folder' : strtolower($fileObject->getExtension()), array('style' => 'margin: 0 20px;', 'title' => $fileObject->getName() . ' ' . $size)); if ($this->clipData['_setThumb'] && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileObject->getExtension())) { $thumb = '<br />' . \TYPO3\CMS\Backend\Utility\BackendUtility::getThumbNail($this->backPath . 'thumbs.php', $v, ' vspace="4"'); } $lines[] = ' <tr> <td class="' . $bgColClass . '">' . $icon . '</td> <td class="' . $bgColClass . '" nowrap="nowrap" width="95%"> ' . $this->linkItemText(htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($fileObject->getName(), $GLOBALS['BE_USER']->uc['titleLen'])), $fileObject->getName()) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . ' ' . $thumb . '</td> <td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . $v . '\'); return false;') . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl('_FILE', \TYPO3\CMS\Core\Utility\GeneralUtility::shortmd5($v))) . '#clip_head">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td> </tr>'; } else { // If the file did not exist (or is illegal) then it is removed from the clipboard immediately: unset($this->clipData[$pad]['el'][$k]); $this->changed = 1; } } else { // Rendering records: $rec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $uid); if (is_array($rec)) { $lines[] = ' <tr> <td class="' . $bgColClass . '">' . $this->linkItemText(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $rec, array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($rec, $table)))), $rec, $table) . '</td> <td class="' . $bgColClass . '" nowrap="nowrap" width="95%"> ' . $this->linkItemText(htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $rec), $GLOBALS['BE_USER']->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . ' </td> <td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . intval($uid) . '\'); return false;') . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl($table, $uid)) . '#clip_head">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td> </tr>'; $localizationData = $this->getLocalizations($table, $rec, $bgColClass, $pad); if ($localizationData) { $lines[] = $localizationData; } } else { unset($this->clipData[$pad]['el'][$k]); $this->changed = 1; } } } } } if (!count($lines)) { $lines[] = ' <tr> <td class="bgColor4"><img src="clear.gif" width="56" height="1" alt="" /></td> <td colspan="2" class="bgColor4" nowrap="nowrap" width="95%"> <em>(' . $this->clLabel('clipNoEl') . ')</em> </td> </tr>'; } $this->endClipboard(); return $lines; }
/** * * Generates an icon leading to a record editing page using TYPO3-internal * functions. Used for example to provide icons allowing to edit fe_user * records. * * @param string $table The table from which a record is to be edited. * @param array $row The record to be edited as associative array. * @return string An icon linked to the editing form * */ function getItemFromRecord($table, $row) { global $BACK_PATH, $BE_USER; $iconAltText = BackendUtility::getRecordIconAltText($row, $table); //$elementTitle = BackendUtility::getRecordPath($row['uid'], '1=1', 0); //$elementTitle = GeneralUtility::fixed_lgd_cs($elementTitle, -($BE_USER->uc['titleLen'])); $elementIcon = IconUtility::getIconImage($table, $row, $BACK_PATH, 'class="c-recicon" title="' . $iconAltText . '"'); $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; $editOnClick = BackendUtility::editOnClick($params, $BACK_PATH); return '<a href="#" onclick="' . htmlspecialchars($editOnClick) . '">' . $elementIcon . '</a>'; }
/** * Renders the HTML header for a foreign record, such as the title, toggle-function, drag'n'drop, etc. * Later on the command-icons are inserted here. * * @param string $parentUid The uid of the parent (embedding) record (uid or NEW...) * @param string $foreign_table The foreign_table we create a header for * @param array $rec The current record of that foreign_table * @param array $config content of $PA['fieldConf']['config'] * @param boolean $isVirtualRecord * @return string The HTML code of the header * @todo Define visibility */ public function renderForeignRecordHeader($parentUid, $foreign_table, $rec, $config, $isVirtualRecord = FALSE) { // Init: $objectId = $this->inlineNames['object'] . self::Structure_Separator . $foreign_table . self::Structure_Separator . $rec['uid']; // We need the returnUrl of the main script when loading the fields via AJAX-call (to correct wizard code, so include it as 3rd parameter) // Pre-Processing: $isOnSymmetricSide = RelationHandler::isOnSymmetricSide($parentUid, $config, $rec); $hasForeignLabel = !$isOnSymmetricSide && $config['foreign_label'] ? TRUE : FALSE; $hasSymmetricLabel = $isOnSymmetricSide && $config['symmetric_label'] ? TRUE : FALSE; // Get the record title/label for a record: // Try using a self-defined user function only for formatted labels if (isset($GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc'])) { $params = array('table' => $foreign_table, 'row' => $rec, 'title' => '', 'isOnSymmetricSide' => $isOnSymmetricSide, 'options' => isset($GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc_options']) ? $GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc_options'] : array(), 'parent' => array('uid' => $parentUid, 'config' => $config)); // callUserFunction requires a third parameter, but we don't want to give $this as reference! $null = NULL; GeneralUtility::callUserFunction($GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc'], $params, $null); $recTitle = $params['title']; // Try using a normal self-defined user function } elseif (isset($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc'])) { $params = array('table' => $foreign_table, 'row' => $rec, 'title' => '', 'isOnSymmetricSide' => $isOnSymmetricSide, 'parent' => array('uid' => $parentUid, 'config' => $config)); // callUserFunction requires a third parameter, but we don't want to give $this as reference! $null = NULL; GeneralUtility::callUserFunction($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc'], $params, $null); $recTitle = $params['title']; } elseif ($hasForeignLabel || $hasSymmetricLabel) { $titleCol = $hasForeignLabel ? $config['foreign_label'] : $config['symmetric_label']; $foreignConfig = $this->getPossibleRecordsSelectorConfig($config, $titleCol); // Render title for everything else than group/db: if ($foreignConfig['type'] != 'groupdb') { $recTitle = BackendUtility::getProcessedValueExtra($foreign_table, $titleCol, $rec[$titleCol], 0, 0, FALSE); } else { // $recTitle could be something like: "tx_table_123|...", $valueParts = GeneralUtility::trimExplode('|', $rec[$titleCol]); $itemParts = GeneralUtility::revExplode('_', $valueParts[0], 2); $recTemp = BackendUtility::getRecordWSOL($itemParts[0], $itemParts[1]); $recTitle = BackendUtility::getRecordTitle($itemParts[0], $recTemp, FALSE); } $recTitle = BackendUtility::getRecordTitlePrep($recTitle); if (trim($recTitle) === '') { $recTitle = BackendUtility::getNoRecordTitle(TRUE); } } else { $recTitle = BackendUtility::getRecordTitle($foreign_table, $rec, TRUE); } $altText = BackendUtility::getRecordIconAltText($rec, $foreign_table); $iconImg = IconUtility::getSpriteIconForRecord($foreign_table, $rec, array('title' => htmlspecialchars($altText), 'id' => $objectId . '_icon')); $label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>'; $ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord); $thumbnail = FALSE; // Renders a thumbnail for the header if (!empty($config['appearance']['headerThumbnail']['field'])) { $fieldValue = $rec[$config['appearance']['headerThumbnail']['field']]; $firstElement = array_shift(GeneralUtility::trimExplode(',', $fieldValue)); $fileUid = array_pop(BackendUtility::splitTable_Uid($firstElement)); if (!empty($fileUid)) { $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileObject($fileUid); if ($fileObject && $fileObject->isMissing()) { $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject); $thumbnail = $flashMessage->render(); } elseif ($fileObject) { $imageSetup = $config['appearance']['headerThumbnail']; unset($imageSetup['field']); $imageSetup = array_merge(array('width' => '45', 'height' => '45c'), $imageSetup); $processedImage = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $imageSetup); // Only use a thumbnail if the processing was successful. if (!$processedImage->usesOriginalFile()) { $imageUrl = $processedImage->getPublicUrl(TRUE); $thumbnail = '<img class="t3-form-field-header-inline-thumbnail-image" src="' . $imageUrl . '" alt="' . htmlspecialchars($altText) . '" title="' . htmlspecialchars($altText) . '">'; } } } } if (!empty($config['appearance']['headerThumbnail']['field']) && $thumbnail) { $headerClasses = ' t3-form-field-header-inline-has-thumbnail'; $mediaContainer = '<div class="t3-form-field-header-inline-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</div>'; } else { $headerClasses = ' t3-form-field-header-inline-has-icon'; $mediaContainer = '<div class="t3-form-field-header-inline-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</div>'; } $header = '<div class="t3-form-field-header-inline-wrap' . $headerClasses . '">' . '<div class="t3-form-field-header-inline-ctrl">' . $ctrl . '</div>' . '<div class="t3-form-field-header-inline-body">' . $mediaContainer . '<div class="t3-form-field-header-inline-summary">' . $label . '</div>' . '</div>' . '</div>'; return $header; }
/** * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu. * * @param string $table Table name * @param array $row Record array * @return string HTML for the icon * @todo Define visibility */ public function getIcon($table, $row) { // Initialization $alttext = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($row, $table); $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $row, array('title' => $alttext)); $this->counter++; // The icon with link if ($GLOBALS['BE_USER']->recordEditAccessInternals($table, $row)) { $icon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($icon, $table, $row['uid']); } return $icon; }