/** * Wrapping the title in a link, if applicable. * * @param string $title Title, ready for output. * @param array $v The record * @param bool $ext_pArrPages If set, pages clicked will return immediately, otherwise reload page. * @return string Wrapping title string. */ public function wrapTitle($title, $v, $ext_pArrPages) { if ($ext_pArrPages) { $ficon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('pages', $v); $onClick = 'return insertElement(\'pages\', \'' . $v['uid'] . '\', \'db\', ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($v['title']) . ', \'\', \'\', \'' . $ficon . '\',\'\',1);'; } else { $onClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['uid']) . ');'; } return '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $title . '</a>'; }
/** * Main * * @return string * @todo Define visibility */ public function main() { global $BACK_PATH; global $tmpl, $tplRow, $theConstants; $POST = GeneralUtility::_POST(); // Checking for more than one template an if, set a menu... $manyTemplatesMenu = $this->pObj->templateMenu(); $template_uid = 0; if ($manyTemplatesMenu) { $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage']; } // BUGBUG: Should we check if the user may at all read and write template-records??? $bType = $this->pObj->MOD_SETTINGS['ts_browser_type']; $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); // initialize if ($existTemplate) { $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('currentTemplate'), ' <img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('sys_template', $tplRow)) . ' align="top" /> <strong>' . $this->pObj->linkWrapTemplateTitle($tplRow['title'], $bType == 'setup' ? 'config' : 'constants') . '</strong>' . htmlspecialchars(trim($tplRow['sitetitle']) ? ' (' . $tplRow['sitetitle'] . ')' : '')); if ($manyTemplatesMenu) { $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu); } $theOutput .= $this->pObj->doc->spacer(10); if ($POST['add_property'] || $POST['update_value'] || $POST['clear_object']) { // add property $line = ''; if (is_array($POST['data'])) { $name = key($POST['data']); if ($POST['data'][$name]['name'] !== '') { // Workaround for this special case: User adds a key and submits by pressing the return key. The form however will use "add_property" which is the name of the first submit button in this form. unset($POST['update_value']); $POST['add_property'] = 'Add'; } if ($POST['add_property']) { $property = trim($POST['data'][$name]['name']); if (preg_replace('/[^a-zA-Z0-9_\\.]*/', '', $property) != $property) { $badPropertyMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('noSpaces') . '<br />' . $GLOBALS['LANG']->getLL('nothingUpdated'), $GLOBALS['LANG']->getLL('badProperty'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); $this->addFlashMessage($badPropertyMessage); } else { $pline = $name . '.' . $property . ' = ' . trim($POST['data'][$name]['propertyValue']); $propertyAddedMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('propertyAdded')); $this->addFlashMessage($propertyAddedMessage); $line .= LF . $pline; } } elseif ($POST['update_value']) { $pline = $name . ' = ' . trim($POST['data'][$name]['value']); $updatedMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('valueUpdated')); $this->addFlashMessage($updatedMessage); $line .= LF . $pline; } elseif ($POST['clear_object']) { if ($POST['data'][$name]['clearValue']) { $pline = $name . ' >'; $objectClearedMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('objectCleared')); $this->addFlashMessage($objectClearedMessage); $line .= LF . $pline; } } } if ($line) { $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']; // Set the data to be saved $recData = array(); $field = $bType == 'setup' ? 'config' : 'constants'; $recData['sys_template'][$saveId][$field] = $tplRow[$field] . $line; // Create new tce-object $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); $tce->stripslashes_values = 0; // Initialize $tce->start($recData, array()); // Saved the stuff $tce->process_datamap(); // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php) $tce->clear_cacheCmd('all'); // re-read the template ... $this->initialize_editor($this->pObj->id, $template_uid); } } } $tsbr = GeneralUtility::_GET('tsbr'); $update = 0; if (is_array($tsbr)) { // If any plus-signs were clicked, it's registred. $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType] = $tmpl->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType]); $update = 1; } if ($POST['Submit']) { // If any POST-vars are send, update the condition array $this->pObj->MOD_SETTINGS['tsbrowser_conditions'] = $POST['conditions']; $update = 1; } if ($update) { $GLOBALS['BE_USER']->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS); } $tmpl->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions']; $tmpl->matchAlternative[] = 'dummydummydummydummydummydummydummydummydummydummydummy'; // This is just here to make sure that at least one element is in the array so that the tsparser actually uses this array to match. $tmpl->constantMode = $this->pObj->MOD_SETTINGS['ts_browser_const']; if ($this->pObj->sObj && $tmpl->constantMode) { $tmpl->constantMode = 'untouched'; } $tmpl->regexMode = $this->pObj->MOD_SETTINGS['ts_browser_regexsearch']; $tmpl->fixedLgd = $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']; $tmpl->linkObjects = TRUE; $tmpl->ext_regLinenumbers = TRUE; $tmpl->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments']; $tmpl->bType = $bType; $tmpl->resourceCheck = 1; $tmpl->removeFromGetFilePath = PATH_site; if ($this->pObj->MOD_SETTINGS['ts_browser_type'] == 'const') { $tmpl->ext_constants_BRP = (int) GeneralUtility::_GP('breakPointLN'); } else { $tmpl->ext_config_BRP = (int) GeneralUtility::_GP('breakPointLN'); } $tmpl->generateConfig(); if ($bType == 'setup') { $theSetup = $tmpl->setup; } else { $theSetup = $tmpl->setup_constants; } // EDIT A VALUE: if ($this->pObj->sObj) { list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->sObj ? $this->pObj->sObj : ''); if ($existTemplate) { // Value $out = ''; $out .= htmlspecialchars($this->pObj->sObj) . ' =<br />'; $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />'; $out .= '<input type="Submit" name="update_value" value="' . $GLOBALS['LANG']->getLL('updateButton') . '" />'; $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editProperty'), $out, 0, 0); // Property $out = ''; $out = '<nobr>' . htmlspecialchars($this->pObj->sObj) . '.'; $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][name]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' /> = </nobr><br />'; $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />'; $out .= '<input type="Submit" name="add_property" value="' . $GLOBALS['LANG']->getLL('addButton') . '" />'; $theOutput .= $this->pObj->doc->spacer(20); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('addProperty'), $out, 0, 0); // clear $out = ''; $out = htmlspecialchars($this->pObj->sObj) . ' <strong>' . $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('clear'), 'toUpper') . '</strong> '; $out .= '<input type="Checkbox" name="data[' . htmlspecialchars($this->pObj->sObj) . '][clearValue]" value="1" />'; $out .= '<input type="Submit" name="clear_object" value="' . $GLOBALS['LANG']->getLL('clearButton') . '" />'; $theOutput .= $this->pObj->doc->spacer(20); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('clearObject'), $out, 0, 0); $theOutput .= $this->pObj->doc->spacer(10); } else { $noTemplateMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('noCurrentTemplate'), $GLOBALS['LANG']->getLL('edit'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); $this->addFlashMessage($noTemplateMessage); $theOutput .= htmlspecialchars($this->pObj->sObj) . ' = <strong>' . htmlspecialchars($theSetupValue) . '</strong>'; $theOutput .= $this->pObj->doc->spacer(10); } // Links: $out = ''; $urlParameters = array('id' => $this->pObj->id); $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters); if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$this->pObj->sObj]) { if (count($theSetup)) { $out = '<a href="' . htmlspecialchars($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj)) . '">'; $out .= sprintf($GLOBALS['LANG']->getLL('addKey'), htmlspecialchars($this->pObj->sObj)); } } else { $out = '<a href="' . htmlspecialchars($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0') . '">'; $out .= sprintf($GLOBALS['LANG']->getLL('removeKey'), htmlspecialchars($this->pObj->sObj)); } if ($out) { $theOutput .= $this->pObj->doc->divider(5); $theOutput .= $this->pObj->doc->section('', $out); } // back $out = $GLOBALS['LANG']->getLL('back'); $out = '<a href="' . htmlspecialchars($aHref) . '"><strong>' . $out . '</strong></a>'; $theOutput .= $this->pObj->doc->divider(5); $theOutput .= $this->pObj->doc->section('', $out); } else { $tmpl->tsbrowser_depthKeys = $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType]; if (GeneralUtility::_POST('search') && GeneralUtility::_POST('search_field')) { // If any POST-vars are send, update the condition array $tmpl->tsbrowser_depthKeys = $tmpl->ext_getSearchKeys($theSetup, '', GeneralUtility::_POST('search_field'), array()); } $menu = '<div class="tsob-menu"><label>' . $GLOBALS['LANG']->getLL('browse') . '</label>'; $menu .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']); $menu .= '<label for="ts_browser_toplevel_' . $bType . '">' . $GLOBALS['LANG']->getLL('objectList') . '</label>'; $menu .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_toplevel_' . $bType . ']', $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType], $this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]); //search $menu .= '<label for="search_field">' . $GLOBALS['LANG']->getLL('search') . '</label>'; $menu .= '<input type="Text" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '/>'; $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:search') . '" />'; $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"'); $menu .= '<label for="checkTs_browser_regexsearch">' . $GLOBALS['LANG']->getLL('regExp') . '</label>'; $menu .= '</div>'; $theOutput .= $this->pObj->doc->section('', '<nobr>' . $menu . '</nobr>'); $theKey = $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType]; if (!$theKey || !str_replace('-', '', $theKey)) { $theKey = ''; } list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] ? $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] : ''); $tree = $tmpl->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']); $tree = $tmpl->substituteCMarkers($tree); $urlParameters = array('id' => $this->pObj->id); $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters); // Parser Errors: $pEkey = $bType == 'setup' ? 'config' : 'constants'; if (count($tmpl->parserErrors[$pEkey])) { $errMsg = array(); $templateAnalyzerInstalled = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tstemplate'); foreach ($tmpl->parserErrors[$pEkey] as $inf) { $errorLink = ''; if ($templateAnalyzerInstalled) { $errorLink = ' <a href="' . htmlspecialchars($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TemplateAnalyzerModuleFunctionController&template=all&SET[ts_analyzer_checkLinenum]=1#line-' . $inf[2]) . '">' . $GLOBALS['LANG']->getLL('errorShowDetails') . '</a>'; } $errMsg[] = $inf[1] . ': ' . $inf[0] . $errorLink; } $theOutput .= $this->pObj->doc->spacer(10); $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', implode($errMsg, '<br />'), $GLOBALS['LANG']->getLL('errorsWarnings'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); $theOutput .= $flashMessage->render(); } if (isset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$theKey])) { $remove = '<th><a href="' . htmlspecialchars($aHref . '&addKey[' . $theKey . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0') . '">' . $GLOBALS['LANG']->getLL('removeKey') . '</a></th>'; } else { $remove = ''; } $label = $theKey ? $theKey : ($bType == 'setup' ? $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('setupRoot'), 'toUpper') : $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('constantRoot'), 'toUpper')); $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->sectionEnd(); $theOutput .= '<table class="t3-table" id="typo3-objectBrowser"> <thead> <tr> <th>' . $label . '</th>' . $remove . '</tr> </thead> <tbody> <tr> <td>' . $tree . '</td>' . ($remove ? '<td></td>' : '') . ' </tr> </tbody> </table>'; // second row options $menu = '<div class="tsob-menu-row2">'; $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"'); $menu .= '<label for="checkTs_browser_showComments">' . $GLOBALS['LANG']->getLL('displayComments') . '</label>'; $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"'); $menu .= '<label for="checkTs_browser_alphaSort">' . $GLOBALS['LANG']->getLL('sortAlphabetically') . '</label>'; $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'], '', '', 'id="checkTs_browser_fixedLgd"'); $menu .= '<label for="checkTs_browser_fixedLgd">' . $GLOBALS['LANG']->getLL('cropLines') . '</label>'; if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) { $menu .= '<br /><br /><label>' . $GLOBALS['LANG']->getLL('displayConstants') . '</label>'; $menu .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_const]', $this->pObj->MOD_SETTINGS['ts_browser_const'], $this->pObj->MOD_MENU['ts_browser_const']); } $menu .= '</div>'; $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions'), '<nobr>' . $menu . '</nobr>', 0, 1); // Conditions: if (is_array($tmpl->sections)) { $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions'), '', 0, 1); $out = ''; foreach ($tmpl->sections as $key => $val) { $out .= '<div class="tsob-conditions"><input class="checkbox" type="checkbox" name="conditions[' . $key . ']" id="check' . $key . '" value="' . htmlspecialchars($val) . '"' . ($this->pObj->MOD_SETTINGS['tsbrowser_conditions'][$key] ? ' checked' : '') . ' />'; $out .= '<label for="check' . $key . '">' . $tmpl->substituteCMarkers(htmlspecialchars($val)) . '</label></div>'; } $theOutput .= '<div class="tsob-menu-row2">' . $out . '</div><input type="Submit" name="Submit" value="' . $GLOBALS['LANG']->getLL('setConditions') . '" />'; } // Ending section: $theOutput .= $this->pObj->doc->sectionEnd(); } return $theOutput; }
private function getDummyIconPath() { $icon = IconUtility::getIcon('tx_news_domain_model_tag'); return IconUtility::skinImg('', $icon, '', 1); }
/** * Returns an icon image tag, 18x16 pixels, based on input information. * This function is recommended to use in your backend modules. * Usage: 60 * * @param string The table name * @param array The table row ("enablefields" are at least needed for correct icon display and for pages records some more fields in addition!) * @param string The backpath to the main TYPO3 directory (relative path back to PATH_typo3) * @param string Additional attributes for the image tag * @param boolean If set, the icon will be grayed/shaded * @return string <img>-tag * @see getIcon() */ public function getIconImage($table, $row = array(), $backPath, $params = '', $shaded = FALSE) { $str = '<img' . $this->skinImg($backPath, \TYPO3\CMS\Backend\Utility\IconUtility::getIcon($table, $row, $shaded), 'width="18" height="16"') . (trim($params) ? ' ' . trim($params) : ''); if (!stristr($str, 'alt="')) { $str .= ' alt=""'; } $str .= ' />'; return $str; }
/** * Return the icon for a record - just a wrapper for two functions from t3lib_iconWorks * * @param array $row The record to get the icon for * @return string The path to the icon */ protected function getIcon($row) { $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon($this->mmForeignTable ? $this->mmForeignTable : $this->table, $row); return \TYPO3\CMS\Backend\Utility\IconUtility::skinImg('', $icon, '', 1); }
private function getDummyIconPath() { $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('tx_news_domain_model_tag'); return \TYPO3\CMS\Backend\Utility\IconUtility::skinImg('', $icon, '', 1); }
/** * Returns the title (based on $code) of a record (from table $table) with the proper link around (that is for "pages"-records a link to the level of that record...) * * @param string $table Table name * @param integer $uid UID (not used here) * @param string $code Title string * @param array $row Records array (from table name) * @return string * @todo Define visibility */ public function linkWrapItems($table, $uid, $code, $row) { if (!$code) { $code = '<i>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title', 1) . ']</i>'; } else { $code = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitlePrep($code, $this->fixedL); } $title = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row, FALSE, TRUE); $ficon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon($table, $row); $aOnClick = 'return insertElement(\'' . $table . '\', \'' . $row['uid'] . '\', \'db\', ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($title) . ', \'\', \'\', \'' . $ficon . '\');'; $ATag = '<a href="#" onclick="' . $aOnClick . '">'; $ATag_alt = substr($ATag, 0, -4) . ',\'\',1);">'; $ATag_e = '</a>'; return $ATag . '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', 1) . '" alt="" />' . $ATag_e . $ATag_alt . $code . $ATag_e; }
/** * For RTE: This displays all content elements on a page and lets you create a link to the element. * * @return string HTML output. Returns content only if the ->expandPage value is set (pointing to a page uid to show tt_content records from ...) */ protected function expandPageRecords() { $out = ''; if ($this->expandPage >= 0 && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->expandPage) && $GLOBALS['BE_USER']->isInWebMount($this->expandPage)) { $tables = '*'; if (isset($this->configuration['listTables'])) { $tables = $this->configuration['listTables']; } // Set array with table names to list: if (!strcmp(trim($tables), '*')) { $tablesArr = array_keys($GLOBALS['TCA']); } else { $tablesArr = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $tables, 1); } reset($tablesArr); // Headline for selecting records: $out .= $this->browseLinksObj->barheader($GLOBALS['LANG']->getLL('selectRecords') . ':'); // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables. $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']); $mainPageRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL('pages', $this->expandPage); $aTag = ''; $aTagEnd = ''; $aTag2 = ''; if (in_array('pages', $tablesArr)) { $ficon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('pages', $mainPageRec); $aTag = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] . "', 'db', " . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($mainPageRec['title']) . ", '', '', '" . $ficon . "', '',1);\">"; $aTag2 = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] . "', 'db', " . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($mainPageRec['title']) . ", '', '', '" . $ficon . "', '',0);\">"; $aTagEnd = '</a>'; } $picon = \TYPO3\CMS\Backend\Utility\IconUtility::getIconImage('pages', $mainPageRec, $GLOBALS['BACK_PATH'], ''); $pBicon = $aTag2 ? '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' alt="" />' : ''; $pText = htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($mainPageRec['title'], $titleLen)); $out .= $picon . $aTag2 . $pBicon . $aTagEnd . $aTag . $pText . $aTagEnd . '<br />'; // Initialize the record listing: $id = $this->expandPage; $pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000); $pagePermsClause = $GLOBALS['BE_USER']->getPagePermsClause(1); $pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($id, $pagePermsClause); // Generate the record list: // unfortunately we have to set weird dependencies. /** @var \AOE\Linkhandler\Record\ElementBrowserRecordList $dblist */ $dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Linkhandler\\Record\\ElementBrowserRecordList'); $dblist->setAddPassOnParameters($this->addPassOnParams); $dblist->browselistObj = $this->browseLinksObj; $dblist->backPath = $GLOBALS['BACK_PATH']; $dblist->thumbs = 0; $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo); $dblist->noControlPanels = 1; $dblist->clickMenuEnabled = 0; $dblist->tableList = implode(',', $tablesArr); if (array_key_exists('overwriteHandler', $this->configuration)) { $dblist->setOverwriteLinkHandler($this->configuration['overwriteHandler']); } $dblist->start($id, \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('table'), $pointer, \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('search_field'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('search_levels'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('showLimit')); $dblist->setDispFields(); $dblist->generateList(); $dblist->writeBottom(); // Add the HTML for the record list to output variable: $out .= $dblist->HTMLcode; $out .= $dblist->getSearchBox(); } return $out; }
/** * Gets the icon for the shortcut * * @param array $row * @param array $shortcut * @return string Shortcut icon as img tag */ protected function getShortcutIcon($row, $shortcut) { switch ($row['module_name']) { case 'xMOD_alt_doc.php': $table = $shortcut['table']; $recordid = $shortcut['recordid']; if ($shortcut['type'] == 'edit') { // Creating the list of fields to include in the SQL query: $selectFields = $this->fieldArray; $selectFields[] = 'uid'; $selectFields[] = 'pid'; if ($table == 'pages') { if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) { $selectFields[] = 'module'; $selectFields[] = 'extendToSubpages'; } $selectFields[] = 'doktype'; } if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) { $selectFields = array_merge($selectFields, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']); } if ($GLOBALS['TCA'][$table]['ctrl']['type']) { $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['type']; } if ($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) { $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column']; } if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { $selectFields[] = 't3ver_state'; } // Unique list! $selectFields = array_unique($selectFields); $permissionClause = $table == 'pages' && $this->perms_clause ? ' AND ' . $this->perms_clause : ''; $sqlQueryParts = array('SELECT' => implode(',', $selectFields), 'FROM' => $table, 'WHERE' => 'uid IN (' . $recordid . ') ' . $permissionClause . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table) . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause($table)); $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon($table, $row, $this->backPath); } elseif ($shortcut['type'] == 'new') { $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon($table, '', $this->backPath); } $icon = \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, $icon, '', 1); break; case 'xMOD_file_edit.php': $icon = 'gfx/edit_file.gif'; break; case 'xMOD_wizard_rte.php': $icon = 'gfx/edit_rtewiz.gif'; break; default: if ($GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'] . '_tab']) { $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'] . '_tab']; // Change icon of fileadmin references - otherwise it doesn't differ with Web->List $icon = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $icon); if (\TYPO3\CMS\Core\Utility\GeneralUtility::isAbsPath($icon)) { $icon = '../' . substr($icon, strlen(PATH_site)); } } else { $icon = 'gfx/dummy_module.gif'; } } return '<img src="' . $icon . '" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', TRUE) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', TRUE) . '" />'; }
/** * Return the icon for a record - just a wrapper for two functions from \TYPO3\CMS\Backend\Utility\IconUtility * * @param array $row The record to get the icon for * @return string The path to the icon */ protected function getIcon($row) { $icon = IconUtility::getIcon($this->mmForeignTable ? $this->mmForeignTable : $this->table, $row); return IconUtility::skinImg('', $icon, '', 1); }
/** * Produces a table with indexing information for each page. * * @return string HTML output * @todo Define visibility */ public function drawTableOfIndexedPages() { global $BACK_PATH; // Drawing tree: $tree = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView'); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $tree->init('AND ' . $perms_clause); $HTML = '<img src="' . $BACK_PATH . \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('pages', $this->pObj->pageinfo) . '" width="18" height="16" align="top" alt="" />'; $tree->tree[] = array('row' => $this->pObj->pageinfo, 'HTML' => $HTML); if ($this->pObj->MOD_SETTINGS['depth']) { $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); } // Traverse page tree: $code = ''; foreach ($tree->tree as $data) { $code .= $this->indexed_info($data['row'], $data['HTML'] . $this->showPageDetails(BackendUtility::getRecordTitlePrep($data['row']['title']), $data['row']['uid'])); } if ($code) { $code = '<br /><br /> <table border="0" cellspacing="1" cellpadding="2" class="c-list">' . $this->printPhashRowHeader() . $code . '</table>'; // Create section to output: $theOutput .= $this->pObj->doc->section('', $code, 0, 1); } else { $theOutput .= $this->pObj->doc->section('', '<br /><br />' . $this->pObj->doc->icons(1) . 'There were no indexed pages found in the tree.<br /><br />', 0, 1); } return $theOutput; }
/** * Rendering a single row for the list * * @param string $table Table name * @param array $row Current record * @param int $cc Counter, counting for each time an element * is rendered (used for alternating colors) * @param string $titleCol Table field (column) where header value is found * @param string $thumbsCol Table field (column) where (possible) * thumbnails can be found * @param int $indent Indent from left. * * @return string Table row for the element * @see getTable() */ public function renderListRow($table, array $row, $cc, $titleCol, $thumbsCol, $indent = 0) { $backendUser = $this->getBackendUser(); $iOut = ''; $extConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['extConf']; if (substr(TYPO3_version, 0, 3) >= '4.0') { // In offline workspace, look for alternative record: BackendUtility::workspaceOL($table, $row, $GLOBALS['BE_USER']->workspace); } $rowBackgroundColor = ''; if ($this->alternateBgColors) { $rowBackgroundColor = $cc % 2 ? '' : ' bgcolor="' . GeneralUtility::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4, 10, 10, 10) . '"'; } if ($backendUser->getModuleData('commerce_orders/index.php/userid', 'ses') == $row['uid']) { $rowBackgroundColor = ' bgcolor="' . GeneralUtility::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4, 30, 30, 30) . '"'; } // Overriding with versions background color if any: $rowBackgroundColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $rowBackgroundColor; // Initialization $alttext = BackendUtility::getRecordIconAltText($row, $table); // Incr. counter. $this->counter++; // The icon with link $iconImg = IconUtility::skinImg($this->backPath, IconUtility::getIcon($table, $row), 'title="' . htmlspecialchars($alttext) . '"' . ($indent ? ' style="margin-left: ' . $indent . 'px;"' : '')); $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg; // Preparing and getting the data-array $theData = array(); foreach ($this->fieldArray as $fCol) { if ($fCol == 'pid') { $theData[$fCol] = $row[$fCol]; } if ($fCol == 'username') { $theData[$fCol] = $row[$fCol]; } elseif ($fCol == 'crdate') { $theData[$fCol] = BackendUtility::date($row[$fCol]); } elseif ($fCol == '_PATH_') { $theData[$fCol] = $this->recPath($row['pid']); } elseif ($fCol == '_CONTROL_') { $theData[$fCol] = $this->makeControl($table, $row); } elseif ($fCol == '_CLIPBOARD_') { $theData[$fCol] = $this->makeClip($table, $row); } elseif ($fCol == '_LOCALIZATION_') { list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row); $theData[$fCol] = $lC1; $theData[$fCol . 'b'] = $lC2; } elseif ($fCol == '_LOCALIZATION_b') { // Do nothing, has been done above. $theData[$fCol] .= ''; } else { /** * Use own method, if typo3 4.0.0 is not installed */ if (substr(TYPO3_version, 0, 3) >= '4.0') { $theData[$fCol] = $this->linkUrlMail(htmlspecialchars(BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'])), $row[$fCol]); } else { $theData[$fCol] = $this->myLinkUrlMail(htmlspecialchars(BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'])), $row[$fCol]); } } } // Add row to CSV list: if ($this->csvOutput) { // Charset Conversion /** * Charset converter * * @var \TYPO3\CMS\Core\Charset\CharsetConverter $csObj */ $csObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter'); $csObj->initCharset($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']); if (!$extConf['BECSVCharset']) { $extConf['BECSVCharset'] = 'iso-8859-1'; } $csObj->initCharset($extConf['BECSVCharset']); $csObj->convArray($row, $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'], $extConf['BECSVCharset']); $this->addToCSV($row); } // Create element in table cells: $iOut .= $this->addelement(1, $theIcon, $theData, $rowBackgroundColor); // Render thumbsnails if a thumbnail column exists and there is content in it: if ($this->thumbs && trim($row[$thumbsCol])) { $iOut .= $this->addelement(4, '', array($titleCol => $this->thumbCode($row, $table, $thumbsCol)), $rowBackgroundColor); } // Finally, return table row element: return $iOut; }
/** * Shows the copy wizard. * * @param int $uidClip Uid of the clipped item * @param int $uidTarget Uid of target * @param string $command Command */ protected function showCopyWizard($uidClip, $uidTarget, $command) { $language = $this->getLanguageService(); $str = ''; $this->pageinfo = BackendUtility::readCategoryAccess($uidTarget, BackendUtility::getCategoryPermsClause(1)); $str .= $this->doc->header($language->getLL('Copy')); $str .= $this->doc->spacer(5); // flag if neither sorting nor localizations // are existing and we can immediately copy $noActionReq = false; // First prepare user defined hooks $hooks = \CommerceTeam\Commerce\Factory\HookFactory::getHooks('Utility/DataHandlerUtility', 'showCopyWizard'); switch ($command) { case 'overwrite': // pass through // pass through case 'pasteProduct': // chose local to copy from product /** * Product. * * @var \CommerceTeam\Commerce\Domain\Model\Product $product */ $product = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Product', $uidClip); $product->loadData(); $prods = $product->getL18nProducts(); if (!empty($prods)) { $str .= '<h1>' . $language->getLL('copy.head.l18n') . '</h1> <h2>' . $language->getLL('copy.product') . ': ' . $product->getTitle() . '</h2> <ul>'; // walk the l18n and get the selector box $l = count($prods); for ($i = 0; $i < $l; ++$i) { $tmpProd = $prods[$i]; $flag = $tmpProd['flag'] != '' ? '<img src="' . $this->getBackPath() . 'gfx/flags/' . $tmpProd['flag'] . '" alt="Flag" />' : ''; $str .= '<li><input type="checkbox" name="locale[]" id="loc_' . $tmpProd['uid'] . '" value="' . $tmpProd['sys_language'] . '" /><label for="loc_' . $tmpProd['uid'] . '">' . $flag . $tmpProd['title'] . '</label></li>'; } $str .= '</ul>'; } $records = array(); // chose sorting position if ($command != 'overwrite') { // Initialize tree object: /** * Product data. * * @var \CommerceTeam\Commerce\Tree\Leaf\ProductData $productData */ $productData = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\ProductData'); $productData->init(); $records = $productData->getRecordsDbList($uidTarget); } $l = count($records['pid'][$uidTarget]); // Hook: beforeFormClose $userIgnoreClose = false; foreach ($hooks as $hookObj) { if (method_exists($hookObj, 'beforeFormClose')) { // set $user_ignoreClose to true if you want to // force the script to print out the execute button $str .= $hookObj->beforeFormClose($uidClip, $uidTarget, $command, $userIgnoreClose); } } if (0 >= $l && (!empty($prods) || $userIgnoreClose)) { // no child object - sorting position is irrelevant - just print a submit button // and notify users that there are not products in the category yet $str .= '<input type="submit" value="' . $language->getLL('copy.submit') . '" />'; } elseif (0 < $l) { // at least 1 item - offer choice $icon = '<img' . IconUtility::skinImg($this->getBackPath(), 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' alt="" title="Insert the category" />'; $prodIcon = '<img' . IconUtility::skinImg($this->getBackPath(), IconUtility::getIcon('tx_commerce_products', array('uid' => $uidTarget)), 'width="18" height="16"') . 'align="top" class="c-recIcon"/>'; $str .= '<h1>' . $language->getLL('copy.position') . '</h1>'; $onClickAction = 'onclick="submitForm(' . $records['pid'][$uidTarget][0]['uid'] . ')"'; $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; for ($i = 0; $i < $l; ++$i) { $record = $records['pid'][$uidTarget][$i]; $onClickAction = 'onclick="submitForm(-' . $record['uid'] . ')"'; $str .= '<span class="nobr">' . $prodIcon . $record['title'] . '</span><br />'; $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; } } else { $noActionReq = true; } break; case 'pasteCategory': // chose locale to copy from category /** * Category. * * @var \CommerceTeam\Commerce\Domain\Model\Category $category */ $category = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Category', $uidClip); $category->loadData(); $cats = $category->getL18nCategories(); if (!empty($cats)) { $str .= '<h1>' . $language->getLL('copy.head.l18n') . '</h1> <h2>' . $language->getLL('copy.category') . ': ' . $category->getTitle() . '</h2> <ul>'; // walk the l18n and get the selector box $l = count($cats); for ($i = 0; $i < $l; ++$i) { $tmpCat = $cats[$i]; $flag = $tmpCat['flag'] != '' ? '<img src="' . $this->getBackPath() . 'gfx/flags/' . $tmpCat['flag'] . '" alt="Flag" />' : ''; $str .= '<li><input type="checkbox" name="locale[]" id="loc_' . $tmpCat['uid'] . '" value="' . $tmpCat['sys_language'] . '" /><label for="loc_' . $tmpCat['uid'] . '">' . $flag . $tmpCat['title'] . '</label></li>'; } $str .= '</ul>'; } // chose sorting position // Initialize tree object: /** * Category data. * * @var \CommerceTeam\Commerce\Tree\Leaf\CategoryData $categoryData */ $categoryData = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\CategoryData'); $categoryData->init(); $records = $categoryData->getRecordsDbList($uidTarget); $l = count($records['pid'][$uidTarget]); // Hook: beforeFormClose $userIgnoreClose = false; foreach ($hooks as $hookObj) { if (method_exists($hookObj, 'beforeFormClose')) { $str .= $hookObj->beforeFormClose($uidClip, $uidTarget, $command, $userIgnoreClose); } } if ($l == 0 && (!empty($cats) || $userIgnoreClose)) { // no child object - sorting position is irrelevant - just print a submit button $str .= '<input type="submit" value="' . $language->getLL('copy.submit') . '" />'; } elseif (0 < $l) { // at least 1 item - offer choice $icon = '<img' . IconUtility::skinImg($this->getBackPath(), 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' alt="" title="Insert the category" />'; $catIcon = '<img' . IconUtility::skinImg($this->getBackPath(), IconUtility::getIcon('tx_commerce_categories', array('uid' => $uidTarget)), 'width="18" height="16"') . 'align="top" class="c-recIcon"/>'; $str .= '<h1>' . $language->getLL('copy.position') . '</h1>'; $onClickAction = 'onclick="submitForm(' . $records['pid'][$uidTarget][0]['uid'] . ')"'; $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; for ($i = 0; $i < $l; ++$i) { $record = $records['pid'][$uidTarget][$i]; $onClickAction = 'onclick="submitForm(-' . $record['uid'] . ')"'; $str .= '<span class="nobr">' . $catIcon . $record['title'] . '</span><br /> <span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; } } else { $noActionReq = true; } break; default: die('unknown command'); } // skip transforming and execute the command // if there are no locales and no positions if ($noActionReq) { $this->commitCommand($uidClip, $uidTarget, $command); return; } // Hook: beforeTransform foreach ($hooks as $hookObj) { if (method_exists($hookObj, 'beforeTransform')) { $str .= $hookObj->beforeTransform($uidClip, $uidTarget, $command); } } $this->content .= $str; $markers = array('CSH' => '', 'CONTENT' => $this->content, 'CATINFO' => '', 'CATPATH' => ''); $markers['FUNC_MENU'] = $this->doc->funcMenu('', \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode'])); $this->content = $this->doc->startPage($language->getLL('Copy')); $this->content .= $this->doc->moduleBody($this->pageinfo, array(), $markers); $this->content .= $this->doc->endPage(); }
/** * Rendering a single row for the list. * * @param string $table Table name * @param array $row Current record * @param int $cc Counter, counting for each time an element is rendered * (used for alternating colors) * @param string $titleCol Table field (column) where header value is found * @param string $thumbsCol Table field (column) where (possible) thumbnails * can be found * @param int $indent Indent from left. * * @return string Table row for the element */ public function renderListRow($table, array $row, $cc, $titleCol, $thumbsCol, $indent = 0) { $database = $this->getDatabaseConnection(); $language = $this->getLanguageService(); $iOut = ''; if (substr(TYPO3_version, 0, 3) >= '4.0') { // In offline workspace, look for alternative record: BackendUtility::workspaceOL($table, $row, $this->getBackendUser()->workspace); } // Background color, if any: $rowBackgroundColor = ''; if ($this->alternateBgColors) { $rowBackgroundColor = $cc % 2 ? '' : ' bgcolor="' . GeneralUtility::modifyHTMLColor($this->getControllerDocumentTemplate()->bgColor4, 10, 10, 10) . '"'; } // Overriding with versions background color if any: $rowBackgroundColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $rowBackgroundColor; // Initialization $alttext = BackendUtility::getRecordIconAltText($row, $table); // Incr. counter. ++$this->counter; $indentStyle = $indent ? ' style="margin-left: ' . $indent . 'px;"' : ''; $iconAttributes = 'title="' . htmlspecialchars($alttext) . '"' . $indentStyle; // Icon for order comment and delivery address $iconPath = ''; $iconImg = ''; if ($row['comment'] != '' && $row['internalcomment'] != '') { if ($row['tx_commerce_address_type_id'] == 2) { $iconPath = 'orders_add_user_int.gif'; } else { $iconPath = 'orders_user_int.gif'; } } elseif ($row['comment'] != '') { if ($row['tx_commerce_address_type_id'] == 2) { $iconPath = 'orders_add_user.gif'; } else { $iconPath = 'orders_user.gif'; } } elseif ($row['internalcomment'] != '') { if ($row['tx_commerce_address_type_id'] == 2) { $iconPath = 'orders_add_int.gif'; } else { $iconPath = 'orders_int.gif'; } } else { if ($row['tx_commerce_address_type_id'] == 2) { $iconPath = 'orders_add.gif'; } else { $iconImg = '<img ' . IconUtility::skinImg($this->backPath, IconUtility::getIcon($table, $row), $iconAttributes) . ' />'; } } if ($iconPath != '') { $iconImg = '<img' . IconUtility::skinImg($this->backPath, PATH_TXCOMMERCE_REL . 'Resources/Public/Icons/Table/' . $iconPath, $iconAttributes) . '/>'; } $theIcon = $this->clickMenuEnabled ? $this->getControllerDocumentTemplate()->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg; // Preparing and getting the data-array $theData = array(); foreach ($this->fieldArray as $fCol) { if ($fCol == 'pid') { $theData[$fCol] = $row[$fCol]; } elseif ($fCol == 'sum_price_gross') { if ($this->csvOutput) { $row[$fCol] = $row[$fCol] / 100; } else { $theData[$fCol] = \CommerceTeam\Commerce\ViewHelpers\Money::format($row[$fCol], $row['cu_iso_3'], false); } } elseif ($fCol == 'crdate') { $theData[$fCol] = BackendUtility::date($row[$fCol]); $row[$fCol] = BackendUtility::date($row[$fCol]); } elseif ($fCol == 'tstamp') { $theData[$fCol] = BackendUtility::date($row[$fCol]); $row[$fCol] = BackendUtility::date($row[$fCol]); } elseif ($fCol == 'articles') { $articleNumber = array(); $articleName = array(); $resArticles = $database->exec_SELECTquery('article_number, title, order_uid', 'tx_commerce_order_articles', 'order_uid = ' . (int) $row['uid']); $articles = array(); while ($lokalRow = $database->sql_fetch_assoc($resArticles)) { $articles[] = $lokalRow['article_number'] . ':' . $lokalRow['title']; $articleNumber[] = $lokalRow['article_number']; $articleName[] = $lokalRow['title']; } if ($this->csvOutput) { $theData[$fCol] = implode(',', $articles); $row[$fCol] = implode(',', $articles); } else { $theData[$fCol] = '<input type="checkbox" name="orderUid[]" value="' . $row['uid'] . '">'; } } elseif ($fCol == 'numarticles') { $resArticles = $database->exec_SELECTquery('sum(amount) amount', 'tx_commerce_order_articles', 'order_uid = ' . (int) $row['uid'] . ' AND article_type_uid = ' . NORMALARTICLETYPE); if ($lokalRow = $database->sql_fetch_assoc($resArticles)) { $theData[$fCol] = $lokalRow['amount']; $row[$fCol] = $lokalRow['amount']; } } elseif ($fCol == 'article_number') { $articleNumber = array(); $resArticles = $database->exec_SELECTquery('article_number', 'tx_commerce_order_articles', 'order_uid = ' . (int) $row['uid'] . ' AND article_type_uid = ' . NORMALARTICLETYPE); while ($lokalRow = $database->sql_fetch_assoc($resArticles)) { $articleNumber[] = $lokalRow['article_number'] ? $lokalRow['article_number'] : $language->sL('no_article_number'); } $theData[$fCol] = implode(',', $articleNumber); } elseif ($fCol == 'article_name') { $articleName = array(); $resArticles = $database->exec_SELECTquery('title', 'tx_commerce_order_articles', 'order_uid = ' . (int) $row['uid'] . ' AND article_type_uid = ' . NORMALARTICLETYPE); while ($lokalRow = $database->sql_fetch_assoc($resArticles)) { $articleName[] = $lokalRow['title'] ? $lokalRow['title'] : $language->sL('no_article_title'); } $theData[$fCol] = implode(',', $articleName); } elseif ($fCol == 'order_type_uid_noName') { $typesResult = $database->exec_SELECTquery('*', 'tx_commerce_order_types', 'uid = ' . (int) $row['order_type_uid_noName']); while ($localRow = $database->sql_fetch_assoc($typesResult)) { if ($localRow['icon']) { $filepath = $this->backPath . SettingsFactory::getInstance()->getTcaValue('tx_commerce_order_types.columns.icon.config.uploadfolder') . '/' . $localRow['icon']; $theData[$fCol] = '<img ' . IconUtility::skinImg($this->backPath, $filepath, ' title="' . htmlspecialchars($localRow['title']) . '"' . $indentStyle); } else { $theData[$fCol] = $localRow['title']; } } } elseif ($fCol == '_PATH_') { $theData[$fCol] = $this->recPath($row['pid']); } elseif ($fCol == '_CONTROL_') { $theData[$fCol] = $this->makeControl($table, $row); } elseif ($fCol == '_CLIPBOARD_') { $theData[$fCol] = $this->makeClip($table, $row); } elseif ($fCol == '_LOCALIZATION_') { list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row); $theData[$fCol] = $lC1; $theData[$fCol . 'b'] = $lC2; } elseif ($fCol == '_LOCALIZATION_b') { // Do nothing, has been done above. $theData[$fCol] .= ''; } elseif ($fCol == 'order_id') { $theData[$fCol] = $row[$fCol]; } else { $theData[$fCol] = $this->linkUrlMail(htmlspecialchars(BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'])), $row[$fCol]); } } // Add row to CSV list: if ($this->csvOutput) { $beCsvCharset = SettingsFactory::getInstance()->getExtConf('BECSVCharset'); // Charset Conversion /** * Charset converter. * * @var \TYPO3\CMS\Core\Charset\CharsetConverter $csObj */ $csObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter'); $csObj->initCharset($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']); if (!$beCsvCharset) { $beCsvCharset = 'iso-8859-1'; } $csObj->initCharset($beCsvCharset); $csObj->convArray($row, $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'], $beCsvCharset); $this->addToCSV($row); } // Create element in table cells: $iOut .= $this->addelement(1, $theIcon, $theData, $rowBackgroundColor); // Render thumbsnails if a thumbnail column exists and there is content in it: if ($this->thumbs && trim($row[$thumbsCol])) { $iOut .= $this->addelement(4, '', array($titleCol => $this->thumbCode($row, $table, $thumbsCol)), $rowBackgroundColor); } // Finally, return table row element: return $iOut; }
/** * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu. * * @param string Table name * @param array Record array * @param string Record title (NOT USED) * @return string HTML for the icon */ function getIcon($table, $row, $noEdit) { // Initialization $alttext = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($row, $table); $iconImg = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, \TYPO3\CMS\Backend\Utility\IconUtility::getIcon($table, $row), 'width="18" height="16"') . 'title="' . $alttext . '"'; $iconImg .= ' />'; $this->counter++; $disableList = ''; if ($noEdit) { $disableList = '+info,copy'; } // The icon with link $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid'], '', '', $disableList); return $theIcon; }