コード例 #1
0
 /**
  * Preprocesses the preview rendering of a content element of type "script"
  *
  * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object
  * @param bool $drawItem Whether to draw the item using the default functionality
  * @param string $headerContent Header content
  * @param string $itemContent Item content
  * @param array $row Record row of tt_content
  *
  * @return void
  */
 public function preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row)
 {
     if ($row['CType'] === 'script') {
         $itemContent .= $this->getLanguageService()->sL(BackendUtility::getItemLabel('tt_content', 'select_key'), TRUE) . ' ' . $row['select_key'] . '<br />';
         $itemContent .= '<br />' . $parentObject->linkEditContent($parentObject->renderText($row['bodytext']), $row) . '<br />';
         $itemContent .= '<br />' . $parentObject->linkEditContent($parentObject->renderText($row['imagecaption']), $row) . '<br />';
         $drawItem = FALSE;
     }
 }
コード例 #2
0
 /**
  * Get locallang label
  *
  * @param string $name Locallang label index
  *
  * @return string The label
  */
 static function fName($name)
 {
     return stripslashes($GLOBALS['LANG']->sL(BackendUtility::getItemLabel('sys_dmail', $name)));
 }
コード例 #3
0
 /**
  * Evaluates 'check' type values.
  *
  * @param array $res The result array. The processed value (if any!) is set in the 'value' key.
  * @param string $value The value to set.
  * @param array $tcaFieldConf Field configuration from TCA
  * @param string $table Table name
  * @param int $id UID of record
  * @param int $realPid The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted. If $realPid is -1 it means that a new version of the record is being inserted.
  * @param string $field Field name
  * @return array Modified $res array
  */
 protected function checkValueForCheck($res, $value, $tcaFieldConf, $table, $id, $realPid, $field)
 {
     $items = $tcaFieldConf['items'];
     if ($tcaFieldConf['itemsProcFunc']) {
         /** @var ItemProcessingService $processingService */
         $processingService = GeneralUtility::makeInstance(ItemProcessingService::class);
         $items = $processingService->getProcessingItems($table, $realPid, $field, $this->checkValue_currentRecord, $tcaFieldConf, $tcaFieldConf['items']);
     }
     $itemC = count($items);
     if (!$itemC) {
         $itemC = 1;
     }
     $maxV = pow(2, $itemC) - 1;
     if ($value < 0) {
         // @todo: throw LogicException here? Negative values for checkbox items do not make sense and indicate a coding error.
         $value = 0;
     }
     if ($value > $maxV) {
         // @todo: This case is pretty ugly: If there is an itemsProcFunc registered, and if it returns a dynamic,
         // @todo: changing list of items, then it may happen that a value is transformed and vanished checkboxes
         // @todo: are permanently removed from the value.
         // @todo: Suggestion: Throw an exception instead? Maybe a specific, catchable exception that generates a
         // @todo: error message to the user - dynamic item sets via itemProcFunc on check would be a bad idea anyway.
         $value = $value & $maxV;
     }
     if ($field && $realPid >= 0 && $value > 0 && !empty($tcaFieldConf['eval'])) {
         $evalCodesArray = GeneralUtility::trimExplode(',', $tcaFieldConf['eval'], true);
         $otherRecordsWithSameValue = [];
         $maxCheckedRecords = 0;
         if (in_array('maximumRecordsCheckedInPid', $evalCodesArray, true)) {
             $otherRecordsWithSameValue = $this->getRecordsWithSameValue($table, $id, $field, $value, $realPid);
             $maxCheckedRecords = (int) $tcaFieldConf['validation']['maximumRecordsCheckedInPid'];
         }
         if (in_array('maximumRecordsChecked', $evalCodesArray, true)) {
             $otherRecordsWithSameValue = $this->getRecordsWithSameValue($table, $id, $field, $value);
             $maxCheckedRecords = (int) $tcaFieldConf['validation']['maximumRecordsChecked'];
         }
         // there are more than enough records with value "1" in the DB
         // if so, set this value to "0" again
         if ($maxCheckedRecords && count($otherRecordsWithSameValue) >= $maxCheckedRecords) {
             $value = 0;
             if ($this->enableLogging) {
                 $this->log($table, $id, 5, 0, 1, 'Could not activate checkbox for field "%s". A total of %s record(s) can have this checkbox activated. Uncheck other records first in order to activate the checkbox of this record.', -1, [$GLOBALS['LANG']->sL(BackendUtility::getItemLabel($table, $field)), $maxCheckedRecords]);
             }
         }
     }
     $res['value'] = $value;
     return $res;
 }
コード例 #4
0
 /**
  * Rendering the header row for a table
  *
  * @param string $table Table name
  * @param array $currentIdList Array of the currently displayed uids of the table
  *
  * @return string Header table row
  * @throws UnexpectedValueException If hook was of wrong interface
  */
 public function renderListHeader($table, array $currentIdList)
 {
     $language =& $this->getLanguageService();
     // Init:
     $theData = array();
     $icon = '';
     // Traverse the fields:
     foreach ($this->fieldArray as $fCol) {
         // Calculate users permissions to edit records in the table:
         $permsEdit = $this->calcPerms & ($table == 'tx_commerce_categories' ? 2 : 16);
         switch ((string) $fCol) {
             // Path
             case '_PATH_':
                 $theData[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels._PATH_', 1) . ']</i>';
                 break;
                 // References
             // References
             case '_REF_':
                 $theData[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_mod_file_list.xml:c__REF_', 1) . ']</i>';
                 break;
                 // Path
             // Path
             case '_LOCALIZATION_':
                 $theData[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels._LOCALIZATION_', 1) . ']</i>';
                 break;
                 // Path
             // Path
             case '_LOCALIZATION_b':
                 $theData[$fCol] = $language->getLL('Localize', 1);
                 break;
                 // Clipboard:
             // Clipboard:
             case '_CLIPBOARD_':
                 $cells = array();
                 // If there are elements on the clipboard for this table,
                 // then display the "paste into" icon:
                 $elFromTable = $this->clipObj->elFromTable($table);
                 if (count($elFromTable)) {
                     $cells['pasteAfter'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl($table, $this->id)) . '" onclick="' . htmlspecialchars('return ' . $this->clipObj->confirmMsg('tx_commerce_categories', $this->pageRow, 'into', $elFromTable)) . '" title="' . $language->getLL('clip_paste', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
                 }
                 // If the numeric clipboard pads are enabled,
                 // display the control icons for that:
                 if ($this->clipObj->current != 'normal') {
                     // The "select" link:
                     $cells['copyMarked'] = $this->linkClipboardHeaderIcon(IconUtility::getSpriteIcon('actions-edit-copy', array('title' => $language->getLL('clip_selectMarked', TRUE))), $table, 'setCB');
                     // The "edit marked" link:
                     $editIdList = implode(',', $currentIdList);
                     $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'";
                     $params = '&edit[' . $table . '][' . $editIdList . ']=edit&disHelp=1';
                     $cells['edit'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '">' . IconUtility::getSpriteIcon('actions-document-open', array('title' => $language->getLL('clip_editMarked', TRUE))) . '</a>';
                     // The "Delete marked" link:
                     $cells['delete'] = $this->linkClipboardHeaderIcon(IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->getLL('clip_deleteMarked', TRUE))), $table, 'delete', sprintf($language->getLL('clip_deleteMarkedWarning'), $language->sL($GLOBALS['TCA'][$table]['ctrl']['title'])));
                     // The "Select all" link:
                     $cells['markAll'] = '<a class="cbcCheckAll" rel="" href="#" onclick="' . htmlspecialchars('checkOffCB(\'' . implode(',', $this->CBnames) . '\', this); return false;') . '" title="' . $language->getLL('clip_markRecords', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-select') . '</a>';
                 } else {
                     $cells['empty'] = '';
                 }
                 /**
                  * Render list header actions hook: Allows to change the clipboard icons
                  * @date 2007-11-20
                  * @request Bernhard Kraft  <*****@*****.**>
                  * @usage Above each listed table in Web>List a header row is shown.
                  * 	This hook allows to modify the icons responsible for the clipboard
                  * 	functions (shown above the clipboard checkboxes when a clipboard
                  * 	other than "Normal" is selected), or other "Action" functions which
                  * 	perform operations on the listed records.
                  */
                 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 (!$hookObject instanceof \TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface) {
                             throw new UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Recordlist\\RecordList\\RecordListHookInterface', 1195567850);
                         }
                         $cells = $hookObject->renderListHeaderActions($table, $currentIdList, $cells, $this);
                     }
                 }
                 $theData[$fCol] = implode('', $cells);
                 break;
                 // Control panel:
             // Control panel:
             case '_CONTROL_':
                 if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly']) {
                     // If new records can be created on this page, add links:
                     if ($this->calcPerms & ($table == 'tx_commerce_categories' ? 8 : 16) && $this->showNewRecLink($table) && $this->parentUid) {
                         if ($table == 'tt_content' && $this->newWizards) {
                             // If mod.web_list.newContentWiz.overrideWithExtension is set,
                             // use that extension's create new content wizard instead:
                             $tmpTyposcriptConfig = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
                             $tmpTyposcriptConfig = $tmpTyposcriptConfig['properties']['newContentWiz.']['overrideWithExtension'];
                             $newContentWizScriptPath = $this->backPath . ExtensionManagementUtility::isLoaded($tmpTyposcriptConfig) ? ExtensionManagementUtility::extRelPath($tmpTyposcriptConfig) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php';
                             $icon = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $newContentWizScriptPath . '?id=' . $this->id . '\');') . '" title="' . $language->getLL('new', TRUE) . '">' . ($table == 'tx_commerce_categories' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
                         } elseif ($table == 'tx_commerce_categories' && $this->newWizards) {
                             $icon = '<a href="' . htmlspecialchars($this->backPath . 'db_new.php?id=' . $this->id . '&pagesOnly=1&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . '" title="' . $language->getLL('new', TRUE) . '">' . ($table == 'tx_commerce_categories' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
                         } else {
                             $parameters = '&edit[' . $table . '][' . $this->id . ']=new';
                             if ($table == 'pages_language_overlay') {
                                 $parameters .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageRow['doktype'];
                             }
                             switch ($table) {
                                 case 'tx_commerce_categories':
                                     $parameters .= '&defVals[tx_commerce_categories][parent_category]=' . $this->parentUid;
                                     break;
                                 case 'tx_commerce_products':
                                     $parameters .= '&defVals[tx_commerce_products][categories]=' . $this->parentUid;
                                     break;
                                 default:
                             }
                             $icon = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($parameters, $this->backPath, -1)) . '" title="' . $language->getLL('new', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a>';
                         }
                     }
                     // If the table can be edited, add link for editing
                     // ALL SHOWN fields for all listed records:
                     if ($permsEdit && $this->table && is_array($currentIdList)) {
                         $editIdList = implode(',', $currentIdList);
                         if ($this->clipNumPane()) {
                             $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'";
                         }
                         $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray) . '&disHelp=1';
                         $icon .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $language->getLL('editShownColumns', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                     }
                     // add an empty entry, so column count fits again after moving this into $icon
                     $theData[$fCol] = '&nbsp;';
                 }
                 break;
                 // space column
             // space column
             case '_AFTERCONTROL_':
                 // space column
             // space column
             case '_AFTERREF_':
                 $theData[$fCol] = '&nbsp;';
                 break;
                 // Regular fields header:
             // Regular fields header:
             default:
                 $theData[$fCol] = '';
                 if ($this->table && is_array($currentIdList)) {
                     // If the numeric clipboard pads are selected, show duplicate sorting link:
                     if ($this->clipNumPane()) {
                         $theData[$fCol] .= '<a href="' . htmlspecialchars($this->listURL('', -1) . '&duplicateField=' . $fCol) . '" title="' . $language->getLL('clip_duplicates', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-duplicates-select') . '</a>';
                     }
                     // If the table can be edited, add link for editing THIS field for all records:
                     if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly'] && $permsEdit && $GLOBALS['TCA'][$table]['columns'][$fCol]) {
                         $editIdList = implode(',', $currentIdList);
                         if ($this->clipNumPane()) {
                             $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'";
                         }
                         $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1';
                         $iTitle = sprintf($language->getLL('editThisColumn'), rtrim(trim($language->sL(BackendUtility::getItemLabel($table, $fCol))), ':'));
                         $theData[$fCol] .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . htmlspecialchars($iTitle) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                     }
                 }
                 $theData[$fCol] .= $this->addSortLink($language->sL(BackendUtility::getItemLabel($table, $fCol, '<i>[|]</i>')), $fCol, $table);
         }
     }
     /**
      * Above each listed table in Web>List a header row is shown.
      * Containing the labels of all shown fields and additional icons to
      * create new records for this table or perform special clipboard tasks
      * like mark and copy all listed records to clipboard, etc.
      */
     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 (!$hookObject instanceof \TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface) {
                 throw new UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Recordlist\\RecordList\\RecordListHookInterface', 1195567855);
             }
             $theData = $hookObject->renderListHeader($table, $currentIdList, $theData, $this);
         }
     }
     // Create and return header table row:
     return $this->addelement(1, $icon, $theData, ' class="c-headLine"', '');
 }
コード例 #5
0
ファイル: DatabaseRecordList.php プロジェクト: CDRO/TYPO3.CMS
 /**
  * Rendering the header row for a table
  *
  * @param string $table Table name
  * @param int[] $currentIdList Array of the currently displayed uids of the table
  * @throws \UnexpectedValueException
  * @return string Header table row
  * @access private
  * @see getTable()
  */
 public function renderListHeader($table, $currentIdList)
 {
     $lang = $this->getLanguageService();
     // Init:
     $theData = array();
     $icon = '';
     // Traverse the fields:
     foreach ($this->fieldArray as $fCol) {
         // Calculate users permissions to edit records in the table:
         $permsEdit = $this->calcPerms & ($table == 'pages' ? 2 : 16) && $this->overlayEditLockPermissions($table);
         switch ((string) $fCol) {
             case '_PATH_':
                 // Path
                 $theData[$fCol] = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels._PATH_', true) . ']</i>';
                 break;
             case '_REF_':
                 // References
                 $theData[$fCol] = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:c__REF_', true) . ']</i>';
                 break;
             case '_LOCALIZATION_':
                 // Path
                 $theData[$fCol] = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels._LOCALIZATION_', true) . ']</i>';
                 break;
             case '_LOCALIZATION_b':
                 // Path
                 $theData[$fCol] = $lang->getLL('Localize', true);
                 break;
             case '_CLIPBOARD_':
                 if (!$this->getModule()->MOD_SETTINGS['clipBoard']) {
                     break;
                 }
                 // Clipboard:
                 $cells = array();
                 // If there are elements on the clipboard for this table, and the parent page is not locked by editlock
                 // then display the "paste into" icon:
                 $elFromTable = $this->clipObj->elFromTable($table);
                 if (!empty($elFromTable) && $this->overlayEditLockPermissions($table)) {
                     $href = htmlspecialchars($this->clipObj->pasteUrl($table, $this->id));
                     $onClick = htmlspecialchars('return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable));
                     $cells['pasteAfter'] = '<a class="btn btn-default" href="' . $href . '" onclick="' . $onClick . '" title="' . $lang->getLL('clip_paste', true) . '">' . $this->iconFactory->getIcon('actions-document-paste-after', Icon::SIZE_SMALL)->render() . '</a>';
                 }
                 // If the numeric clipboard pads are enabled, display the control icons for that:
                 if ($this->clipObj->current != 'normal') {
                     // The "select" link:
                     $spriteIcon = '<span title="' . $lang->getLL('clip_selectMarked', true) . '">' . $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL)->render() . '</span>';
                     $cells['copyMarked'] = $this->linkClipboardHeaderIcon($spriteIcon, $table, 'setCB');
                     // The "edit marked" link:
                     $editIdList = implode(',', $currentIdList);
                     $editIdList = '\'+editList(' . GeneralUtility::quoteJSvalue($table) . ',' . GeneralUtility::quoteJSvalue($editIdList) . ')+\'';
                     $params = 'edit[' . $table . '][' . $editIdList . ']=edit';
                     $onClick = BackendUtility::editOnClick('', '', -1);
                     $onClickArray = explode('?', $onClick, 2);
                     $lastElement = array_pop($onClickArray);
                     array_push($onClickArray, $params . '&' . $lastElement);
                     $onClick = implode('?', $onClickArray);
                     $cells['edit'] = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $lang->getLL('clip_editMarked', true) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
                     // The "Delete marked" link:
                     $cells['delete'] = $this->linkClipboardHeaderIcon('<span title="' . $lang->getLL('clip_deleteMarked', true) . '">' . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</span>', $table, 'delete', sprintf($lang->getLL('clip_deleteMarkedWarning'), $lang->sL($GLOBALS['TCA'][$table]['ctrl']['title'])));
                     // The "Select all" link:
                     $onClick = htmlspecialchars('checkOffCB(' . GeneralUtility::quoteJSvalue(implode(',', $this->CBnames)) . ', this); return false;');
                     $cells['markAll'] = '<a class="btn btn-default" rel="" href="#" onclick="' . $onClick . '" title="' . $lang->getLL('clip_markRecords', true) . '">' . $this->iconFactory->getIcon('actions-document-select', Icon::SIZE_SMALL)->render() . '</a>';
                 } else {
                     $cells['empty'] = '';
                 }
                 /**
                  * @hook renderListHeaderActions: Allows to change the clipboard icons of the Web>List table headers
                  * @usage Above each listed table in Web>List a header row is shown.
                  *        This hook allows to modify the icons responsible for the clipboard functions
                  *        (shown above the clipboard checkboxes when a clipboard other than "Normal" is selected),
                  *        or other "Action" functions which perform operations on the listed records.
                  */
                 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 (!$hookObject instanceof RecordListHookInterface) {
                             throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567850);
                         }
                         $cells = $hookObject->renderListHeaderActions($table, $currentIdList, $cells, $this);
                     }
                 }
                 $theData[$fCol] = '<div class="btn-group" role="group">' . implode('', $cells) . '</div>';
                 break;
             case '_CONTROL_':
                 // Control panel:
                 if ($this->isEditable($table)) {
                     // If new records can be created on this page, add links:
                     $permsAdditional = $table === 'pages' ? 8 : 16;
                     if ($this->calcPerms & $permsAdditional && $this->showNewRecLink($table)) {
                         $spriteIcon = $table === 'pages' ? $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL) : $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL);
                         if ($table === 'tt_content' && $this->newWizards) {
                             // If mod.newContentElementWizard.override is set, use that extension's create new content wizard instead:
                             $tmpTSc = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod');
                             $newContentElementWizard = $tmpTSc['properties']['newContentElementWizard.']['override'] ?: 'new_content_element';
                             $newContentWizScriptPath = BackendUtility::getModuleUrl($newContentElementWizard, array('id' => $this->id));
                             $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($newContentWizScriptPath) . ');';
                             $icon = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $lang->getLL('new', true) . '">' . $spriteIcon->render() . '</a>';
                         } elseif ($table == 'pages' && $this->newWizards) {
                             $parameters = ['id' => $this->id, 'pagesOnly' => 1, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
                             $href = BackendUtility::getModuleUrl('db_new', $parameters);
                             $icon = '<a class="btn btn-default" href="' . htmlspecialchars($href) . '" title="' . $lang->getLL('new', true) . '">' . $spriteIcon->render() . '</a>';
                         } else {
                             $params = '&edit[' . $table . '][' . $this->id . ']=new';
                             if ($table == 'pages_language_overlay') {
                                 $params .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageRow['doktype'];
                             }
                             $icon = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1)) . '" title="' . $lang->getLL('new', true) . '">' . $spriteIcon->render() . '</a>';
                         }
                     }
                     // If the table can be edited, add link for editing ALL SHOWN fields for all listed records:
                     if ($permsEdit && $this->table && is_array($currentIdList)) {
                         $editIdList = implode(',', $currentIdList);
                         if ($this->clipNumPane()) {
                             $editIdList = '\'+editList(' . GeneralUtility::quoteJSvalue($table) . ',' . GeneralUtility::quoteJSvalue($editIdList) . ')+\'';
                         }
                         $params = 'edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray);
                         // we need to build this uri differently, otherwise GeneralUtility::quoteJSvalue messes up the edit list function
                         $onClick = BackendUtility::editOnClick('', '', -1);
                         $onClickArray = explode('?', $onClick, 2);
                         $lastElement = array_pop($onClickArray);
                         array_push($onClickArray, $params . '&' . $lastElement);
                         $onClick = implode('?', $onClickArray);
                         $icon .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $lang->getLL('editShownColumns', true) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
                         $icon = '<div class="btn-group" role="group">' . $icon . '</div>';
                     }
                     // Add an empty entry, so column count fits again after moving this into $icon
                     $theData[$fCol] = '&nbsp;';
                 }
                 break;
             default:
                 // Regular fields header:
                 $theData[$fCol] = '';
                 // Check if $fCol is really a field and get the label and remove the colons
                 // at the end
                 $sortLabel = BackendUtility::getItemLabel($table, $fCol);
                 if ($sortLabel !== null) {
                     $sortLabel = $lang->sL($sortLabel, true);
                     $sortLabel = rtrim(trim($sortLabel), ':');
                 } else {
                     // No TCA field, only output the $fCol variable with square brackets []
                     $sortLabel = htmlspecialchars($fCol);
                     $sortLabel = '<i>[' . rtrim(trim($sortLabel), ':') . ']</i>';
                 }
                 if ($this->table && is_array($currentIdList)) {
                     // If the numeric clipboard pads are selected, show duplicate sorting link:
                     if ($this->clipNumPane()) {
                         $theData[$fCol] .= '<a class="btn btn-default" href="' . htmlspecialchars($this->listURL('', '-1') . '&duplicateField=' . $fCol) . '" title="' . $lang->getLL('clip_duplicates', true) . '">' . $this->iconFactory->getIcon('actions-document-duplicates-select', Icon::SIZE_SMALL)->render() . '</a>';
                     }
                     // If the table can be edited, add link for editing THIS field for all
                     // listed records:
                     if ($this->isEditable($table) && $permsEdit && $GLOBALS['TCA'][$table]['columns'][$fCol]) {
                         $editIdList = implode(',', $currentIdList);
                         if ($this->clipNumPane()) {
                             $editIdList = '\'+editList(' . GeneralUtility::quoteJSvalue($table) . ',' . GeneralUtility::quoteJSvalue($editIdList) . ')+\'';
                         }
                         $params = 'edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol;
                         // we need to build this uri differently, otherwise GeneralUtility::quoteJSvalue messes up the edit list function
                         $onClick = BackendUtility::editOnClick('', '', -1);
                         $onClickArray = explode('?', $onClick, 2);
                         $lastElement = array_pop($onClickArray);
                         array_push($onClickArray, $params . '&' . $lastElement);
                         $onClick = implode('?', $onClickArray);
                         $iTitle = sprintf($lang->getLL('editThisColumn'), $sortLabel);
                         $theData[$fCol] .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . htmlspecialchars($iTitle) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
                     }
                     if (strlen($theData[$fCol]) > 0) {
                         $theData[$fCol] = '<div class="btn-group" role="group">' . $theData[$fCol] . '</div> ';
                     }
                 }
                 $theData[$fCol] .= $this->addSortLink($sortLabel, $fCol, $table);
         }
     }
     /**
      * @hook renderListHeader: Allows to change the contents of columns/cells of the Web>List table headers
      * @usage Above each listed table in Web>List a header row is shown.
      *        Containing the labels of all shown fields and additional icons to create new records for this
      *        table or perform special clipboard tasks like mark and copy all listed records to clipboard, etc.
      */
     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 (!$hookObject instanceof RecordListHookInterface) {
                 throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567855);
             }
             $theData = $hookObject->renderListHeader($table, $currentIdList, $theData, $this);
         }
     }
     // Create and return header table row:
     return '<thead>' . $this->addElement(1, $icon, $theData, '', '', '', 'th') . '</thead>';
 }
コード例 #6
0
 /**
  * Fetch further information to current selected workspace record.
  *
  * @param \stdClass $parameter
  * @return array $data
  */
 public function getRowDetails($parameter)
 {
     $diffReturnArray = array();
     $liveReturnArray = array();
     /** @var $diffUtility \TYPO3\CMS\Core\Utility\DiffUtility */
     $diffUtility = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\DiffUtility::class);
     /** @var $parseObj \TYPO3\CMS\Core\Html\RteHtmlParser */
     $parseObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Html\RteHtmlParser::class);
     $liveRecord = BackendUtility::getRecord($parameter->table, $parameter->t3ver_oid);
     $versionRecord = BackendUtility::getRecord($parameter->table, $parameter->uid);
     $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     $icon_Live = $iconFactory->getIconForRecord($parameter->table, $liveRecord, Icon::SIZE_SMALL)->render();
     $icon_Workspace = $iconFactory->getIconForRecord($parameter->table, $versionRecord, Icon::SIZE_SMALL)->render();
     $stagePosition = $this->getStagesService()->getPositionOfCurrentStage($parameter->stage);
     $fieldsOfRecords = array_keys($liveRecord);
     if ($GLOBALS['TCA'][$parameter->table]) {
         if ($GLOBALS['TCA'][$parameter->table]['interface']['showRecordFieldList']) {
             $fieldsOfRecords = $GLOBALS['TCA'][$parameter->table]['interface']['showRecordFieldList'];
             $fieldsOfRecords = GeneralUtility::trimExplode(',', $fieldsOfRecords, true);
         }
     }
     foreach ($fieldsOfRecords as $fieldName) {
         if (empty($GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['config'])) {
             continue;
         }
         // Get the field's label. If not available, use the field name
         $fieldTitle = $GLOBALS['LANG']->sL(BackendUtility::getItemLabel($parameter->table, $fieldName));
         if (empty($fieldTitle)) {
             $fieldTitle = $fieldName;
         }
         // Gets the TCA configuration for the current field
         $configuration = $GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['config'];
         // check for exclude fields
         if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['exclude'] == 0 || GeneralUtility::inList($GLOBALS['BE_USER']->groupData['non_exclude_fields'], $parameter->table . ':' . $fieldName)) {
             // call diff class only if there is a difference
             if ($configuration['type'] === 'inline' && $configuration['foreign_table'] === 'sys_file_reference') {
                 $useThumbnails = false;
                 if (!empty($configuration['foreign_selector_fieldTcaOverride']['config']['appearance']['elementBrowserAllowed']) && !empty($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'])) {
                     $fileExtensions = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], true);
                     $allowedExtensions = GeneralUtility::trimExplode(',', $configuration['foreign_selector_fieldTcaOverride']['config']['appearance']['elementBrowserAllowed'], true);
                     $differentExtensions = array_diff($allowedExtensions, $fileExtensions);
                     $useThumbnails = empty($differentExtensions);
                 }
                 $liveFileReferences = BackendUtility::resolveFileReferences($parameter->table, $fieldName, $liveRecord, 0);
                 $versionFileReferences = BackendUtility::resolveFileReferences($parameter->table, $fieldName, $versionRecord, $this->getCurrentWorkspace());
                 $fileReferenceDifferences = $this->prepareFileReferenceDifferences($liveFileReferences, $versionFileReferences, $useThumbnails);
                 if ($fileReferenceDifferences === null) {
                     continue;
                 }
                 $diffReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $fileReferenceDifferences['differences']);
                 $liveReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $fileReferenceDifferences['live']);
             } elseif ((string) $liveRecord[$fieldName] !== (string) $versionRecord[$fieldName]) {
                 // Select the human readable values before diff
                 $liveRecord[$fieldName] = BackendUtility::getProcessedValue($parameter->table, $fieldName, $liveRecord[$fieldName], 0, 1, false, $liveRecord['uid']);
                 $versionRecord[$fieldName] = BackendUtility::getProcessedValue($parameter->table, $fieldName, $versionRecord[$fieldName], 0, 1, false, $versionRecord['uid']);
                 if ($configuration['type'] == 'group' && $configuration['internal_type'] == 'file') {
                     $versionThumb = BackendUtility::thumbCode($versionRecord, $parameter->table, $fieldName, '');
                     $liveThumb = BackendUtility::thumbCode($liveRecord, $parameter->table, $fieldName, '');
                     $diffReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $versionThumb);
                     $liveReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $liveThumb);
                 } else {
                     $diffReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $diffUtility->makeDiffDisplay($liveRecord[$fieldName], $versionRecord[$fieldName]));
                     $liveReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $parseObj->TS_images_rte($liveRecord[$fieldName]));
                 }
             }
         }
     }
     // Hook for modifying the difference and live arrays
     // (this may be used by custom or dynamically-defined fields)
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray'] as $className) {
             $hookObject = GeneralUtility::getUserObj($className);
             if (method_exists($hookObject, 'modifyDifferenceArray')) {
                 $hookObject->modifyDifferenceArray($parameter, $diffReturnArray, $liveReturnArray, $diffUtility);
             }
         }
     }
     $commentsForRecord = $this->getCommentsForRecord($parameter->uid, $parameter->table);
     return array('total' => 1, 'data' => array(array('diff' => $diffReturnArray, 'live_record' => $liveReturnArray, 'icon_Live' => $icon_Live, 'icon_Workspace' => $icon_Workspace, 'comments' => $commentsForRecord, 'path_Live' => htmlspecialchars($parameter->path_Live), 'label_Stage' => htmlspecialchars($parameter->label_Stage), 'stage_position' => (int) $stagePosition['position'], 'stage_count' => (int) $stagePosition['count'])));
 }
コード例 #7
0
ファイル: DataHandler.php プロジェクト: rickymathew/TYPO3.CMS
 /**
  * Evaluates 'check' type values.
  *
  * @param array $res The result array. The processed value (if any!) is set in the 'value' key.
  * @param string $value The value to set.
  * @param array $tcaFieldConf Field configuration from TCA
  * @param string $table Table name
  * @param int $id UID of record
  * @param int $realPid The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted. If $realPid is -1 it means that a new version of the record is being inserted.
  * @param string $field Field name
  * @return array Modified $res array
  */
 protected function checkValueForCheck($res, $value, $tcaFieldConf, $table, $id, $realPid, $field)
 {
     $itemC = count($tcaFieldConf['items']);
     if (!$itemC) {
         $itemC = 1;
     }
     $maxV = pow(2, $itemC) - 1;
     if ($value < 0) {
         $value = 0;
     }
     if ($value > $maxV) {
         $value = $maxV;
     }
     if ($field && $realPid >= 0 && $value > 0 && !empty($tcaFieldConf['eval'])) {
         $evalCodesArray = GeneralUtility::trimExplode(',', $tcaFieldConf['eval'], true);
         $otherRecordsWithSameValue = array();
         $maxCheckedRecords = 0;
         if (in_array('maximumRecordsCheckedInPid', $evalCodesArray, true)) {
             $otherRecordsWithSameValue = $this->getRecordsWithSameValue($table, $id, $field, $value, $realPid);
             $maxCheckedRecords = (int) $tcaFieldConf['validation']['maximumRecordsCheckedInPid'];
         }
         if (in_array('maximumRecordsChecked', $evalCodesArray, true)) {
             $otherRecordsWithSameValue = $this->getRecordsWithSameValue($table, $id, $field, $value);
             $maxCheckedRecords = (int) $tcaFieldConf['validation']['maximumRecordsChecked'];
         }
         // there are more than enough records with value "1" in the DB
         // if so, set this value to "0" again
         if ($maxCheckedRecords && count($otherRecordsWithSameValue) >= $maxCheckedRecords) {
             $value = 0;
             if ($this->enableLogging) {
                 $this->log($table, $id, 5, 0, 1, 'Could not activate checkbox for field "%s". A total of %s record(s) can have this checkbox activated. Uncheck other records first in order to activate the checkbox of this record.', -1, array($GLOBALS['LANG']->sL(BackendUtility::getItemLabel($table, $field)), $maxCheckedRecords));
             }
         }
     }
     $res['value'] = $value;
     return $res;
 }
コード例 #8
0
ファイル: HistoryService.php プロジェクト: plan2net/TYPO3.CMS
 /**
  * Gets the differences between two record versions out
  * of one record history entry.
  *
  * @param array $entry Record history entry
  * @return array
  */
 protected function getDifferences(array $entry)
 {
     $differences = array();
     $tableName = $entry['tablename'];
     if (is_array($entry['newRecord'])) {
         $fields = array_keys($entry['newRecord']);
         foreach ($fields as $field) {
             if (!empty($GLOBALS['TCA'][$tableName]['columns'][$field]['config']['type']) && $GLOBALS['TCA'][$tableName]['columns'][$field]['config']['type'] !== 'passthrough') {
                 // Create diff-result:
                 $fieldDifferences = $this->getDifferencesObject()->makeDiffDisplay(BackendUtility::getProcessedValue($tableName, $field, $entry['oldRecord'][$field], 0, TRUE), BackendUtility::getProcessedValue($tableName, $field, $entry['newRecord'][$field], 0, TRUE));
                 if (!empty($fieldDifferences)) {
                     $differences[] = array('label' => $this->getLanguageService()->sl((string) BackendUtility::getItemLabel($tableName, $field)), 'html' => nl2br(trim($fieldDifferences)));
                 }
             }
         }
     }
     return $differences;
 }
コード例 #9
0
 /**
  * Generates a list of all saved Suppliers.
  *
  * @return string
  */
 protected function getSupplierListing()
 {
     $fields = explode(',', SettingsFactory::getInstance()->getExtConf('coSuppliers'));
     $headerRow = '<tr><td></td>';
     foreach ($fields as $field) {
         $headerRow .= '<td class="bgColor6"><strong>' . $this->getLanguageService()->sL(BackendUtility::getItemLabel('tx_commerce_supplier', htmlspecialchars($field))) . '</strong></td>';
     }
     $headerRow .= '</tr>';
     $result = $this->fetchDataByTable('tx_commerce_supplier');
     $supplierRows = $this->renderSupplierRows($result, $fields);
     $this->tableForNewLink = 'supplier';
     return '<table>' . $headerRow . $supplierRows . '</table>';
 }
コード例 #10
0
    /**
     * Main function. Will generate the information to display for the item
     * set internally.
     *
     * @param string $returnLinkTag <a> tag closing/returning.
     * @return void
     * @todo Define visibility
     */
    public function renderFileInfo($returnLinkTag)
    {
        $fileExtension = $this->fileObject->getExtension();
        $code = '<div class="fileInfoContainer">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForFile($fileExtension) . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.file', TRUE) . ':</strong> ' . $this->fileObject->getName() . '&nbsp;&nbsp;' . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.filesize') . ':</strong> ' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($this->fileObject->getSize()) . '</div>
			';
        $this->content .= $this->doc->section('', $code);
        $this->content .= $this->doc->divider(2);
        // If the file was an image...
        // @todo: add this check in the domain model, or in the processing folder
        if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {
            // @todo: find a way to make getimagesize part of the t3lib_file object
            $imgInfo = @getimagesize($this->fileObject->getForLocalProcessing(FALSE));
            $thumbUrl = $this->fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => '150m', 'height' => '150m'))->getPublicUrl(TRUE);
            $code = '<div class="fileInfoContainer fileDimensions">' . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.dimensions') . ':</strong> ' . $imgInfo[0] . 'x' . $imgInfo[1] . ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.pixels') . '</div>';
            $code .= '<br />
				<div align="center">' . $returnLinkTag . '<img src="' . $thumbUrl . '" alt="' . htmlspecialchars(trim($this->fileObject->getName())) . '" title="' . htmlspecialchars(trim($this->fileObject->getName())) . '" /></a></div>';
            $this->content .= $this->doc->section('', $code);
        } elseif ($fileExtension == 'ttf') {
            $thumbUrl = $this->fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => '530m', 'height' => '600m'))->getPublicUrl(TRUE);
            $thumb = '<br />
				<div align="center">' . $returnLinkTag . '<img src="' . $thumbUrl . '" border="0" title="' . htmlspecialchars(trim($this->fileObject->getName())) . '" alt="" /></a></div>';
            $this->content .= $this->doc->section('', $thumb);
        }
        // Traverse the list of fields to display for the record:
        $tableRows = array();
        $showRecordFieldList = $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'];
        $fieldList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $showRecordFieldList, TRUE);
        foreach ($fieldList as $name) {
            // Ignored fields
            if ($name === 'size') {
                continue;
            }
            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);
        // References:
        if ($this->fileObject->isIndexed()) {
            $references = $this->makeRef('_FILE', $this->fileObject);
            if (!empty($references)) {
                $header = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem');
                $this->content .= $this->doc->section($header, $references);
            }
        }
    }
コード例 #11
0
 /**
  * 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;
 }
コード例 #12
0
    /**
     * Create the selector box for selecting fields to display from a table:.
     *
     * @param string $table Table name
     * @param bool|int $formFields If true, form-fields will be wrapped
     *      around the table.
     *
     * @return string HTML table with the selector box
     *      (name: displayFields['.$table.'][])
     */
    public function fieldSelectBox($table, $formFields = 1)
    {
        $language = $this->getLanguageService();
        // Init:
        $formElements = array('', '');
        if ($formFields) {
            $formElements = array('<form action="' . htmlspecialchars($this->listURL()) . '" method="post">', '</form>');
        }
        // Load already selected fields, if any:
        $setFields = is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
        // Request fields from table:
        // $fields = $this->makeFieldList($table, FALSE, TRUE);
        $fields = $this->additionalFieldArray;
        // Add pseudo "control" fields
        $fields[] = '_PATH_';
        $fields[] = '_REF_';
        $fields[] = '_LOCALIZATION_';
        $fields[] = '_CONTROL_';
        $fields[] = '_CLIPBOARD_';
        // Create an option for each field:
        $opt = array();
        $opt[] = '<option value=""></option>';
        foreach ($fields as $fN) {
            $label = BackendUtility::getItemLabel($table, $fN, 'LLL:EXT:commerce/Resources/Private/Language/locallang_mod_orders.xml:|');
            $fl = $label ? $label : '[' . $fN . ']';
            // Field label
            $labelForField = SettingsFactory::getInstance()->getTcaValue($table . '.columns.' . $fN . '.label');
            $fL = $labelForField ? rtrim($language->sL($labelForField), ':') : $fl;
            $opt[] = '
                <option value="' . $fN . '"' . (in_array($fN, $setFields) ? ' selected="selected"' : '') . '>' . htmlspecialchars($fL) . '</option>';
        }
        // Compile the options into a multiple selector box:
        $lMenu = '
            <select size="' . max(min(count($fields) + 1, 20), 3) . '" multiple="multiple" name="displayFields[' . $table . '][]">' . implode('', $opt) . '</select>';
        // Table with the field selector::
        $content = '
            ' . $formElements[0] . '

            <!--
                Field selector for extended table view:
            -->
            <table border="0" cellpadding="0" cellspacing="0" id="typo3-dblist-fieldSelect">
                <tr>
                    <td>' . $lMenu . '</td>
                    <td><input type="submit" name="search" value="' . $language->sL('LLL:EXT:lang/locallang_core.php:labels.setFields', 1) . '" /></td>
                </tr>
            </table>
            ' . $formElements[1];
        return $content;
    }
コード例 #13
0
 /**
  * Address
  * Renders an address block.
  *
  * @param array $parameter Parameter
  * @param \TYPO3\CMS\Backend\Form\FormEngine $fobj Form engine
  * @param string $table Table
  * @param int $uid Record UID
  *
  * @return string HTML-Content
  */
 public function address(array $parameter, \TYPO3\CMS\Backend\Form\FormEngine $fobj, $table, $uid)
 {
     /**
      * Intialize Template Class
      * as this class is included via alt_doc we don't have to require template.php
      * in fact an require would cause an error.
      *
      * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
      */
     $doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
     $doc->backPath = $this->getBackPath();
     $content = '';
     /*
      * First select Data from Database
      */
     if ($data = BackendUtility::getRecord($table, $uid, 'uid,' . SettingsFactory::getInstance()->getTcaValue($table . '.interface.showRecordFieldList'))) {
         /*
          * We should get just one Result
          * So Render Result as $arr for template::table()
          */
         /*
          * Better formating via template class
          */
         $content .= $doc->spacer(10);
         /*
          * TYPO3 Core API's Page 63
          */
         $params = '&edit[' . $table . '][' . $uid . ']=edit';
         $onclickAction = 'onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->getBackPath())) . '"';
         $headerWrap = array('<b><a href="#" ' . $onclickAction . '>', '</a></b>');
         $content .= $doc->getHeader($table, $data, 'Local Lang definition is missing', 1, $headerWrap);
         $content .= $doc->spacer(10);
         $display = array();
         $showRecordFieldList = SettingsFactory::getInstance()->getTcaValue($table . '.interface.showRecordFieldList');
         foreach ($data as $key => $value) {
             /*
              * Walk through rowset,
              * get TCA values
              * and LL Names
              */
             if (GeneralUtility::inList($showRecordFieldList, $key)) {
                 /*
                  * Get The label
                  */
                 $translatedLabel = $this->getLanguageService()->sL(BackendUtility::getItemLabel($table, $key));
                 $display[$key] = array($translatedLabel, htmlspecialchars($value));
             }
         }
         $tableLayout = array('table' => array('<table>', '</table>'), 'defRowEven' => array('defCol' => array('<td class="bgColor5">', '</td>')), 'defRowOdd' => array('defCol' => array('<td class="bgColor4">', '</td>')));
         $content .= $doc->table($display, $tableLayout);
     }
     $content .= '<input type="hidden" name="' . $parameter['itemFormElName'] . '" value="' . htmlspecialchars($parameter['itemFormElValue']) . '">';
     return $content;
 }
コード例 #14
0
    /**
     * 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>';
            $out .= '</tr>';
        }
        $out = '
			<!--
				DB listing of elements: "' . htmlspecialchars($table) . '"
			-->
			<table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist">
				' . $out . '
			</table>';
        $content .= $out;
        /**
         * New article
         */
        $params = '&edit[' . $foreignTable . '][' . $attributeStoragePid . ']=new&defVals[' . $foreignTable . '][attributes_uid]=' . urlencode($attributeUid);
        $onClickAction = 'onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'])) . '"';
        $content .= '<div id="typo3-newRecordLink">
			<a href="#" ' . $onClickAction . '>
				' . $language->sL('LLL:EXT:commerce/Resources/Private/Language/locallang_be.xml:attributeview.addvalue', 1) . '</a>
			</div>';
        return $content;
    }
コード例 #15
0
    /**
     * shows the existing recipient lists and shows link to create a new one or import a list
     *
     * @return	string		List of existing recipient list, link to create a new list and link to import
     */
    public function showExistingRecipientLists()
    {
        $out = '<tr>
					<td class="t3-row-header" colspan="2">&nbsp;</td>
					<td class="t3-row-header">' . $GLOBALS['LANG']->sL(BackendUtility::getItemLabel('sys_dmail_group', 'title')) . '</td>
					<td class="t3-row-header">' . $GLOBALS['LANG']->sL(BackendUtility::getItemLabel('sys_dmail_group', 'type')) . '</td>
					<td class="t3-row-header">' . $GLOBALS['LANG']->sL(BackendUtility::getItemLabel('sys_dmail_group', 'description')) . '</td>
					<td class="t3-row-header">' . $GLOBALS['LANG']->getLL('recip_group_amount') . '</td>
				</tr>';
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,title,description,type', 'sys_dmail_group', 'pid = ' . intval($this->id) . BackendUtility::deleteClause('sys_dmail_group'), '', $GLOBALS['TYPO3_DB']->stripOrderBy($GLOBALS['TCA']['sys_dmail_group']['ctrl']['default_sortby']));
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
            $result = $this->cmd_compileMailGroup(intval($row['uid']));
            $count = 0;
            $idLists = $result['queryInfo']['id_lists'];
            if (is_array($idLists['tt_address'])) {
                $count += count($idLists['tt_address']);
            }
            if (is_array($idLists['fe_users'])) {
                $count += count($idLists['fe_users']);
            }
            if (is_array($idLists['PLAINLIST'])) {
                $count += count($idLists['PLAINLIST']);
            }
            if (is_array($idLists[$this->userTable])) {
                $count += count($idLists[$this->userTable]);
            }
            $out .= '<tr>
					<td nowrap="nowrap">' . IconUtility::getSpriteIconForRecord('sys_dmail_group', $row) . '</td>
					<td>' . $this->editLink('sys_dmail_group', $row['uid']) . '</td>
					<td nowrap="nowrap">' . $this->linkRecip_record('<strong>' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title'], 30)) . '</strong>&nbsp;&nbsp;', $row['uid']) . '</td>
					<td nowrap="nowrap">' . htmlspecialchars(BackendUtility::getProcessedValue('sys_dmail_group', 'type', $row['type'])) . '&nbsp;&nbsp;</td>
					<td>' . BackendUtility::getProcessedValue('sys_dmail_group', 'description', htmlspecialchars($row['description'])) . '&nbsp;&nbsp;</td>
					<td>' . $count . '</td>
				</tr>';
        }
        $out = '<table class="typo3-dblist" border="0" cellpadding="0" cellspacing="0">' . $out . '</table>';
        $theOutput = $this->doc->section(BackendUtility::cshItem($this->cshTable, 'select_mailgroup', $GLOBALS['BACK_PATH']) . $GLOBALS['LANG']->getLL('recip_select_mailgroup'), $out, 1, 1, 0, TRUE);
        // New:
        $out = '<a href="#" class="t3-link" onClick="' . BackendUtility::editOnClick('&edit[sys_dmail_group][' . $this->id . ']=new', $GLOBALS['BACK_PATH'], '') . '">' . IconUtility::getSpriteIconForRecord('sys_dmail_group', array()) . $GLOBALS['LANG']->getLL('recip_create_mailgroup_msg') . '</a>';
        $theOutput .= $this->doc->spacer(20);
        $theOutput .= $this->doc->section(BackendUtility::cshItem($this->cshTable, 'create_mailgroup', $GLOBALS['BACK_PATH']) . $GLOBALS['LANG']->getLL('recip_create_mailgroup'), $out, 1, 0, FALSE, TRUE, FALSE, TRUE);
        // Import
        $out = '<a class="t3-link" href="index.php?id=' . $this->id . '&CMD=displayImport">' . $GLOBALS['LANG']->getLL('recip_import_mailgroup_msg') . '</a>';
        $theOutput .= $this->doc->spacer(20);
        $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('mailgroup_import'), $out, 1, 1, 0, TRUE);
        return $theOutput;
    }
コード例 #16
0
 /**
  * Render list header
  *
  * @param string $table Table
  * @param array $currentIdList Current id list
  * @param array $headerColumns Header columns
  * @param Tx_Commerce_ViewHelpers_CategoryRecordList $parentObject Parent
  *
  * @return array
  */
 public function renderListHeader($table, $currentIdList, $headerColumns, &$parentObject)
 {
     $language = $this->getLanguageService();
     if (get_class($parentObject) == 'Tx_Commerce_ViewHelpers_OrderRecordList') {
         $icon = '';
         foreach ($parentObject->fieldArray as $fCol) {
             // Calculate users permissions to edit records in the table:
             $permsEdit = $parentObject->calcPerms & ($table == 'pages' ? 2 : 16);
             switch ((string) $fCol) {
                 // Path
                 case '_PATH_':
                     $headerColumns[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels._PATH_', 1) . ']</i>';
                     break;
                     // References
                 // References
                 case '_REF_':
                     $headerColumns[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_mod_file_list.xml:c__REF_', 1) . ']</i>';
                     break;
                     // Path
                 // Path
                 case '_LOCALIZATION_':
                     $headerColumns[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels._LOCALIZATION_', 1) . ']</i>';
                     break;
                     // Path
                 // Path
                 case '_LOCALIZATION_b':
                     $headerColumns[$fCol] = $language->getLL('Localize', 1);
                     break;
                     // Clipboard:
                 // Clipboard:
                 case '_CLIPBOARD_':
                     if ($parentObject->id && !$GLOBALS['TCA'][$table]['ctrl']['readOnly'] && $GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel']) {
                         $headerColumns[$fCol] = $language->getLL('moveorderto');
                     } else {
                         $headerColumns[$fCol] = '';
                     }
                     break;
                     // Control panel:
                 // Control panel:
                 case '_CONTROL_':
                     if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly']) {
                         // If new records can be created on this page, add links:
                         if ($parentObject->calcPerms & ($table == 'pages' ? 8 : 16) && $parentObject->showNewRecLink($table)) {
                             if ($table == 'pages') {
                                 $sprite = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-new');
                             } else {
                                 $sprite = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new');
                             }
                             if ($table == 'tt_content' && $parentObject->newWizards) {
                                 // If mod.web_list.newContentWiz.overrideWithExtension is set,
                                 // use that extension's create new content wizard instead:
                                 $tmpTypoScript = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($parentObject->id, 'mod.web_list');
                                 $tmpTypoScript = $tmpTypoScript['properties']['newContentWiz.']['overrideWithExtension'];
                                 $newContentWizScriptPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($tmpTypoScript) ? \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($tmpTypoScript) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php';
                                 $icon = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $newContentWizScriptPath . '?id=' . $parentObject->id . '\');') . '" title="' . $language->getLL('new', TRUE) . '">' . $sprite . '</a>';
                             } elseif ($table == 'pages' && $parentObject->newWizards) {
                                 $icon = '<a href="' . htmlspecialchars($parentObject->backPath . 'db_new.php?id=' . $parentObject->id . '&pagesOnly=1&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '" title="' . $language->getLL('new', TRUE) . '">' . $sprite . '</a>';
                             } else {
                                 $params = '&edit[' . $table . '][' . $parentObject->id . ']=new';
                                 if ($table == 'pages_language_overlay') {
                                     $params .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $parentObject->pageRow['doktype'];
                                 }
                                 $icon = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $parentObject->backPath, -1)) . '" title="' . $language->getLL('new', TRUE) . '">' . $sprite . '</a>';
                             }
                         }
                         // If the table can be edited, add link for editing
                         // ALL SHOWN fields for all listed records:
                         if ($permsEdit && $parentObject->table && is_array($currentIdList)) {
                             $editIdList = implode(',', $currentIdList);
                             if ($parentObject->clipNumPane()) {
                                 $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'";
                             }
                             $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $parentObject->fieldArray) . '&disHelp=1';
                             $icon .= '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $parentObject->backPath, -1)) . '" title="' . $language->getLL('editShownColumns', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                         }
                         // add an empty entry, so column count fits again after moving this into $icon
                         $headerColumns[$fCol] = '&nbsp;';
                     }
                     break;
                     // space column
                 // space column
                 case '_AFTERCONTROL_':
                     // space column
                 // space column
                 case '_AFTERREF_':
                     $headerColumns[$fCol] = '&nbsp;';
                     break;
                     // Regular fields header:
                 // Regular fields header:
                 default:
                     $headerColumns[$fCol] = '';
                     if ($parentObject->table && is_array($currentIdList)) {
                         // If the numeric clipboard pads are selected, show duplicate sorting link:
                         if ($parentObject->clipNumPane()) {
                             $headerColumns[$fCol] .= '<a href="' . htmlspecialchars($parentObject->listURL('', -1) . '&duplicateField=' . $fCol) . '" title="' . $language->getLL('clip_duplicates', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-duplicates-select') . '</a>';
                         }
                         // If the table can be edited, add link for
                         // editing THIS field for all listed records:
                         if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly'] && $permsEdit && $GLOBALS['TCA'][$table]['columns'][$fCol]) {
                             $editIdList = implode(',', $currentIdList);
                             if ($parentObject->clipNumPane()) {
                                 $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'";
                             }
                             $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1';
                             $iTitle = sprintf($language->getLL('editThisColumn'), rtrim(trim($language->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel($table, $fCol))), ':'));
                             $headerColumns[$fCol] .= '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $parentObject->backPath, -1)) . '" title="' . htmlspecialchars($iTitle) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                         }
                     }
                     $headerColumns[$fCol] .= $parentObject->addSortLink($language->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel($table, $fCol, 'LLL:EXT:commerce/Resources/Private/Language/locallang_mod_orders.xml:|')), $fCol, $table);
             }
         }
     }
     return $headerColumns;
 }
コード例 #17
0
ファイル: PageLayoutView.php プロジェクト: allipierre/Typo3
    /**
     * Draws the preview content for a content element
     *
     * @param string $row Content element
     * @param boolean $isRTE Set if the RTE link can be created.
     * @return string HTML
     * @throws \UnexpectedValueException
     * @todo Define visibility
     */
    public function tt_content_drawItem($row, $isRTE = FALSE)
    {
        $out = '';
        $outHeader = '';
        // Make header:
        if ($row['header']) {
            $infoArr = array();
            $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
            $hiddenHeaderNote = '';
            // If header layout is set to 'hidden', display an accordant note:
            if ($row['header_layout'] == 100) {
                $hiddenHeaderNote = ' <em>[' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.hidden', TRUE) . ']</em>';
            }
            $outHeader = $row['date'] ? htmlspecialchars($this->itemLabels['date'] . ' ' . BackendUtility::date($row['date'])) . '<br />' : '';
            $outHeader .= '<strong>' . $this->linkEditContent($this->renderText($row['header']), $row) . $hiddenHeaderNote . '</strong><br />';
        }
        // Make content:
        $infoArr = array();
        $drawItem = TRUE;
        // Hook: Render an own preview of a record
        $drawItemHooks =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'];
        if (is_array($drawItemHooks)) {
            foreach ($drawItemHooks as $hookClass) {
                $hookObject = GeneralUtility::getUserObj($hookClass);
                if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface) {
                    throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\View\\PageLayoutViewDrawItemHookInterface', 1218547409);
                }
                $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
            }
        }
        // Draw preview of the item depending on its CType (if not disabled by previous hook):
        if ($drawItem) {
            switch ($row['CType']) {
                case 'header':
                    if ($row['subheader']) {
                        $out .= $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
                    }
                    break;
                case 'text':
                case 'textpic':
                case 'image':
                    if ($row['CType'] == 'text' || $row['CType'] == 'textpic') {
                        if ($row['bodytext']) {
                            $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                        }
                    }
                    if ($row['CType'] == 'textpic' || $row['CType'] == 'image') {
                        if ($row['image']) {
                            $out .= $this->thumbCode($row, 'tt_content', 'image') . '<br />';
                            if ($row['imagecaption']) {
                                $out .= $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
                            }
                        }
                    }
                    break;
                case 'bullets':
                case 'table':
                case 'mailform':
                    if ($row['bodytext']) {
                        $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                    }
                    break;
                case 'uploads':
                    if ($row['media']) {
                        $out .= $this->thumbCode($row, 'tt_content', 'media') . '<br />';
                    }
                    break;
                case 'multimedia':
                    if ($row['multimedia']) {
                        $out .= $this->renderText($row['multimedia']) . '<br />';
                        $out .= $this->renderText($row['parameters']) . '<br />';
                    }
                    break;
                case 'menu':
                    if ($row['pages']) {
                        $out .= $this->linkEditContent($row['pages'], $row) . '<br />';
                    }
                    break;
                case 'shortcut':
                    if (!empty($row['records'])) {
                        $shortcutContent = array();
                        $recordList = explode(',', $row['records']);
                        foreach ($recordList as $recordIdentifier) {
                            $split = BackendUtility::splitTable_Uid($recordIdentifier);
                            $tableName = empty($split[0]) ? 'tt_content' : $split[0];
                            $shortcutRecord = BackendUtility::getRecord($tableName, $split[1]);
                            if (is_array($shortcutRecord)) {
                                $icon = IconUtility::getSpriteIconForRecord($tableName, $shortcutRecord);
                                $onClick = $this->getPageLayoutController()->doc->wrapClickMenuOnIcon($icon, $tableName, $shortcutRecord['uid'], 1, '', '+copy,info,edit,view', TRUE);
                                $shortcutContent[] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $icon . '</a>' . htmlspecialchars(BackendUtility::getRecordTitle($tableName, $shortcutRecord));
                            }
                        }
                        $out .= implode('<br />', $shortcutContent) . '<br />';
                    }
                    break;
                case 'list':
                    $hookArr = array();
                    $hookOut = '';
                    if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']])) {
                        $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']];
                    } elseif (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'])) {
                        $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'];
                    }
                    if (count($hookArr) > 0) {
                        $_params = array('pObj' => &$this, 'row' => $row, 'infoArr' => $infoArr);
                        foreach ($hookArr as $_funcRef) {
                            $hookOut .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
                        }
                    }
                    if ((string) $hookOut !== '') {
                        $out .= $hookOut;
                    } elseif (!empty($row['list_type'])) {
                        $label = BackendUtility::getLabelFromItemlist('tt_content', 'list_type', $row['list_type']);
                        if (!empty($label)) {
                            $out .= '<strong>' . $this->getLanguageService()->sL($label, TRUE) . '</strong><br />';
                        } else {
                            $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue'), $row['list_type']);
                            $out .= GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($message), '', FlashMessage::WARNING)->render();
                        }
                    } elseif (!empty($row['select_key'])) {
                        $out .= $this->getLanguageService()->sL(BackendUtility::getItemLabel('tt_content', 'select_key'), TRUE) . ' ' . $row['select_key'] . '<br />';
                    } else {
                        $out .= '<strong>' . $this->getLanguageService()->getLL('noPluginSelected') . '</strong>';
                    }
                    $out .= $this->getLanguageService()->sL(BackendUtility::getLabelFromItemlist('tt_content', 'pages', $row['pages']), TRUE) . '<br />';
                    break;
                case 'script':
                    $out .= $this->getLanguageService()->sL(BackendUtility::getItemLabel('tt_content', 'select_key'), TRUE) . ' ' . $row['select_key'] . '<br />';
                    $out .= '<br />' . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                    $out .= '<br />' . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
                    break;
                default:
                    $contentType = $this->CType_labels[$row['CType']];
                    if (isset($contentType)) {
                        $out .= '<strong>' . htmlspecialchars($contentType) . '</strong><br />';
                        if ($row['bodytext']) {
                            $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                        }
                        if ($row['image']) {
                            $out .= $this->thumbCode($row, 'tt_content', 'image') . '<br />';
                        }
                    } else {
                        $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue'), $row['CType']);
                        $out .= GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($message), '', FlashMessage::WARNING)->render();
                    }
            }
        }
        // Wrap span-tags:
        $out = '
			<span class="exampleContent">' . $out . '</span>';
        // Add header:
        $out = $outHeader . $out;
        // Add RTE button:
        if ($isRTE) {
            $out .= $this->linkRTEbutton($row);
        }
        // Return values:
        if ($this->isDisabled('tt_content', $row)) {
            return $this->getDocumentTemplate()->dfw($out);
        } else {
            return $out;
        }
    }
コード例 #18
0
 /**
  * Get property array for html table
  *
  * @return array
  */
 protected function getPropertiesForTable() : array
 {
     $propertiesForTable = [];
     $extraFields = [];
     $lang = $this->getLanguageService();
     if (in_array($this->type, ['folder', 'file'], true)) {
         if ($this->type === 'file') {
             $extraFields['creation_date'] = htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.creationDate'));
             $extraFields['modification_date'] = htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.timestamp'));
         }
         $extraFields['storage'] = htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file.storage'));
         $extraFields['folder'] = htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:folder'));
     } else {
         $extraFields['crdate'] = htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.creationDate'));
         $extraFields['cruser_id'] = htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.creationUserId'));
         $extraFields['tstamp'] = htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.timestamp'));
         // 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 = '';
         $thisRow = [];
         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, ['creation_date', 'modification_date'], true)) {
             $rowValue = BackendUtility::datetime($this->row[$name]);
         } else {
             $rowValue = BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]);
         }
         $thisRow['value'] = $rowValue;
         $thisRow['fieldLabel'] = rtrim($fieldLabel, ':');
         // 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);
                 $creatorRecord['icon'] = $avatar->render($creatorRecord);
                 $thisRow['creatorRecord'] = $creatorRecord;
                 $thisRow['value'] = '';
             }
         }
         $propertiesForTable['extraFields'][] = $thisRow;
     }
     // Traverse the list of fields to display for the record:
     $fieldList = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], true);
     foreach ($fieldList as $name) {
         $thisRow = [];
         $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;
         }
         // format file size as bytes/kilobytes/megabytes
         if ($this->type === 'file' && $name === 'size') {
             $this->row[$name] = GeneralUtility::formatSize($this->row[$name], htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:byteSizeUnits')));
         }
         $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $this->getBackendUser()->check('non_exclude_fields', $this->table . ':' . $name));
         if ($isExcluded) {
             continue;
         }
         $thisRow['fieldValue'] = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, false, $uid);
         $thisRow['fieldLabel'] = htmlspecialchars($lang->sL(BackendUtility::getItemLabel($this->table, $name)));
         $propertiesForTable['fields'][] = $thisRow;
     }
     return $propertiesForTable;
 }
コード例 #19
0
 /**
  * Renders HTML table-rows with the comparison information of an sys_history entry record
  *
  * @param array $entry sys_history entry record.
  * @param string $table The table name
  * @param int $rollbackUid If set to UID of record, display rollback links
  * @return string|NULL HTML table
  * @access private
  */
 public function renderDiff($entry, $table, $rollbackUid = 0)
 {
     $lines = array();
     if (is_array($entry['newRecord'])) {
         /* @var DiffUtility $diffUtility */
         $diffUtility = GeneralUtility::makeInstance(DiffUtility::class);
         $fieldsToDisplay = array_keys($entry['newRecord']);
         $languageService = $this->getLanguageService();
         foreach ($fieldsToDisplay as $fN) {
             if (is_array($GLOBALS['TCA'][$table]['columns'][$fN]) && $GLOBALS['TCA'][$table]['columns'][$fN]['config']['type'] !== 'passthrough') {
                 // Create diff-result:
                 $diffres = $diffUtility->makeDiffDisplay(BackendUtility::getProcessedValue($table, $fN, $entry['oldRecord'][$fN], 0, true), BackendUtility::getProcessedValue($table, $fN, $entry['newRecord'][$fN], 0, true));
                 $lines[] = array('title' => ($rollbackUid ? $this->createRollbackLink($table . ':' . $rollbackUid . ':' . $fN, $languageService->getLL('revertField', true), 2) : '') . '
                       ' . $languageService->sL(BackendUtility::getItemLabel($table, $fN), true), 'result' => str_replace('\\n', PHP_EOL, str_replace('\\r\\n', '\\n', $diffres)));
             }
         }
     }
     if ($lines) {
         return $lines;
     }
     // error fallback
     return null;
 }
コード例 #20
0
 /**
  * Rendering the header row for a table
  *
  * @param string $table Table name
  * @param array $currentIdList Array of the currectly displayed uids of the table
  *
  * @return string Header table row
  */
 public function renderListHeader($table, array $currentIdList)
 {
     $language = $this->getLanguageService();
     // Init:
     $theData = array();
     // Traverse the fields:
     foreach ($this->fieldArray as $fCol) {
         $theData[$fCol] = '';
         if ($this->table && is_array($currentIdList)) {
             // If the numeric clipboard pads are selected, show duplicate sorting link:
             if ($this->clipNumPane()) {
                 $theData[$fCol] .= '<a href="' . htmlspecialchars($this->listURL('', -1) . '&duplicateField=' . $fCol) . '">' . IconUtility::getSpriteIcon('actions-document-duplicates-select', array('title' => $language->getLL('clip_duplicates', 1))) . '</a>';
             }
         }
         /**
          * Modified from this point to use relation table queries
          */
         $tables = array('fe_users');
         $temporaryData = '';
         foreach ($tables as $workTable) {
             if ($GLOBALS['TCA'][$workTable]['columns'][$fCol]) {
                 $temporaryData = $this->addSortLink($language->sL(BackendUtility::getItemLabel($workTable, $fCol, '<i>[|]</i>')), $fCol, $table);
             }
         }
         if ($temporaryData) {
             // Only if we have a entry in locallang
             $theData[$fCol] = $temporaryData;
         } else {
             // default handling
             $theData[$fCol] .= $this->addSortLink($language->sL(BackendUtility::getItemLabel($table, $fCol, '<i>[|]</i>')), $fCol, $table);
         }
     }
     // Create and return header table row:
     return $this->addelement(1, '', $theData, ' class="c-headLine"', '');
 }
コード例 #21
0
 /**
  * Fetch futher information to current selected worspace record.
  *
  * @param object $parameter
  * @return array $data
  */
 public function getRowDetails($parameter)
 {
     $diffReturnArray = array();
     $liveReturnArray = array();
     /** @var $t3lib_diff \TYPO3\CMS\Core\Utility\DiffUtility */
     $t3lib_diff = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\DiffUtility');
     /** @var $parseObj \TYPO3\CMS\Core\Html\RteHtmlParser */
     $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\RteHtmlParser');
     $liveRecord = BackendUtility::getRecord($parameter->table, $parameter->t3ver_oid);
     $versionRecord = BackendUtility::getRecord($parameter->table, $parameter->uid);
     $icon_Live = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($parameter->table, $liveRecord);
     $icon_Workspace = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($parameter->table, $versionRecord);
     $stagePosition = $this->getStagesService()->getPositionOfCurrentStage($parameter->stage);
     $fieldsOfRecords = array_keys($liveRecord);
     if ($GLOBALS['TCA'][$parameter->table]) {
         if ($GLOBALS['TCA'][$parameter->table]['interface']['showRecordFieldList']) {
             $fieldsOfRecords = $GLOBALS['TCA'][$parameter->table]['interface']['showRecordFieldList'];
             $fieldsOfRecords = GeneralUtility::trimExplode(',', $fieldsOfRecords, TRUE);
         }
     }
     foreach ($fieldsOfRecords as $fieldName) {
         // check for exclude fields
         if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['exclude'] == 0 || GeneralUtility::inList($GLOBALS['BE_USER']->groupData['non_exclude_fields'], $parameter->table . ':' . $fieldName)) {
             // call diff class only if there is a difference
             if ((string) $liveRecord[$fieldName] !== (string) $versionRecord[$fieldName]) {
                 // Select the human readable values before diff
                 $liveRecord[$fieldName] = BackendUtility::getProcessedValue($parameter->table, $fieldName, $liveRecord[$fieldName], 0, 1, FALSE, $liveRecord['uid']);
                 $versionRecord[$fieldName] = BackendUtility::getProcessedValue($parameter->table, $fieldName, $versionRecord[$fieldName], 0, 1, FALSE, $versionRecord['uid']);
                 // Get the field's label. If not available, use the field name
                 $fieldTitle = $GLOBALS['LANG']->sL(BackendUtility::getItemLabel($parameter->table, $fieldName));
                 if (empty($fieldTitle)) {
                     $fieldTitle = $fieldName;
                 }
                 if ($GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['config']['type'] == 'group' && $GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['config']['internal_type'] == 'file') {
                     $versionThumb = BackendUtility::thumbCode($versionRecord, $parameter->table, $fieldName, '');
                     $liveThumb = BackendUtility::thumbCode($liveRecord, $parameter->table, $fieldName, '');
                     $diffReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $versionThumb);
                     $liveReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $liveThumb);
                 } else {
                     $diffReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $t3lib_diff->makeDiffDisplay($liveRecord[$fieldName], $versionRecord[$fieldName]));
                     $liveReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $parseObj->TS_images_rte($liveRecord[$fieldName]));
                 }
             }
         }
     }
     // Hook for modifying the difference and live arrays
     // (this may be used by custom or dynamically-defined fields)
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray'] as $className) {
             $hookObject =& GeneralUtility::getUserObj($className);
             $hookObject->modifyDifferenceArray($parameter, $diffReturnArray, $liveReturnArray, $t3lib_diff);
         }
     }
     $commentsForRecord = $this->getCommentsForRecord($parameter->uid, $parameter->table);
     return array('total' => 1, 'data' => array(array('diff' => $diffReturnArray, 'live_record' => $liveReturnArray, 'path_Live' => $parameter->path_Live, 'label_Stage' => $parameter->label_Stage, 'stage_position' => $stagePosition['position'], 'stage_count' => $stagePosition['count'], 'comments' => $commentsForRecord, 'icon_Live' => $icon_Live, 'icon_Workspace' => $icon_Workspace)));
 }
コード例 #22
0
    /**
     * Creates an info-box for the current page (identified by input record).
     *
     * @param array $rec Page record
     * @param boolean $edit If set, there will be shown an edit icon, linking to editing of the page properties.
     * @return string HTML for the box.
     * @deprecated and unused since 6.0, will be removed two versions later
     * @todo Define visibility
     */
    public function getPageInfoBox($rec, $edit = 0)
    {
        \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
        // If editing of the page properties is allowed:
        if ($edit) {
            $params = '&edit[pages][' . $rec['uid'] . ']=edit';
            $editIcon = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
        } else {
            $editIcon = $this->noEditIcon('noEditPage');
        }
        // Setting page icon, link, title:
        $outPutContent = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec, array('title' => \TYPO3\CMS\Backend\Utility\BackendUtility::titleAttribForPages($rec))) . $editIcon . '&nbsp;' . htmlspecialchars($rec['title']);
        // Init array where infomation is accumulated as label/value pairs.
        $lines = array();
        // Owner user/group:
        if ($this->pI_showUser) {
            // User:
            $users = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
            $groupArray = explode(',', $GLOBALS['BE_USER']->user['usergroup_cached_list']);
            $users = \TYPO3\CMS\Backend\Utility\BackendUtility::blindUserNames($users, $groupArray);
            $lines[] = array($GLOBALS['LANG']->getLL('pI_crUser') . ':', htmlspecialchars($users[$rec['cruser_id']]['username']) . ' (' . $users[$rec['cruser_id']]['realName'] . ')');
        }
        // Created:
        $lines[] = array($GLOBALS['LANG']->getLL('pI_crDate') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['crdate']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['crdate'], $this->agePrefixes) . ')');
        // Last change:
        $lines[] = array($GLOBALS['LANG']->getLL('pI_lastChange') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['tstamp']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['tstamp'], $this->agePrefixes) . ')');
        // Last change of content:
        if ($rec['SYS_LASTCHANGED']) {
            $lines[] = array($GLOBALS['LANG']->getLL('pI_lastChangeContent') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['SYS_LASTCHANGED']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['SYS_LASTCHANGED'], $this->agePrefixes) . ')');
        }
        // Spacer:
        $lines[] = '';
        // Display contents of certain page fields, if any value:
        $dfields = explode(',', 'alias,target,hidden,starttime,endtime,fe_group,no_cache,cache_timeout,newUntil,lastUpdated,subtitle,keywords,description,abstract,author,author_email');
        foreach ($dfields as $fV) {
            if ($rec[$fV]) {
                $lines[] = array($GLOBALS['LANG']->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel('pages', $fV)), \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue('pages', $fV, $rec[$fV]));
            }
        }
        // Finally, wrap the elements in the $lines array in table cells/rows
        foreach ($lines as $fV) {
            if (is_array($fV)) {
                if (!$fV[2]) {
                    $fV[1] = htmlspecialchars($fV[1]);
                }
                $out .= '
				<tr>
					<td class="bgColor4" nowrap="nowrap"><strong>' . htmlspecialchars($fV[0]) . '&nbsp;&nbsp;</strong></td>
					<td class="bgColor4">' . $fV[1] . '</td>
				</tr>';
            } else {
                $out .= '
				<tr>
					<td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
				</tr>';
            }
        }
        // Wrap table tags around...
        $outPutContent .= '



			<!--
				Page info box:
			-->
			<table border="0" cellpadding="0" cellspacing="1" id="typo3-page-info">
				' . $out . '
			</table>';
        // ... and return it.
        return $outPutContent;
    }
コード例 #23
0
ファイル: RecordHistory.php プロジェクト: Mr-Robota/TYPO3.CMS
    /**
     * Renders HTML table-rows with the comparison information of an sys_history entry record
     *
     * @param array $entry sys_history entry record.
     * @param string $table The table name
     * @param integer $rollbackUid If set to UID of record, display rollback links
     * @return string HTML table
     * @access private
     * @todo Define visibility
     */
    public function renderDiff($entry, $table, $rollbackUid = 0)
    {
        $lines = array();
        if (is_array($entry['newRecord'])) {
            $t3lib_diff_Obj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\DiffUtility');
            $fieldsToDisplay = array_keys($entry['newRecord']);
            foreach ($fieldsToDisplay as $fN) {
                if (is_array($GLOBALS['TCA'][$table]['columns'][$fN]) && $GLOBALS['TCA'][$table]['columns'][$fN]['config']['type'] != 'passthrough') {
                    // Create diff-result:
                    $diffres = $t3lib_diff_Obj->makeDiffDisplay(BackendUtility::getProcessedValue($table, $fN, $entry['oldRecord'][$fN], 0, 1), BackendUtility::getProcessedValue($table, $fN, $entry['newRecord'][$fN], 0, 1));
                    $lines[] = '
						<tr class="bgColor4">
						' . ($rollbackUid ? '<td style="width:33px">' . $this->createRollbackLink($table . ':' . $rollbackUid . ':' . $fN, $GLOBALS['LANG']->getLL('revertField', 1), 2) . '</td>' : '') . '
							<td style="width:90px"><em>' . $GLOBALS['LANG']->sl(BackendUtility::getItemLabel($table, $fN), 1) . '</em></td>
							<td style="width:300px">' . nl2br($diffres) . '</td>
						</tr>';
                }
            }
        }
        if ($lines) {
            $content = '<table border="0" cellpadding="2" cellspacing="2" id="typo3-history-item">
					' . implode('', $lines) . '
				</table>';
            return $content;
        }
        // error fallback
        return NULL;
    }
コード例 #24
0
ファイル: RecipientList.php プロジェクト: kartolo/direct_mail
    /**
     * Shows the existing recipient lists and shows link to create a new one or import a list
     *
     * @return string List of existing recipient list, link to create a new list and link to import
     */
    public function showExistingRecipientLists()
    {
        $out = '<thead>
					<th colspan="2">&nbsp;</th>
					<th>' . $this->getLanguageService()->sL(BackendUtility::getItemLabel('sys_dmail_group', 'title')) . '</th>
					<th>' . $this->getLanguageService()->sL(BackendUtility::getItemLabel('sys_dmail_group', 'type')) . '</th>
					<th>' . $this->getLanguageService()->sL(BackendUtility::getItemLabel('sys_dmail_group', 'description')) . '</th>
					<th>' . $this->getLanguageService()->getLL('recip_group_amount') . '</th>
				</thead>';
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,title,description,type', 'sys_dmail_group', 'pid = ' . intval($this->id) . BackendUtility::deleteClause('sys_dmail_group'), '', $GLOBALS['TYPO3_DB']->stripOrderBy($GLOBALS['TCA']['sys_dmail_group']['ctrl']['default_sortby']));
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
            $result = $this->cmd_compileMailGroup(intval($row['uid']));
            $count = 0;
            $idLists = $result['queryInfo']['id_lists'];
            if (is_array($idLists['tt_address'])) {
                $count += count($idLists['tt_address']);
            }
            if (is_array($idLists['fe_users'])) {
                $count += count($idLists['fe_users']);
            }
            if (is_array($idLists['PLAINLIST'])) {
                $count += count($idLists['PLAINLIST']);
            }
            if (is_array($idLists[$this->userTable])) {
                $count += count($idLists[$this->userTable]);
            }
            $out .= '<tr class="db_list_normal">
					<td nowrap="nowrap">' . $this->iconFactory->getIconForRecord('sys_dmail_group', $row, Icon::SIZE_SMALL)->render() . '</td>
					<td>' . $this->editLink('sys_dmail_group', $row['uid']) . '</td>
					<td nowrap="nowrap">' . $this->linkRecip_record('<strong>' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title'], 30)) . '</strong>&nbsp;&nbsp;', $row['uid']) . '</td>
					<td nowrap="nowrap">' . htmlspecialchars(BackendUtility::getProcessedValue('sys_dmail_group', 'type', $row['type'])) . '&nbsp;&nbsp;</td>
					<td>' . BackendUtility::getProcessedValue('sys_dmail_group', 'description', htmlspecialchars($row['description'])) . '&nbsp;&nbsp;</td>
					<td>' . $count . '</td>
				</tr>';
        }
        $out = ' <table class="table table-striped table-hover">' . $out . '</table>';
        $theOutput = $this->doc->section(BackendUtility::cshItem($this->cshTable, 'select_mailgroup', $GLOBALS['BACK_PATH']) . $this->getLanguageService()->getLL('recip_select_mailgroup'), $out, 1, 1, 0, true);
        // New:
        $out = '<a href="#" class="t3-link" onClick="' . BackendUtility::editOnClick('&edit[sys_dmail_group][' . $this->id . ']=new', $GLOBALS['BACK_PATH'], '') . '">' . $this->iconFactory->getIconForRecord('sys_dmail_group', array(), Icon::SIZE_SMALL) . $this->getLanguageService()->getLL('recip_create_mailgroup_msg') . '</a>';
        $theOutput .= '<div style="padding-top: 20px;"></div>';
        $theOutput .= $this->doc->section(BackendUtility::cshItem($this->cshTable, 'create_mailgroup', $GLOBALS['BACK_PATH']) . $this->getLanguageService()->getLL('recip_create_mailgroup'), $out, 1, 0, false, true, false, true);
        // Import
        $out = '<a class="t3-link" href="' . BackendUtility::getModuleUrl('DirectMailNavFrame_RecipientList') . '&id=' . $this->id . '&CMD=displayImport">' . $this->getLanguageService()->getLL('recip_import_mailgroup_msg') . '</a>';
        $theOutput .= '<div style="padding-top: 20px;"></div>';
        $theOutput .= $this->doc->section($this->getLanguageService()->getLL('mailgroup_import'), $out, 1, 1, 0, true);
        return $theOutput;
    }
コード例 #25
0
    /**
     * Renders file properties as html table
     *
     * @param array $fieldList
     * @return string
     */
    protected function renderFileInformationAsTable($fieldList)
    {
        $tableRows = array();
        foreach ($fieldList as $name) {
            if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) {
                continue;
            }
            $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $this->getBackendUser()->check('non_exclude_fields', $this->table . ':' . $name));
            if ($isExcluded) {
                continue;
            }
            $uid = $this->row['uid'];
            $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, false, $uid);
            $itemLabel = $this->getLanguageService()->sL(BackendUtility::getItemLabel($this->table, $name), true);
            $tableRows[] = '
				<tr>
					<th>' . $itemLabel . '</th>
					<td>' . htmlspecialchars($itemValue) . '</td>
				</tr>';
        }
        if (!$tableRows) {
            return '';
        }
        return '
			<div class="table-fit table-fit-wrap">
				<table class="table table-striped table-hover">
					' . implode('', $tableRows) . '
				</table>
			</div>';
    }
コード例 #26
0
    /**
     * Renders file properties as html table
     *
     * @param array $fieldList
     * @return string
     */
    protected function renderFileInformationAsTable($fieldList)
    {
        $tableRows = array();
        foreach ($fieldList as $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 = 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>';
        }
        if (!$tableRows) {
            return '';
        }
        return '<table id="typo3-showitem" class="t3-table-info">' . implode('', $tableRows) . '</table>';
    }
コード例 #27
0
    /**
     * Draws the preview content for a content element
     *
     * @param array $row Content element
     * @return string HTML
     * @throws \UnexpectedValueException
     */
    public function tt_content_drawItem($row)
    {
        $out = '';
        $outHeader = '';
        // Make header:
        if ($row['header']) {
            $infoArr = array();
            $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
            $hiddenHeaderNote = '';
            // If header layout is set to 'hidden', display an accordant note:
            if ($row['header_layout'] == 100) {
                $hiddenHeaderNote = ' <em>[' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.hidden', true) . ']</em>';
            }
            $outHeader = $row['date'] ? htmlspecialchars($this->itemLabels['date'] . ' ' . BackendUtility::date($row['date'])) . '<br />' : '';
            $outHeader .= '<strong>' . $this->linkEditContent($this->renderText($row['header']), $row) . $hiddenHeaderNote . '</strong><br />';
        }
        // Make content:
        $infoArr = array();
        $drawItem = true;
        // Hook: Render an own preview of a record
        $drawItemHooks =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'];
        if (is_array($drawItemHooks)) {
            foreach ($drawItemHooks as $hookClass) {
                $hookObject = GeneralUtility::getUserObj($hookClass);
                if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface) {
                    throw new \UnexpectedValueException('$hookObject must implement interface ' . \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface::class, 1218547409);
                }
                $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
            }
        }
        // If the previous hook did not render something,
        // then check if a Fluid-based preview template was defined for this CType
        // and render it via Fluid. Possible option:
        // mod.web_layout.tt_content.preview.media = EXT:site_mysite/Resources/Private/Templates/Preview/Media.html
        if ($drawItem) {
            $tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod.web_layout.tt_content.preview');
            if (!empty($tsConfig['properties'][$row['CType']])) {
                $fluidTemplateFile = $tsConfig['properties'][$row['CType']];
                $fluidTemplateFile = GeneralUtility::getFileAbsFileName($fluidTemplateFile);
                if ($fluidTemplateFile) {
                    try {
                        /** @var StandaloneView $view */
                        $view = GeneralUtility::makeInstance(StandaloneView::class);
                        $view->setTemplatePathAndFilename($fluidTemplateFile);
                        $view->assignMultiple($row);
                        if (!empty($row['pi_flexform'])) {
                            /** @var FlexFormService $flexFormService */
                            $flexFormService = GeneralUtility::makeInstance(FlexFormService::class);
                            $view->assign('pi_flexform_transformed', $flexFormService->convertFlexFormContentToArray($row['pi_flexform']));
                        }
                        $out = $view->render();
                        $drawItem = false;
                    } catch (\Exception $e) {
                        // Catch any exception to avoid breaking the view
                    }
                }
            }
        }
        // Draw preview of the item depending on its CType (if not disabled by previous hook):
        if ($drawItem) {
            switch ($row['CType']) {
                case 'header':
                    if ($row['subheader']) {
                        $out .= $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
                    }
                    break;
                case 'bullets':
                case 'table':
                    if ($row['bodytext']) {
                        $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                    }
                    break;
                case 'uploads':
                    if ($row['media']) {
                        $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'media'), $row) . '<br />';
                    }
                    break;
                case 'menu':
                    $contentType = $this->CType_labels[$row['CType']];
                    $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
                    // Add Menu Type
                    $menuTypeLabel = $this->getLanguageService()->sL(BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'menu_type', $row['menu_type']));
                    $menuTypeLabel = $menuTypeLabel ?: 'invalid menu type';
                    $out .= $this->linkEditContent($menuTypeLabel, $row);
                    if ($row['menu_type'] !== '2' && ($row['pages'] || $row['selected_categories'])) {
                        // Show pages if menu type is not "Sitemap"
                        $out .= ':' . $this->linkEditContent($this->generateListForCTypeMenu($row), $row) . '<br />';
                    }
                    break;
                case 'shortcut':
                    if (!empty($row['records'])) {
                        $shortcutContent = array();
                        $recordList = explode(',', $row['records']);
                        foreach ($recordList as $recordIdentifier) {
                            $split = BackendUtility::splitTable_Uid($recordIdentifier);
                            $tableName = empty($split[0]) ? 'tt_content' : $split[0];
                            $shortcutRecord = BackendUtility::getRecord($tableName, $split[1]);
                            if (is_array($shortcutRecord)) {
                                $icon = $this->iconFactory->getIconForRecord($tableName, $shortcutRecord, Icon::SIZE_SMALL)->render();
                                $icon = BackendUtility::wrapClickMenuOnIcon($icon, $tableName, $shortcutRecord['uid'], 1, '', '+copy,info,edit,view');
                                $shortcutContent[] = $icon . htmlspecialchars(BackendUtility::getRecordTitle($tableName, $shortcutRecord));
                            }
                        }
                        $out .= implode('<br />', $shortcutContent) . '<br />';
                    }
                    break;
                case 'list':
                    $hookArr = array();
                    $hookOut = '';
                    if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']])) {
                        $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']];
                    } elseif (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'])) {
                        $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'];
                    }
                    if (!empty($hookArr)) {
                        $_params = array('pObj' => &$this, 'row' => $row, 'infoArr' => $infoArr);
                        foreach ($hookArr as $_funcRef) {
                            $hookOut .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
                        }
                    }
                    if ((string) $hookOut !== '') {
                        $out .= $hookOut;
                    } elseif (!empty($row['list_type'])) {
                        $label = BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'list_type', $row['list_type']);
                        if (!empty($label)) {
                            $out .= $this->linkEditContent('<strong>' . $this->getLanguageService()->sL($label, true) . '</strong>', $row) . '<br />';
                        } else {
                            $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue'), $row['list_type']);
                            $out .= GeneralUtility::makeInstance(FlashMessage::class, htmlspecialchars($message), '', FlashMessage::WARNING)->render();
                        }
                    } elseif (!empty($row['select_key'])) {
                        $out .= $this->getLanguageService()->sL(BackendUtility::getItemLabel('tt_content', 'select_key'), true) . ' ' . $row['select_key'] . '<br />';
                    } else {
                        $out .= '<strong>' . $this->getLanguageService()->getLL('noPluginSelected') . '</strong>';
                    }
                    $out .= $this->getLanguageService()->sL(BackendUtility::getLabelFromItemlist('tt_content', 'pages', $row['pages']), true) . '<br />';
                    break;
                default:
                    $contentType = $this->CType_labels[$row['CType']];
                    if (isset($contentType)) {
                        $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
                        if ($row['bodytext']) {
                            $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                        }
                        if ($row['image']) {
                            $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'image'), $row) . '<br />';
                        }
                    } else {
                        $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue'), $row['CType']);
                        $out .= GeneralUtility::makeInstance(FlashMessage::class, htmlspecialchars($message), '', FlashMessage::WARNING)->render();
                    }
            }
        }
        // Wrap span-tags:
        $out = '
			<span class="exampleContent">' . $out . '</span>';
        // Add header:
        $out = $outHeader . $out;
        // Return values:
        if ($this->isDisabled('tt_content', $row)) {
            return '<span class="text-muted">' . $out . '</span>';
        } else {
            return $out;
        }
    }
コード例 #28
0
 /**
  * Generates a list of all saved Suppliers
  *
  * @return string
  */
 protected function getSupplierListing()
 {
     $fields = explode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['extConf']['coSuppliers']);
     $headerRow = '<tr><td></td>';
     foreach ($fields as $field) {
         $headerRow .= '<td class="bgColor6"><strong>' . $this->getLanguageService()->sL(BackendUtility::getItemLabel('tx_commerce_supplier', htmlspecialchars($field))) . '</strong></td>';
     }
     $headerRow .= '</tr>';
     $result = $this->fetchDataByTable('tx_commerce_supplier');
     $supplierRows = $this->renderSupplierRows($result, $fields);
     $this->tableForNewLink = 'supplier';
     return '<table>' . $headerRow . $supplierRows . '</table>';
 }