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


PHP BackendUtility::getProcessedValueExtra方法代码示例

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


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

示例1: getResultRow

 /**
  * Process every columns of a row to convert value
  *
  * @param array  $row
  * @param string $table
  * @return array
  */
 public static function getResultRow($row, $table, $excludeFields = '', $export = false)
 {
     $record = array();
     foreach ($row as $fieldName => $fieldValue) {
         if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($excludeFields, $fieldName)) {
             $record[$fieldName] = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($table, $fieldName, $fieldValue, 0, $row['uid']);
             if (trim($record[$fieldName]) == 'N/A') {
                 $record[$fieldName] = '';
             }
         } else {
             if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList('input', $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['type'])) {
                 $record[$fieldName] = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue($table, $fieldName, $fieldValue, 0, 1, 1, $row['uid'], true);
             } else {
                 $record[$fieldName] = $fieldValue;
             }
             if ($GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['type'] == 'input') {
                 if ($GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['eval'] == 'datetime' || $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['eval'] == 'date') {
                     $record[$fieldName] = $fieldValue;
                 }
             }
             if (empty($record[$fieldName])) {
                 $record[$fieldName] = $fieldValue;
             }
             if (trim($record[$fieldName]) == 'N/A') {
                 $record[$fieldName] = '';
             }
         }
         if ($export === true) {
             // add path to files
             if ($GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['type'] == 'group' && $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['internal_type'] == 'file') {
                 if (!empty($record[$fieldName])) {
                     $files = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $record[$fieldName]);
                     $newFiles = array();
                     foreach ($files as $file) {
                         $newFiles[] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . '/' . $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['uploadfolder'] . '/' . $file;
                     }
                     $record[$fieldName] = implode(', ', $newFiles);
                 }
             }
             if ($GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['type'] == 'text' && !empty($GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['wizards']['RTE'])) {
                 $lCobj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
                 $lCobj->start(array(), '');
                 $record[$fieldName] = $lCobj->parseFunc($record[$fieldName], array(), '< lib.parseFunc_RTE');
             }
         }
     }
     return $record;
 }
开发者ID:Apen,项目名称:recordsmanager,代码行数:55,代码来源:Config.php

示例2: getResultRow

 /**
  * Get the result row with getProcessedValueExtra()
  * It allow you to respect the TCA rules
  *
  * @param  array  $row
  * @param  string $table
  * @return array
  */
 public static function getResultRow($row, $table)
 {
     $record = array();
     foreach ($row as $fieldName => $fieldValue) {
         if (TYPO3_MODE == 'FE') {
             // $GLOBALS['TSFE']->includeTCA();
             $GLOBALS['LANG'] = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lang\\LanguageService');
             $GLOBALS['LANG']->init($GLOBALS['TSFE']->tmpl->setup['config.']['language']);
         }
         $record[$fieldName] = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($table, $fieldName, $fieldValue, 0, $row['uid']);
     }
     return $record;
 }
开发者ID:Apen,项目名称:t3devapi,代码行数:21,代码来源:class.tx_t3devapi_database.php

示例3: renderPropertiesAsTable

    /**
     * Render property array as html table
     *
     * @return string
     */
    protected function renderPropertiesAsTable()
    {
        $tableRows = array();
        $extraFields = array();
        if (in_array($this->type, array('folder', 'file'), TRUE)) {
            if ($this->type === 'file') {
                $extraFields['creation_date'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', TRUE);
                $extraFields['modification_date'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', TRUE);
            }
            $extraFields['storage'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xlf:sys_file.storage', TRUE);
            $extraFields['folder'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:folder', TRUE);
        } else {
            $extraFields['crdate'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', TRUE);
            $extraFields['cruser_id'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationUserId', TRUE);
            $extraFields['tstamp'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', TRUE);
            // check if the special fields are defined in the TCA ctrl section of the table
            foreach ($extraFields as $fieldName => $fieldLabel) {
                if (isset($GLOBALS['TCA'][$this->table]['ctrl'][$fieldName])) {
                    $extraFields[$GLOBALS['TCA'][$this->table]['ctrl'][$fieldName]] = $fieldLabel;
                } else {
                    unset($extraFields[$fieldName]);
                }
            }
        }
        foreach ($extraFields as $name => $fieldLabel) {
            $rowValue = '';
            if (!isset($this->row[$name])) {
                $resourceObject = $this->fileObject ?: $this->folderObject;
                if ($name === 'storage') {
                    $rowValue = $resourceObject->getStorage()->getName();
                } elseif ($name === 'folder') {
                    $rowValue = $resourceObject->getParentFolder()->getReadablePath();
                }
            } elseif (in_array($name, array('creation_date', 'modification_date'), TRUE)) {
                $rowValue = BackendUtility::datetime($this->row[$name]);
            } else {
                $rowValue = BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]);
            }
            // show the backend username who created the issue
            if ($name === 'cruser_id' && $rowValue) {
                $userTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('username, realName', 'be_users', 'uid = ' . (int) $rowValue);
                if ($userTemp['username'] !== '') {
                    $rowValue = $userTemp['username'];
                    if ($userTemp['realName'] !== '') {
                        $rowValue .= ' - ' . $userTemp['realName'];
                    }
                }
            }
            $tableRows[] = '
				<tr>
					<th>' . rtrim($fieldLabel, ':') . '</th>
					<td>' . htmlspecialchars($rowValue) . '</td>
				</tr>';
        }
        // Traverse the list of fields to display for the record:
        $fieldList = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], TRUE);
        foreach ($fieldList as $name) {
            $name = trim($name);
            $uid = $this->row['uid'];
            if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) {
                continue;
            }
            // Storage is already handled above
            if ($this->type === 'file' && $name === 'storage') {
                continue;
            }
            $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name));
            if ($isExcluded) {
                continue;
            }
            $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid);
            $itemLabel = $GLOBALS['LANG']->sL(BackendUtility::getItemLabel($this->table, $name), TRUE);
            $tableRows[] = '
				<tr>
					<td><strong>' . $itemLabel . '</strong></td>
					<td>' . htmlspecialchars($itemValue) . '</td>
				</tr>';
        }
        return '<table class="t3-table">' . implode('', $tableRows) . '</table>';
    }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:85,代码来源:ElementInformationController.php

示例4: renderForeignRecordHeader

    /**
     * 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;
    }
开发者ID:Audibene-GMBH,项目名称:TYPO3.CMS,代码行数:93,代码来源:InlineRecordContainer.php

示例5: valuelist

    /**
     * Renders the value list to a value
     *
     * @param array $parameter Parameter
     *
     * @return string HTML-Content
     */
    public function valuelist(array $parameter)
    {
        $database = $this->getDatabaseConnection();
        $language = $this->getLanguageService();
        $content = '';
        $foreignTable = 'tx_commerce_attribute_values';
        $table = 'tx_commerce_attributes';
        /**
         * Document template
         *
         * @var \TYPO3\CMS\Backend\Template\SmallDocumentTemplate $doc
         */
        $doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\SmallDocumentTemplate');
        $doc->backPath = $GLOBALS['BACK_PATH'];
        $attributeStoragePid = $parameter['row']['pid'];
        $attributeUid = $parameter['row']['uid'];
        /**
         * Select Attribute Values
         */
        // @todo TS config of fields in list
        $rowFields = array('attributes_uid', 'value');
        $titleCol = $GLOBALS['TCA'][$foreignTable]['ctrl']['label'];
        // Create the SQL query for selecting the elements in the listing:
        $result = $database->exec_SELECTquery('*', $foreignTable, 'pid = $attributeStoragePid ' . BackendUtility::deleteClause($foreignTable) . ' AND attributes_uid=\'' . $database->quoteStr($attributeUid, $foreignTable) . '\'');
        $dbCount = $database->sql_num_rows($result);
        $out = '';
        if ($dbCount) {
            /**
             * Only if we have a result
             */
            $theData[$titleCol] = '<span class="c-table">' . $language->sL('LLL:EXT:commerce/Resources/Private/Language/locallang_be.xml:attributeview.valuelist', 1) . '</span> (' . $dbCount . ')';
            $fieldCount = count($rowFields);
            $out .= '
					<tr>
						<td class="c-headLineTable" style="width:95%;" colspan="' . ($fieldCount + 1) . '">' . $theData[$titleCol] . '</td>
					</tr>';
            /**
             * Header colum
             */
            $out .= '<tr>';
            foreach ($rowFields as $field) {
                $out .= '<td class="c-headLineTable"><b>' . $language->sL(BackendUtility::getItemLabel($foreignTable, $field)) . '</b></td>';
            }
            $out .= '<td class="c-headLineTable"></td>';
            $out .= '</tr>';
            /**
             * Walk true Data
             */
            $cc = 0;
            $iOut = '';
            while ($row = $database->sql_fetch_assoc($result)) {
                $cc++;
                $rowBackgroundColor = $cc % 2 ? '' : ' bgcolor="' . \TYPO3\CMS\Core\Utility\GeneralUtility::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4, 10, 10, 10) . '"';
                /**
                 * Not very noice to render html_code directly
                 *
                 * @todo change rendering html code here
                 * */
                $iOut .= '<tr ' . $rowBackgroundColor . '>';
                foreach ($rowFields as $field) {
                    $iOut .= '<td>';
                    $wrap = array('', '');
                    switch ($field) {
                        case $titleCol:
                            $params = '&edit[' . $foreignTable . '][' . $row['uid'] . ']=edit';
                            $wrap = array('<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'])) . '">', '</a>');
                            break;
                        default:
                    }
                    $iOut .= implode(BackendUtility::getProcessedValue($foreignTable, $field, $row[$field], 100), $wrap);
                    $iOut .= '</td>';
                }
                /**
                 * Trash icon
                 */
                $onClick = 'deleteRecord(\'' . $foreignTable . '\', ' . $row['uid'] . ', \'alt_doc.php?edit[tx_commerce_attributes][' . $attributeUid . ']=edit\');';
                $iOut .= '<td>&nbsp;';
                $iOut .= '<a href="#" onclick="' . $onClick . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete') . '</a></td>';
                $iOut .= '</tr>';
            }
            $out .= $iOut;
            /**
             * Cerate the summ row
             */
            $out .= '<tr>';
            foreach ($rowFields as $field) {
                $out .= '<td class="c-headLineTable"><b>';
                if ($sum[$field] > 0) {
                    $out .= BackendUtility::getProcessedValueExtra($foreignTable, $field, $sum[$field], 100);
                }
                $out .= '</b></td>';
            }
            $out .= '<td class="c-headLineTable"></td>';
//.........这里部分代码省略.........
开发者ID:AndreasA,项目名称:commerce,代码行数:101,代码来源:AttributeEditFunc.php

示例6: renderListRow

 /**
  * 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] = '&nbsp;';
             } 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;
//.........这里部分代码省略.........
开发者ID:blumenbach,项目名称:bb-online.neu,代码行数:101,代码来源:DatabaseRecordList.php

示例7: renderPropertiesAsTable

    /**
     * Render property array as html table
     *
     * @return string
     */
    protected function renderPropertiesAsTable()
    {
        $tableRows = array();
        $extraFields = array();
        $lang = $this->getLanguageService();
        if (in_array($this->type, array('folder', 'file'), true)) {
            if ($this->type === 'file') {
                $extraFields['creation_date'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', true);
                $extraFields['modification_date'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', true);
            }
            $extraFields['storage'] = $lang->sL('LLL:EXT:lang/locallang_tca.xlf:sys_file.storage', true);
            $extraFields['folder'] = $lang->sL('LLL:EXT:lang/locallang_common.xlf:folder', true);
        } else {
            $extraFields['crdate'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', true);
            $extraFields['cruser_id'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationUserId', true);
            $extraFields['tstamp'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', true);
            // check if the special fields are defined in the TCA ctrl section of the table
            foreach ($extraFields as $fieldName => $fieldLabel) {
                if (isset($GLOBALS['TCA'][$this->table]['ctrl'][$fieldName])) {
                    $extraFields[$GLOBALS['TCA'][$this->table]['ctrl'][$fieldName]] = $fieldLabel;
                } else {
                    unset($extraFields[$fieldName]);
                }
            }
        }
        foreach ($extraFields as $name => $fieldLabel) {
            $rowValue = '';
            if (!isset($this->row[$name])) {
                $resourceObject = $this->fileObject ?: $this->folderObject;
                if ($name === 'storage') {
                    $rowValue = $resourceObject->getStorage()->getName();
                } elseif ($name === 'folder') {
                    $rowValue = $resourceObject->getParentFolder()->getReadablePath();
                }
            } elseif (in_array($name, array('creation_date', 'modification_date'), true)) {
                $rowValue = BackendUtility::datetime($this->row[$name]);
            } else {
                $rowValue = BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]);
            }
            // show the backend username who created the issue
            if ($name === 'cruser_id' && $rowValue) {
                $creatorRecord = BackendUtility::getRecord('be_users', $rowValue);
                if ($creatorRecord) {
                    /** @var Avatar $avatar */
                    $avatar = GeneralUtility::makeInstance(Avatar::class);
                    $icon = $avatar->render($creatorRecord);
                    $rowValue = '
                        <div class="media">
                            <div class="media-left">
                                ' . $icon . '
                            </div>
                            <div class="media-body">
                                <strong>' . htmlspecialchars($GLOBALS['BE_USER']->user['username']) . '</strong><br>
                                ' . ($GLOBALS['BE_USER']->user['realName'] ? htmlspecialchars($GLOBALS['BE_USER']->user['realName']) : '') . '
                            </div>
                        </div>';
                }
            }
            $tableRows[] = '
				<tr>
					<th class="col-nowrap">' . rtrim($fieldLabel, ':') . '</th>
					<td>' . ($name === 'cruser_id' ? $rowValue : htmlspecialchars($rowValue)) . '</td>
				</tr>';
        }
        // Traverse the list of fields to display for the record:
        $fieldList = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], true);
        foreach ($fieldList as $name) {
            $name = trim($name);
            $uid = $this->row['uid'];
            if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) {
                continue;
            }
            // Storage is already handled above
            if ($this->type === 'file' && $name === 'storage') {
                continue;
            }
            $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $this->getBackendUser()->check('non_exclude_fields', $this->table . ':' . $name));
            if ($isExcluded) {
                continue;
            }
            $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, false, $uid);
            $itemLabel = $lang->sL(BackendUtility::getItemLabel($this->table, $name), true);
            $tableRows[] = '
				<tr>
					<th class="col-nowrap">' . $itemLabel . '</th>
					<td>' . htmlspecialchars($itemValue) . '</td>
				</tr>';
        }
        return '
			<div class="table-fit table-fit-wrap">
				<table class="table table-striped table-hover">
					' . implode('', $tableRows) . '
				</table>
			</div>';
    }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:100,代码来源:ElementInformationController.php

示例8: getTcaRecordTitle

 /**
  * Returns TCA label, used in TCA only.
  *
  * @param array $params Record value
  */
 public function getTcaRecordTitle(array &$params)
 {
     $languageService = $this->getLanguageService();
     $feGroup = '';
     if ($params['row']['fe_group']) {
         $feGroup = $languageService->sL(BackendUtility::getItemLabel('tx_commerce_article_prices', 'fe_group'), 1) . BackendUtility::getProcessedValueExtra('tx_commerce_article_prices', 'fe_group', $params['row']['fe_group'], 100, $params['row']['uid']);
     }
     $params['title'] = $languageService->sL(BackendUtility::getItemLabel('tx_commerce_article_prices', 'price_gross'), 1) . ': ' . sprintf('%01.2f', $params['row']['price_gross'] / 100) . ', ' . $languageService->sL(BackendUtility::getItemLabel('tx_commerce_article_prices', 'price_net'), 1) . ': ' . sprintf('%01.2f', $params['row']['price_net'] / 100) . ' (' . $languageService->sL(BackendUtility::getItemLabel('tx_commerce_article_prices', 'price_scale_amount_start'), 1) . ': ' . $params['row']['price_scale_amount_start'] . ' ' . $languageService->sL(BackendUtility::getItemLabel('tx_commerce_article_prices', 'price_scale_amount_end'), 1) . ': ' . $params['row']['price_scale_amount_end'] . ') ' . $feGroup;
 }
开发者ID:BenjaminBeck,项目名称:commerce,代码行数:14,代码来源:ArticlePrice.php

示例9: renderDBInfo

    /**
     * Main function. Will generate the information to display for the item
     * set internally.
     *
     * @return 	void
     * @todo Define visibility
     */
    public function renderDBInfo()
    {
        // Print header, path etc:
        // @TODO invalid context menu code in the output
        $code = $this->doc->getHeader($this->table, $this->row, $this->pageinfo['_thePath'], 1) . '<br />';
        $this->content .= $this->doc->section('', $code);
        $tableRows = array();
        $extraFields = array('crdate' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.creationDate', 1), 'cruser_id' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.creationUserId', 1), 'tstamp' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.timestamp', 1));
        foreach ($extraFields as $name => $value) {
            $rowValue = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]);
            if ($name === 'cruser_id' && $rowValue) {
                $userTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('username, realName', 'be_users', 'uid = ' . intval($rowValue));
                if ($userTemp[0]['username'] !== '') {
                    $rowValue = $userTemp[0]['username'];
                    if ($userTemp[0]['realName'] !== '') {
                        $rowValue .= ' - ' . $userTemp[0]['realName'];
                    }
                }
            }
            $tableRows[] = '
				<tr>
					<td class="t3-col-header">' . $value . '</td>
					<td>' . htmlspecialchars($rowValue) . '</td>
				</tr>';
        }
        // Traverse the list of fields to display for the record:
        $fieldList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], 1);
        foreach ($fieldList as $name) {
            $name = trim($name);
            if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) {
                continue;
            }
            $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name));
            if ($isExcluded) {
                continue;
            }
            $uid = $this->row['uid'];
            $itemValue = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid);
            $itemLabel = $GLOBALS['LANG']->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel($this->table, $name), 1);
            $tableRows[] = '
				<tr>
					<td class="t3-col-header">' . $itemLabel . '</td>
					<td>' . htmlspecialchars($itemValue) . '</td>
				</tr>';
        }
        // Create table from the information:
        $tableCode = '
			<table border="0" cellpadding="0" cellspacing="0" id="typo3-showitem" class="t3-table-info">
				' . implode('', $tableRows) . '
			</table>';
        $this->content .= $this->doc->section('', $tableCode);
        // Add path and table information in the bottom:
        $code = '';
        $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], -48) . '<br />';
        $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.table') . ': ' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']) . ' (' . $this->table . ') - UID: ' . $this->uid . '<br />';
        $this->content .= $this->doc->section('', $code);
        // References:
        $references = $this->makeRef($this->table, $this->row['uid']);
        if (!empty($references)) {
            $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'), $references);
        }
        $referencesFrom = $this->makeRefFrom($this->table, $this->row['uid']);
        if (!empty($referencesFrom)) {
            $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesFromThisItem'), $referencesFrom);
        }
    }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:73,代码来源:ElementInformationController.php

示例10: renderListRow


//.........这里部分代码省略.........
                 $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;
 }
开发者ID:BenjaminBeck,项目名称:commerce,代码行数:101,代码来源:OrderRecordList.php

示例11: renderListRow

 /**
  * 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']);
//.........这里部分代码省略.........
开发者ID:stigfaerch,项目名称:gridelements,代码行数:101,代码来源:DatabaseRecordList.php

示例12: orderArticles


//.........这里部分代码省略.........
                    $row['price_net'] = $row['price_net'] * $row['amount'];
                    $row['price_gross'] = $row['price_net'] * (1 + (double) $row['tax'] / 100);
                } else {
                    $row['price_gross'] = $row['price_gross'] * $row['amount'];
                    $row['price_net'] = $row['price_gross'] / (1 + (double) $row['tax'] / 100);
                }
                $sum['price_net_value'] += $row['price_net'];
                $sum['price_gross_value'] += $row['price_gross'];
                $row['price_net'] = Money::format(strval($row['price_net']), $currency);
                $row['price_gross'] = Money::format(strval($row['price_gross']), $currency);
                $rowBgColor = $cc % 2 ? '' : ' bgcolor="' . GeneralUtility::modifyHTMLColor($this->getControllerDocumentTemplate()->bgColor4, +10, +10, +10) . '"';
                /*
                 * Not very nice to render html_code directly
                 * @todo change rendering html code here
                 */
                $iOut .= '<tr ' . $rowBgColor . '>';
                foreach ($fieldRows as $field) {
                    $wrap = array('', '');
                    switch ($field) {
                        case $titleCol:
                            $iOut .= '<td>';
                            if ($orderEditable) {
                                $params = '&edit[' . $orderArticleTable . '][' . $row['uid'] . ']=edit';
                                $wrap = array('<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->getBackPath())) . '">', '</a>');
                            }
                            break;
                        case 'amount':
                            $iOut .= '<td>';
                            if ($orderEditable) {
                                $params = '&edit[' . $orderArticleTable . '][' . $row['uid'] . ']=edit&columnsOnly=amount';
                                $onclickAction = 'onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->getBackPath())) . '"';
                                $wrap = array('<b><a href="#" ' . $onclickAction . '>' . IconUtility::getSpriteIcon('actions-document-open'), '</a></b>');
                            }
                            break;
                        case 'price_net':
                            // fall through
                        // fall through
                        case 'price_gross':
                            $iOut .= '<td style="text-align: right">';
                            break;
                        default:
                            $iOut .= '<td>';
                    }
                    $iOut .= implode(BackendUtility::getProcessedValue($orderArticleTable, $field, $row[$field], 100), $wrap);
                    $iOut .= '</td>';
                }
                /*
                 * Trash icon
                 */
                $iOut .= '<td></td>
					</tr>';
            }
            $out .= $iOut;
            /*
             * Cerate the summ row
             */
            $out .= '<tr>';
            $sum['price_net'] = Money::format(strval($sum['price_net_value']), $currency);
            $sum['price_gross'] = Money::format(strval($sum['price_gross_value']), $currency);
            foreach ($fieldRows as $field) {
                switch ($field) {
                    case 'price_net':
                        // fall through
                    // fall through
                    case 'price_gross':
                        $out .= '<td class="c-headLineTable" style="text-align: right"><b>';
                        break;
                    default:
                        $out .= '<td class="c-headLineTable"><b>';
                }
                if (!empty($sum[$field])) {
                    $out .= BackendUtility::getProcessedValueExtra($orderArticleTable, $field, $sum[$field], 100);
                }
                $out .= '</b></td>';
            }
            $out .= '<td class="c-headLineTable"></td></tr>';
            /*
             * Always
             * Update sum_price_net and sum_price_gross
             * To Be shure everything is ok
             */
            $values = array('sum_price_gross' => $sum['price_gross_value'], 'sum_price_net' => $sum['price_net_value']);
            /**
             * Order repository.
             *
             * @var OrderRepository
             */
            $orderRepository = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Repository\\OrderRepository');
            $orderRepository->updateByOrderId($orderId, $values);
        }
        $out = '
            <!--
                DB listing of elements: "' . htmlspecialchars($orderTable) . '"
            -->
            <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist">
                ' . $out . '
            </table>';
        $content .= $out;
        return $content;
    }
开发者ID:commerceteam,项目名称:commerce,代码行数:101,代码来源:OrderEditFunc.php

示例13: renderListRow

 /**
  * 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] = '&nbsp;';
             } 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) {
//.........这里部分代码省略.........
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:101,代码来源:DatabaseRecordList.php

示例14: renderForeignRecordHeader

 /**
  * 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;
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:74,代码来源:InlineElement.php

示例15: renderListRow

 /**
  * 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
     $toolTip = BackendUtility::getRecordToolTip($row, $table);
     $additionalStyle = $indent ? ' style="margin-left: ' . $indent . 'px;"' : '';
     $iconImg = '<span ' . $toolTip . ' ' . $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 = '';
     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'] = '<div class="btn-group">' . $lC2 . '</div>';
         } 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']);
//.........这里部分代码省略.........
开发者ID:CDRO,项目名称:TYPO3.CMS,代码行数:101,代码来源:DatabaseRecordList.php


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