本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::wrapInHelp方法的具体用法?PHP BackendUtility::wrapInHelp怎么用?PHP BackendUtility::wrapInHelp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::wrapInHelp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildSiteAction
/**
* @param string $mass
* @param bool $makeResources
* @param bool $makeMountPoint
* @param string $extensionKey
* @param null $author
* @param null $title
* @param null $description
* @param bool $useVhs
* @param bool $useFluidcontentCore
* @param bool $pages
* @param bool $content
* @param bool $backend
* @param bool $controllers
*/
public function buildSiteAction($mass = EnterpriseLevelEnumeration::BY_DEFAULT, $makeResources = true, $makeMountPoint = true, $extensionKey = null, $author = null, $title = null, $description = null, $useVhs = true, $useFluidcontentCore = true, $pages = true, $content = true, $backend = false, $controllers = true)
{
$view = 'buildSite';
$this->view->assign('csh', BackendUtility::wrapInHelp('builder', 'modules'));
$this->view->assign('view', $view);
$output = $this->kickStarterService->generateFluidPoweredSite($mass, $makeResources, $makeMountPoint, $extensionKey, $author, $title, $description, $useVhs, $useFluidcontentCore, $pages, $content, $backend, $controllers);
$this->view->assign('output', $output);
// Note: remapping some arguments to match values that will be displayed in the receipt; display uses
// template from EXT:builder
$attributes = ['name' => ['value' => $extensionKey], 'author' => ['value' => $author], 'level' => ['value' => $level], 'vhs' => ['value' => $useVhs], 'pages' => ['value' => $pages], 'content' => ['value' => $content], 'backend' => ['value' => $backend], 'controllers' => ['value' => $controllers]];
$attributes['name'] = $extensionKey;
$attributes['vhs'] = $useVhs;
$this->view->assign('attributes', $attributes);
}
示例2: render
/**
* Render a help button wit the given title and content
*
* @param string $title Help title
* @return mixed
*/
public function render($title)
{
$content = $this->renderChildren();
return BackendUtility::wrapInHelp('', '', '', array('title' => $title, 'description' => $content));
}
示例3: getTemplateMarkers
/**
* Gets the filled markers that are used in the HTML template.
*
* @return array The filled marker array
*/
protected function getTemplateMarkers()
{
$markers = array('CSH' => \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('_MOD_tools_txschedulerM1', ''), 'FUNC_MENU' => $this->getFunctionMenu(), 'CONTENT' => $this->content, 'TITLE' => $GLOBALS['LANG']->getLL('title'));
return $markers;
}
示例4: getCheckOptions
/**
* Builds the checkboxes out of the hooks array
*
* @param array $brokenLinkOverView Array of broken links information
* @param string $prefix
* @return string code content
*/
protected function getCheckOptions(array $brokenLinkOverView, $prefix = '')
{
$markerArray = array();
if (!empty($prefix)) {
$additionalAttr = ' class="' . $prefix . '"';
} else {
$additionalAttr = ' class="refresh"';
}
$checkOptionsTemplate = HtmlParser::getSubpart($this->doc->moduleTemplate, '###CHECKOPTIONS_SECTION###');
$hookSectionTemplate = HtmlParser::getSubpart($checkOptionsTemplate, '###HOOK_SECTION###');
$markerArray['statistics_header'] = $this->doc->sectionHeader($this->getLanguageService()->getLL('report.statistics.header'));
$markerArray['total_count_label'] = BackendUtility::wrapInHelp('linkvalidator', 'checkboxes', $this->getLanguageService()->getLL('overviews.nbtotal'));
$markerArray['total_count'] = $brokenLinkOverView['brokenlinkCount'] ?: '0';
$linktypes = GeneralUtility::trimExplode(',', $this->modTS['linktypes'], TRUE);
$hookSectionContent = '';
if (is_array($linktypes)) {
if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $type => $value) {
if (in_array($type, $linktypes)) {
$hookSectionMarker = array('count' => $brokenLinkOverView[$type] ?: '0');
$translation = $this->getLanguageService()->getLL('hooks.' . $type) ?: $type;
$hookSectionMarker['option'] = '<input type="checkbox"' . $additionalAttr . ' id="' . $prefix . 'SET_' . $type . '" name="' . $prefix . 'SET[' . $type . ']" value="1"' . ($this->pObj->MOD_SETTINGS[$type] ? ' checked="checked"' : '') . '/>' . '<label for="' . $prefix . 'SET_' . $type . '">' . htmlspecialchars($translation) . '</label>';
$hookSectionContent .= HtmlParser::substituteMarkerArray($hookSectionTemplate, $hookSectionMarker, '###|###', TRUE, TRUE);
}
}
}
}
$checkOptionsTemplate = HtmlParser::substituteSubpart($checkOptionsTemplate, '###HOOK_SECTION###', $hookSectionContent);
return HtmlParser::substituteMarkerArray($checkOptionsTemplate, $markerArray, '###|###', TRUE, TRUE);
}
示例5: getTable
//.........这里部分代码省略.........
// (API function from TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList)
$this->setTotalItems($queryParts);
// Init:
$dbCount = 0;
$out = '';
$tableHeader = '';
$result = null;
$listOnlyInSingleTableMode = $this->listOnlyInSingleTableMode && !$this->table;
// If the count query returned any number of records, we perform the real query,
// selecting records.
if ($this->totalItems) {
// Fetch records only if not in single table mode
if ($listOnlyInSingleTableMode) {
$dbCount = $this->totalItems;
} else {
// Set the showLimit to the number of records when outputting as CSV
if ($this->csvOutput) {
$this->showLimit = $this->totalItems;
$this->iLimit = $this->totalItems;
}
$result = $db->exec_SELECT_queryArray($queryParts);
$dbCount = $db->sql_num_rows($result);
}
}
// If any records was selected, render the list:
if ($dbCount) {
$tableTitle = $lang->sL($GLOBALS['TCA'][$table]['ctrl']['title'], true);
if ($tableTitle === '') {
$tableTitle = $table;
}
// Header line is drawn
$theData = array();
if ($this->disableSingleTableView) {
$theData[$titleCol] = '<span class="c-table">' . BackendUtility::wrapInHelp($table, '', $tableTitle) . '</span> (<span class="t3js-table-total-items">' . $this->totalItems . '</span>)';
} else {
$icon = $this->table ? '<span title="' . $lang->getLL('contractView', true) . '">' . $this->iconFactory->getIcon('actions-view-table-collapse', Icon::SIZE_SMALL)->render() . '</span>' : '<span title="' . $lang->getLL('expandView', true) . '">' . $this->iconFactory->getIcon('actions-view-table-expand', Icon::SIZE_SMALL)->render() . '</span>';
$theData[$titleCol] = $this->linkWrapTable($table, $tableTitle . ' (<span class="t3js-table-total-items">' . $this->totalItems . '</span>) ' . $icon);
}
if ($listOnlyInSingleTableMode) {
$tableHeader .= BackendUtility::wrapInHelp($table, '', $theData[$titleCol]);
} else {
// Render collapse button if in multi table mode
$collapseIcon = '';
if (!$this->table) {
$href = htmlspecialchars($this->listURL() . '&collapse[' . $table . ']=' . ($tableCollapsed ? '0' : '1'));
$title = $tableCollapsed ? $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.expandTable', true) : $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.collapseTable', true);
$icon = '<span class="collapseIcon">' . $this->iconFactory->getIcon($tableCollapsed ? 'actions-view-list-expand' : 'actions-view-list-collapse', Icon::SIZE_SMALL)->render() . '</span>';
$collapseIcon = '<a href="' . $href . '" title="' . $title . '" class="pull-right t3js-toggle-recordlist" data-table="' . htmlspecialchars($table) . '" data-toggle="collapse" data-target="#recordlist-' . htmlspecialchars($table) . '">' . $icon . '</a>';
}
$tableHeader .= $theData[$titleCol] . $collapseIcon;
}
// Render table rows only if in multi table view or if in single table view
$rowOutput = '';
if (!$listOnlyInSingleTableMode || $this->table) {
// Fixing an order table for sortby tables
$this->currentTable = array();
$currentIdList = array();
$doSort = $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField;
$prevUid = 0;
$prevPrevUid = 0;
// Get first two rows and initialize prevPrevUid and prevUid if on page > 1
if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
$row = $db->sql_fetch_assoc($result);
$prevPrevUid = -(int) $row['uid'];
$row = $db->sql_fetch_assoc($result);
$prevUid = $row['uid'];
示例6: main
//.........这里部分代码省略.........
if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
top.content.nav_frame.refresh_nav();
}
}
' . $this->doc->redirectUrls($listUrl) . '
' . $dblist->CBfunctions() . '
function editRecords(table,idList,addParams,CBflag) { //
window.location.href="' . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams;
}
function editList(table,idList) { //
var list="";
// Checking how many is checked, how many is not
var pointer=0;
var pos = idList.indexOf(",");
while (pos!=-1) {
if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) {
list+=idList.substr(pointer,pos-pointer)+",";
}
pointer=pos+1;
pos = idList.indexOf(",",pointer);
}
if (cbValue(table+"|"+idList.substr(pointer))) {
list+=idList.substr(pointer)+",";
}
return list ? list : idList;
}
if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
');
// Setting up the context sensitive menu:
$this->doc->getContextMenuCode();
}
// access
// Begin to compile the whole page, starting out with page header:
$this->body = $this->doc->header($this->pageinfo['title']);
$this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">';
$this->body .= $dblist->HTMLcode;
$this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>';
// If a listing was produced, create the page footer with search form etc:
if ($dblist->HTMLcode) {
// Making field select box (when extended view for a single table is enabled):
if ($dblist->table) {
$this->body .= $dblist->fieldSelectBox($dblist->table);
}
// Adding checkbox options for extended listing and clipboard display:
$this->body .= '
<!--
Listing options for extended view, clipboard and localization view
-->
<div id="typo3-listOptions">
<form action="" method="post">';
// Add "display bigControlPanel" checkbox:
if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'selectable') {
$this->body .= BackendUtility::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"');
$this->body .= '<label for="checkLargeControl">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('largeControl', TRUE)) . '</label><br />';
}
// Add "clipboard" checkbox:
if ($this->modTSconfig['properties']['enableClipBoard'] === 'selectable') {
if ($dblist->showClipboard) {
$this->body .= BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"');
$this->body .= '<label for="checkShowClipBoard">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('showClipBoard', TRUE)) . '</label><br />';
}
}
// Add "localization view" checkbox:
if ($this->modTSconfig['properties']['enableLocalizationView'] === 'selectable') {
$this->body .= BackendUtility::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"');
$this->body .= '<label for="checkLocalization">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('localization', TRUE)) . '</label><br />';
}
$this->body .= '
</form>
</div>';
}
// Printing clipboard if enabled
if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard && ($dblist->HTMLcode || $dblist->clipObj->hasElements())) {
$this->body .= '<div class="db_list-dashboard">' . $dblist->clipObj->printClipboard() . '</div>';
}
// Search box:
if (!$this->modTSconfig['properties']['disableSearchBox'] && ($dblist->HTMLcode || $dblist->searchString !== '')) {
$sectionTitle = BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.search', TRUE));
$this->body .= '<div class="db_list-searchbox">' . $this->doc->section($sectionTitle, $dblist->getSearchBox(), FALSE, TRUE, FALSE, TRUE) . '</div>';
}
// Additional footer content
$footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/mod1/index.php']['drawFooterHook'];
if (is_array($footerContentHook)) {
foreach ($footerContentHook as $hook) {
$params = array();
$this->body .= GeneralUtility::callUserFunction($hook, $params, $this);
}
}
// Setting up the buttons and markers for docheader
$docHeaderButtons = $dblist->getButtons();
$markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->body, 'EXTRACONTAINERCLASS' => $this->table ? 'singletable' : '');
// Build the <body> for the module
$this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
// Renders the module page
$this->content = $this->doc->render('DB list', $this->content);
}
示例7: buildFormAction
/**
* @param string $view
* @return void
*/
public function buildFormAction($view = 'BuildForm')
{
$author = '';
if (!empty($GLOBALS['BE_USER']->user['realName']) && !empty($GLOBALS['BE_USER']->user['email'])) {
$author = $GLOBALS['BE_USER']->user['realName'] . ' <' . $GLOBALS['BE_USER']->user['email'] . '>';
}
$this->view->assign('csh', BackendUtility::wrapInHelp('builder', 'modules'));
$this->view->assign('view', $view);
$this->view->assign('author', $author);
$isFluidcontentCoreInstalled = ExtensionManagementUtility::isLoaded('fluidcontent_core') ? "'checked'" : null;
$this->view->assign('isFluidcontentCoreInstalled', $isFluidcontentCoreInstalled);
}
示例8: getCSH
/**
* Returns the CSH Icon for given string
*
* @param string $str Locallang key
* @param string $label The label to be used, that should be wrapped in help
* @return string HTML output.
*/
protected function getCSH($str, $label)
{
$context = '_MOD_user_setup';
$field = $str;
$strParts = explode(':', $str);
if (count($strParts) > 1) {
// Setting comes from another extension
$context = $strParts[0];
$field = $strParts[1];
} elseif ($str !== 'language' && $str !== 'simuser' && $str !== 'reset') {
$field = 'option_' . $str;
}
return BackendUtility::wrapInHelp($context, $field, $label);
}
示例9: renderListContent
//.........这里部分代码省略.........
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
if (!isset($dblist->externalTables[$table])) {
$q_count = $this->getNumberOfHiddenElements();
$h_func_b = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') . '<label for="checkTt_content_showHidden">' . (!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('hiddenCE')) : $GLOBALS['LANG']->getLL('hiddenCE') . ' (' . $q_count . ')') . '</label>';
// Boolean: Display up/down arrows and edit icons for tt_content records
$dblist->tt_contentConfig['showCommands'] = 1;
// Boolean: Display info-marks or not
$dblist->tt_contentConfig['showInfo'] = 1;
// Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown
// in the total width of the page
$dblist->tt_contentConfig['single'] = 0;
if ($this->MOD_SETTINGS['function'] == 4) {
// Grid view
$dblist->tt_contentConfig['showAsGrid'] = 1;
}
// Setting up the tt_content columns to show:
if (is_array($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'])) {
$colList = array();
$tcaItems = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getColPosListItemsParsed', $this->id, $this);
foreach ($tcaItems as $temp) {
$colList[] = $temp[1];
}
} else {
// ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
$colList = array('1', '0', '2', '3');
}
if (strcmp($this->colPosList, '')) {
$colList = array_intersect(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->colPosList), $colList);
}
// If only one column found, display the single-column view.
if (count($colList) === 1 && !$this->MOD_SETTINGS['function'] === 4) {
// Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol']
// is shown in the total width of the page
$dblist->tt_contentConfig['single'] = 1;
// The column(s) to show if single mode (under each other)
$dblist->tt_contentConfig['showSingleCol'] = current($colList);
}
// The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
$dblist->tt_contentConfig['cols'] = implode(',', $colList);
$dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
$dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language);
// If the function menu is set to "Language":
if ($this->MOD_SETTINGS['function'] == 2) {
$dblist->tt_contentConfig['single'] = 0;
$dblist->tt_contentConfig['languageMode'] = 1;
$dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
$dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
}
} else {
if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) {
$h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], 'db_layout.php', '');
} else {
$h_func = '';
}
}
// Start the dblist object:
$dblist->itemsLimitSingleTable = 1000;
$dblist->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
$dblist->counter = $CMcounter;
$dblist->ext_function = $this->MOD_SETTINGS['function'];
// Render versioning selector:
$dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
// Generate the list of elements here:
$dblist->generateList();
// Adding the list content to the tableOutput variable:
$tableOutput[$table] = ($h_func ? $h_func . '<br /><img src="clear.gif" width="1" height="4" alt="" /><br />' : '') . $dblist->HTMLcode . ($h_func_b ? '<img src="clear.gif" width="1" height="10" alt="" /><br />' . $h_func_b : '');
// ... and any accumulated JavaScript goes the same way!
$tableJSOutput[$table] = $dblist->JScode;
// Increase global counter:
$CMcounter += $dblist->counter;
// Reset variables after operation:
$dblist->HTMLcode = '';
$dblist->JScode = '';
$h_func = '';
$h_func_b = '';
}
// END: traverse tables
// For Context Sensitive Menus:
$this->doc->getContextMenuCode();
// Add the content for each table we have rendered (traversing $tableOutput variable)
foreach ($tableOutput as $table => $output) {
$content .= $this->doc->section('', $output, TRUE, TRUE, 0, TRUE);
$content .= $this->doc->spacer(15);
$content .= $this->doc->sectionEnd();
}
// Making search form:
if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) {
$sectionTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE));
$content .= $this->doc->section($sectionTitle, $dblist->getSearchBox(0), FALSE, TRUE, FALSE, TRUE);
}
// Additional footer content
$footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawFooterHook'];
if (is_array($footerContentHook)) {
foreach ($footerContentHook as $hook) {
$params = array();
$content .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);
}
}
return $content;
}
示例10: render
//.........这里部分代码省略.........
if (!empty($flexFormFieldArray['TCEforms']['displayCond'])) {
$conditionData = is_array($flexFormRowData) ? $flexFormRowData : array();
$conditionData['parentRec'] = $row;
/** @var $elementConditionMatcher ElementConditionMatcher */
$elementConditionMatcher = GeneralUtility::makeInstance(ElementConditionMatcher::class);
$displayConditionResult = $elementConditionMatcher->match($flexFormFieldArray['TCEforms']['displayCond'], $conditionData, $vDEFkey);
}
if (!$displayConditionResult) {
continue;
}
// On-the-fly migration for flex form "TCA"
// @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. This can be removed *if* no additional TCA migration is added with CMS 8, see class TcaMigration
$dummyTca = array('dummyTable' => array('columns' => array('dummyField' => $flexFormFieldArray['TCEforms'])));
$tcaMigration = GeneralUtility::makeInstance(TcaMigration::class);
$migratedTca = $tcaMigration->migrate($dummyTca);
$messages = $tcaMigration->getMessages();
if (!empty($messages)) {
$context = 'FormEngine did an on-the-fly migration of a flex form data structure. This is deprecated and will be removed' . ' with TYPO3 CMS 8. Merge the following changes into the flex form definition of table ' . $table . ' in field ' . $fieldName . ':';
array_unshift($messages, $context);
GeneralUtility::deprecationLog(implode(LF, $messages));
}
$flexFormFieldArray['TCEforms'] = $migratedTca['dummyTable']['columns']['dummyField'];
// Set up options for single element
$fakeParameterArray = array('fieldConf' => array('label' => $languageService->sL(trim($flexFormFieldArray['TCEforms']['label'])), 'config' => $flexFormFieldArray['TCEforms']['config'], 'defaultExtras' => $flexFormFieldArray['TCEforms']['defaultExtras'], 'onChange' => $flexFormFieldArray['TCEforms']['onChange']));
// Force a none field if default language can not be edited
if ($flexFormNoEditDefaultLanguage && $flexFormCurrentLanguage === 'lDEF') {
$fakeParameterArray['fieldConf']['config'] = array('type' => 'none', 'rows' => 2);
}
$alertMsgOnChange = '';
if ($fakeParameterArray['fieldConf']['onChange'] === 'reload' || !empty($GLOBALS['TCA'][$table]['ctrl']['type']) && $GLOBALS['TCA'][$table]['ctrl']['type'] === $flexFormFieldName || !empty($GLOBALS['TCA'][$table]['ctrl']['requestUpdate']) && GeneralUtility::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'], $flexFormFieldName)) {
if ($this->getBackendUserAuthentication()->jsConfirmation(JsConfirmation::TYPE_CHANGE)) {
$alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
} else {
$alertMsgOnChange = 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm();}';
}
}
$fakeParameterArray['fieldChangeFunc'] = $parameterArray['fieldChangeFunc'];
if ($alertMsgOnChange) {
$fakeParameterArray['fieldChangeFunc']['alert'] = $alertMsgOnChange;
}
$fakeParameterArray['onFocus'] = $parameterArray['onFocus'];
$fakeParameterArray['label'] = $parameterArray['label'];
$fakeParameterArray['itemFormElName'] = $parameterArray['itemFormElName'] . $flexFormFormPrefix . '[' . $flexFormFieldName . '][' . $vDEFkey . ']';
$fakeParameterArray['itemFormElID'] = $fakeParameterArray['itemFormElName'];
if (isset($flexFormRowData[$flexFormFieldName][$vDEFkey])) {
$fakeParameterArray['itemFormElValue'] = $flexFormRowData[$flexFormFieldName][$vDEFkey];
} else {
$fakeParameterArray['itemFormElValue'] = $fakeParameterArray['fieldConf']['config']['default'];
}
$options = $this->globalOptions;
$options['parameterArray'] = $fakeParameterArray;
$options['elementBaseName'] = $this->globalOptions['elementBaseName'] . $flexFormFormPrefix . '[' . $flexFormFieldName . '][' . $vDEFkey . ']';
if (!empty($flexFormFieldArray['TCEforms']['config']['renderType'])) {
$options['renderType'] = $flexFormFieldArray['TCEforms']['config']['renderType'];
} else {
// Fallback to type if no renderType is given
$options['renderType'] = $flexFormFieldArray['TCEforms']['config']['type'];
}
/** @var NodeFactory $nodeFactory */
$nodeFactory = $this->globalOptions['nodeFactory'];
$childResult = $nodeFactory->create($options)->render();
$theTitle = htmlspecialchars($fakeParameterArray['fieldConf']['label']);
$defInfo = array();
if (!$flexFormNoEditDefaultLanguage) {
$previewLanguages = $this->globalOptions['additionalPreviewLanguages'];
foreach ($previewLanguages as $previewLanguage) {
$defInfo[] = '<div class="t3-form-original-language">';
$defInfo[] = FormEngineUtility::getLanguageIcon($table, $row, 'v' . $previewLanguage['ISOcode']);
$defInfo[] = $this->previewFieldValue($flexFormRowData[$flexFormFieldName]['v' . $previewLanguage['ISOcode']], $fakeParameterArray['fieldConf'], $fieldName);
$defInfo[] = '</div>';
}
}
$languageIcon = '';
if ($vDEFkey !== 'vDEF') {
$languageIcon = FormEngineUtility::getLanguageIcon($table, $row, $vDEFkey);
}
// Possible line breaks in the label through xml: \n => <br/>, usage of nl2br() not possible, so it's done through str_replace (?!)
$processedTitle = str_replace('\\n', '<br />', $theTitle);
// @todo: Similar to the processing within SingleElementContainer ... use it from there?!
$html = array();
$html[] = '<div class="form-section">';
$html[] = '<div class="form-group t3js-formengine-palette-field t3js-formengine-validation-marker">';
$html[] = '<label class="t3js-formengine-label">';
$html[] = $languageIcon;
$html[] = BackendUtility::wrapInHelp($parameterArray['_cshKey'], $flexFormFieldName, $processedTitle);
$html[] = '</label>';
$html[] = '<div class="t3js-formengine-field-item">';
$html[] = $childResult['html'];
$html[] = implode(LF, $defInfo);
$html[] = $this->renderVDEFDiff($flexFormRowData[$flexFormFieldName], $vDEFkey);
$html[] = '</div>';
$html[] = '</div>';
$html[] = '</div>';
$resultArray['html'] .= implode(LF, $html);
$childResult['html'] = '';
$resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $childResult);
}
}
return $resultArray;
}
示例11: wrapSingleFieldContentWithLabelAndOuterDiv
/**
* Wrap a single element
*
* @param array $element Given element as documented above
* @param array $additionalPaletteClasses Additional classes to be added to HTML
* @return string Wrapped element
*/
protected function wrapSingleFieldContentWithLabelAndOuterDiv(array $element, array $additionalPaletteClasses = array())
{
$fieldName = $element['fieldName'];
$paletteFieldClasses = array('form-group', 't3js-formengine-validation-marker', 't3js-formengine-palette-field');
foreach ($additionalPaletteClasses as $class) {
$paletteFieldClasses[] = $class;
}
$label = BackendUtility::wrapInHelp($this->data['tableName'], $fieldName, htmlspecialchars($element['fieldLabel']));
$content = array();
$content[] = '<div class="' . implode(' ', $paletteFieldClasses) . '">';
$content[] = '<label class="t3js-formengine-label">';
$content[] = $label;
$content[] = '</label>';
$content[] = $element['fieldHtml'];
$content[] = '</div>';
return implode(LF, $content);
}
示例12: regularNew
/**
* Create a regular new element (pages and records)
*
* @return void
* @todo Define visibility
*/
public function regularNew()
{
$doNotShowFullDescr = FALSE;
// Initialize array for accumulating table rows:
$this->tRows = array();
// tree images
$halfLine = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/halfline.gif', 'width="18" height="8"') . ' alt="" />';
$firstLevel = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/join.gif', 'width="18" height="16"') . ' alt="" />';
$secondLevel = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/line.gif', 'width="18" height="16"') . ' alt="" />
<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/join.gif', 'width="18" height="16"') . ' alt="" />';
$secondLevelLast = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/line.gif', 'width="18" height="16"') . ' alt="" />
<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/joinbottom.gif', 'width="18" height="16"') . ' alt="" />';
// Get TSconfig for current page
$pageTS = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($this->id);
// Finish initializing new pages options with TSconfig
// Each new page option may be hidden by TSconfig
// Enabled option for the position of a new page
$this->newPagesSelectPosition = !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageSelectPosition']);
// Pseudo-boolean (0/1) for backward compatibility
$this->newPagesInto = !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageInside']) ? 1 : 0;
$this->newPagesAfter = !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageAfter']) ? 1 : 0;
// Slight spacer from header:
$this->code .= $halfLine;
// New Page
$table = 'pages';
$v = $GLOBALS['TCA'][$table];
$pageIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, array());
$newPageIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-new');
$rowContent = '';
// New pages INSIDE this pages
$newPageLinks = array();
if ($this->newPagesInto && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $GLOBALS['BE_USER']->check('tables_modify', 'pages') && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id, 'pages')) {
// Create link to new page inside:
$newPageLinks[] = $this->linkWrap(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, array()) . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1) . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.inside', 1) . ')', $table, $this->id);
}
// New pages AFTER this pages
if ($this->newPagesAfter && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $GLOBALS['BE_USER']->check('tables_modify', 'pages') && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) {
$newPageLinks[] = $this->linkWrap($pageIcon . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1) . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.after', 1) . ')', 'pages', -$this->id);
}
// New pages at selection position
if ($this->newPagesSelectPosition) {
// Link to page-wizard:
$newPageLinks[] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('pagesOnly' => 1))) . '">' . $pageIcon . htmlspecialchars($GLOBALS['LANG']->getLL('pageSelectPosition')) . '</a>';
}
// Assemble all new page links
$numPageLinks = count($newPageLinks);
for ($i = 0; $i < $numPageLinks; $i++) {
// For the last link, use the "branch bottom" icon
if ($i == $numPageLinks - 1) {
$treeComponent = $secondLevelLast;
} else {
$treeComponent = $secondLevel;
}
$rowContent .= '<br />' . $treeComponent . $newPageLinks[$i];
}
// Add row header and half-line if not empty
if (!empty($rowContent)) {
$rowContent .= '<br />' . $halfLine;
$rowContent = $firstLevel . $newPageIcon . ' <strong>' . $GLOBALS['LANG']->getLL('createNewPage') . '</strong>' . $rowContent;
}
// Compile table row to show the icon for "new page (select position)"
$startRows = array();
if ($this->showNewRecLink('pages') && !empty($rowContent)) {
$startRows[] = '
<tr>
<td nowrap="nowrap">' . $rowContent . '</td>
<td>' . \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($table, '') . '</td>
</tr>
';
}
// New tables (but not pages) INSIDE this pages
$isAdmin = $GLOBALS['BE_USER']->isAdmin();
$newContentIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new');
if ($this->newContentInto) {
if (is_array($GLOBALS['TCA'])) {
$groupName = '';
foreach ($GLOBALS['TCA'] as $table => $v) {
$count = count($GLOBALS['TCA'][$table]);
$counter = 1;
if ($table != 'pages' && $this->showNewRecLink($table) && $this->isTableAllowedForThisPage($this->pageinfo, $table) && $GLOBALS['BE_USER']->check('tables_modify', $table) && (($v['ctrl']['rootLevel'] xor $this->id) || $v['ctrl']['rootLevel'] == -1) && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id, $table)) {
$newRecordIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, array());
$rowContent = '';
// Create new link for record:
$newLink = $this->linkWrap($newRecordIcon . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1), $table, $this->id);
// If the table is 'tt_content' (from "cms" extension), create link to wizard
if ($table == 'tt_content') {
$groupName = $GLOBALS['LANG']->getLL('createNewContent');
$rowContent = $firstLevel . $newContentIcon . ' <strong>' . $GLOBALS['LANG']->getLL('createNewContent') . '</strong>';
// If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's wizard instead:
$overrideExt = $this->web_list_modTSconfig['properties']['newContentWiz.']['overrideWithExtension'];
$pathToWizard = \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($overrideExt) ? \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($overrideExt) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php';
$href = $pathToWizard . '?id=' . $this->id . '&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'));
$rowContent .= '<br />' . $secondLevel . $newLink . '<br />' . $secondLevelLast . '<a href="' . htmlspecialchars($href) . '">' . $newContentIcon . htmlspecialchars($GLOBALS['LANG']->getLL('clickForWizard')) . '</a>';
// Half-line added:
//.........这里部分代码省略.........
示例13: getAdditionalFields
/**
* Render additional information fields within the scheduler backend.
*
* @param array $taskInfo Array information of task to return
* @param ValidatorTask $task Task object
* @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the BE module of the Scheduler
* @return array Additional fields
* @see \TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface->getAdditionalFields($taskInfo, $task, $schedulerModule)
*/
public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule)
{
$additionalFields = array();
if (empty($taskInfo['configuration'])) {
if ($schedulerModule->CMD == 'add') {
$taskInfo['configuration'] = '';
} elseif ($schedulerModule->CMD == 'edit') {
$taskInfo['configuration'] = $task->getConfiguration();
} else {
$taskInfo['configuration'] = $task->getConfiguration();
}
}
if (empty($taskInfo['depth'])) {
if ($schedulerModule->CMD == 'add') {
$taskInfo['depth'] = array();
} elseif ($schedulerModule->CMD == 'edit') {
$taskInfo['depth'] = $task->getDepth();
} else {
$taskInfo['depth'] = $task->getDepth();
}
}
if (empty($taskInfo['page'])) {
if ($schedulerModule->CMD == 'add') {
$taskInfo['page'] = '';
} elseif ($schedulerModule->CMD == 'edit') {
$taskInfo['page'] = $task->getPage();
} else {
$taskInfo['page'] = $task->getPage();
}
}
if (empty($taskInfo['email'])) {
if ($schedulerModule->CMD == 'add') {
$taskInfo['email'] = '';
} elseif ($schedulerModule->CMD == 'edit') {
$taskInfo['email'] = $task->getEmail();
} else {
$taskInfo['email'] = $task->getEmail();
}
}
if (empty($taskInfo['emailOnBrokenLinkOnly'])) {
if ($schedulerModule->CMD == 'add') {
$taskInfo['emailOnBrokenLinkOnly'] = 1;
} elseif ($schedulerModule->CMD == 'edit') {
$taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
} else {
$taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
}
}
if (empty($taskInfo['emailTemplateFile'])) {
if ($schedulerModule->CMD == 'add') {
$taskInfo['emailTemplateFile'] = 'EXT:linkvalidator/Resources/Private/Templates/mailtemplate.html';
} elseif ($schedulerModule->CMD == 'edit') {
$taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
} else {
$taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
}
}
$fieldId = 'task_page';
$fieldCode = '<input type="text" name="tx_scheduler[linkvalidator][page]" id="' . $fieldId . '" value="' . htmlspecialchars($taskInfo['page']) . '"/>';
$label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.validate.page');
$label = BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
$additionalFields[$fieldId] = array('code' => $fieldCode, 'label' => $label);
// input for depth
$fieldId = 'task_depth';
$fieldValueArray = array('0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_0'), '1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_1'), '2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_2'), '3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_3'), '4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_4'), '999' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_infi'));
$fieldCode = '<select name="tx_scheduler[linkvalidator][depth]" id="' . $fieldId . '">';
foreach ($fieldValueArray as $depth => $label) {
$fieldCode .= "\t" . '<option value="' . htmlspecialchars($depth) . '"' . ($depth == $taskInfo['depth'] ? ' selected="selected"' : '') . '>' . $label . '</option>';
}
$fieldCode .= '</select>';
$label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.validate.depth');
$label = BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
$additionalFields[$fieldId] = array('code' => $fieldCode, 'label' => $label);
$fieldId = 'task_configuration';
$fieldCode = '<textarea name="tx_scheduler[linkvalidator][configuration]" id="' . $fieldId . '" >' . htmlspecialchars($taskInfo['configuration']) . '</textarea>';
$label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.validate.conf');
$label = BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
$additionalFields[$fieldId] = array('code' => $fieldCode, 'label' => $label);
$fieldId = 'task_email';
$fieldCode = '<input type="text" name="tx_scheduler[linkvalidator][email]" id="' . $fieldId . '" value="' . htmlspecialchars($taskInfo['email']) . '" />';
$label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.validate.email');
$label = BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
$additionalFields[$fieldId] = array('code' => $fieldCode, 'label' => $label);
$fieldId = 'task_emailOnBrokenLinkOnly';
$fieldCode = '<input type="checkbox" name="tx_scheduler[linkvalidator][emailOnBrokenLinkOnly]" id="' . $fieldId . '" ' . (htmlspecialchars($taskInfo['emailOnBrokenLinkOnly']) ? 'checked="checked"' : '') . ' />';
$label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.validate.emailOnBrokenLinkOnly');
$label = BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
$additionalFields[$fieldId] = array('code' => $fieldCode, 'label' => $label);
$fieldId = 'task_emailTemplateFile';
$fieldCode = '<input type="text" name="tx_scheduler[linkvalidator][emailTemplateFile]" id="' . $fieldId . '" value="' . htmlspecialchars($taskInfo['emailTemplateFile']) . '" />';
$label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.validate.emailTemplateFile');
//.........这里部分代码省略.........
示例14: render
/**
* Render check boxes
*
* @return array As defined in initializeResultArray() of AbstractNode
*/
public function render()
{
$html = [];
// Field configuration from TCA:
$parameterArray = $this->data['parameterArray'];
$config = $parameterArray['fieldConf']['config'];
$disabled = !empty($config['readOnly']);
$selItems = $config['items'];
if (!empty($selItems)) {
// Get values in an array (and make unique, which is fine because there can be no duplicates anyway):
$itemArray = array_flip($parameterArray['itemFormElValue']);
// Traverse the Array of selector box items:
$groups = array();
$currentGroup = 0;
$c = 0;
$sOnChange = '';
if (!$disabled) {
$sOnChange = implode('', $parameterArray['fieldChangeFunc']);
// Used to accumulate the JS needed to restore the original selection.
foreach ($selItems as $p) {
// Non-selectable element:
if ($p[1] === '--div--') {
$selIcon = '';
if (isset($p[2]) && $p[2] != 'empty-empty') {
$selIcon = FormEngineUtility::getIconHtml($p[2]);
}
$currentGroup++;
$groups[$currentGroup]['header'] = array('icon' => $selIcon, 'title' => htmlspecialchars($p[0]));
} else {
// Check if some help text is available
// Since TYPO3 4.5 help text is expected to be an associative array
// with two key, "title" and "description"
// For the sake of backwards compatibility, we test if the help text
// is a string and use it as a description (this could happen if items
// are modified with an itemProcFunc)
$hasHelp = false;
$help = '';
$helpArray = array();
if (!empty($p[3])) {
$hasHelp = true;
if (is_array($p[3])) {
$helpArray = $p[3];
} else {
$helpArray['description'] = $p[3];
}
}
if ($hasHelp) {
$help = BackendUtility::wrapInHelp('', '', '', $helpArray);
}
// Selected or not by default:
$checked = 0;
if (isset($itemArray[$p[1]])) {
$checked = 1;
unset($itemArray[$p[1]]);
}
// Build item array
$groups[$currentGroup]['items'][] = array('id' => StringUtility::getUniqueId('select_checkbox_row_'), 'name' => $parameterArray['itemFormElName'] . '[' . $c . ']', 'value' => $p[1], 'checked' => $checked, 'disabled' => false, 'class' => '', 'icon' => !empty($p[2]) ? FormEngineUtility::getIconHtml($p[2]) : $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render(), 'title' => htmlspecialchars($p[0], ENT_COMPAT, 'UTF-8', false), 'help' => $help);
$c++;
}
}
}
// Add an empty hidden field which will send a blank value if all items are unselected.
$html[] = '<input type="hidden" class="select-checkbox" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '" value="">';
// Building the checkboxes
foreach ($groups as $groupKey => $group) {
$groupId = htmlspecialchars($parameterArray['itemFormElID']) . '-group-' . $groupKey;
$html[] = '<div class="panel panel-default">';
if (is_array($group['header'])) {
$html[] = '<div class="panel-heading">';
$html[] = '<a data-toggle="collapse" href="#' . $groupId . '" aria-expanded="false" aria-controls="' . $groupId . '">';
$html[] = $group['header']['icon'];
$html[] = $group['header']['title'];
$html[] = '</a>';
$html[] = '</div>';
}
if (is_array($group['items']) && !empty($group['items'])) {
$tableRows = [];
$checkGroup = array();
$uncheckGroup = array();
$resetGroup = array();
// Render rows
foreach ($group['items'] as $item) {
$tableRows[] = '<tr class="' . $item['class'] . '">';
$tableRows[] = '<td class="col-checkbox">';
$tableRows[] = '<input type="checkbox" ' . 'id="' . $item['id'] . '" ' . 'name="' . htmlspecialchars($item['name']) . '" ' . 'value="' . htmlspecialchars($item['value']) . '" ' . 'onclick="' . htmlspecialchars($sOnChange) . '" ' . ($item['checked'] ? 'checked=checked ' : '') . ($item['disabled'] ? 'disabled=disabled ' : '') . $parameterArray['onFocus'] . '>';
$tableRows[] = '</td>';
$tableRows[] = '<td class="col-icon">';
$tableRows[] = '<label class="label-block" for="' . $item['id'] . '">' . $item['icon'] . '</label>';
$tableRows[] = '</td>';
$tableRows[] = '<td class="col-title">';
$tableRows[] = '<label class="label-block" for="' . $item['id'] . '">' . $item['title'] . '</label>';
$tableRows[] = '</td>';
$tableRows[] = '<td>' . $item['help'] . '</td>';
$tableRows[] = '</tr>';
$checkGroup[] = 'document.editform[' . GeneralUtility::quoteJSvalue($item['name']) . '].checked=1;';
//.........这里部分代码省略.........
示例15: getSingleField_typeSelect_checkbox
/**
* Creates a checkbox list (renderMode = "checkbox")
*
* @param string $table See getSingleField_typeSelect()
* @param string $field See getSingleField_typeSelect()
* @param array $row See getSingleField_typeSelect()
* @param array $parameterArray See getSingleField_typeSelect()
* @param array $config (Redundant) content of $PA['fieldConf']['config'] (for convenience)
* @param array $selItems Items available for selection
* @param string $noMatchingLabel Label for no-matching-value
* @return string The HTML code for the item
*/
protected function getSingleField_typeSelect_checkbox($table, $field, $row, $parameterArray, $config, $selItems, $noMatchingLabel)
{
if (empty($selItems)) {
return '';
}
// Get values in an array (and make unique, which is fine because there can be no duplicates anyway):
$itemArray = array_flip(FormEngineUtility::extractValuesOnlyFromValueLabelList($parameterArray['itemFormElValue']));
$output = '';
// Disabled
$disabled = 0;
if ($this->isGlobalReadonly() || $config['readOnly']) {
$disabled = 1;
}
// Traverse the Array of selector box items:
$groups = array();
$currentGroup = 0;
$c = 0;
$sOnChange = '';
if (!$disabled) {
$sOnChange = implode('', $parameterArray['fieldChangeFunc']);
// Used to accumulate the JS needed to restore the original selection.
foreach ($selItems as $p) {
// Non-selectable element:
if ($p[1] === '--div--') {
$selIcon = '';
if (isset($p[2]) && $p[2] != 'empty-empty') {
$selIcon = FormEngineUtility::getIconHtml($p[2]);
}
$currentGroup++;
$groups[$currentGroup]['header'] = array('icon' => $selIcon, 'title' => htmlspecialchars($p[0]));
} else {
// Check if some help text is available
// Since TYPO3 4.5 help text is expected to be an associative array
// with two key, "title" and "description"
// For the sake of backwards compatibility, we test if the help text
// is a string and use it as a description (this could happen if items
// are modified with an itemProcFunc)
$hasHelp = FALSE;
$help = '';
$helpArray = array();
if (!empty($p[3])) {
$hasHelp = TRUE;
if (is_array($p[3])) {
$helpArray = $p[3];
} else {
$helpArray['description'] = $p[3];
}
}
if ($hasHelp) {
$help = BackendUtility::wrapInHelp('', '', '', $helpArray);
}
// Selected or not by default:
$checked = 0;
if (isset($itemArray[$p[1]])) {
$checked = 1;
unset($itemArray[$p[1]]);
}
// Build item array
$groups[$currentGroup]['items'][] = array('id' => str_replace('.', '', uniqid('select_checkbox_row_', TRUE)), 'name' => $parameterArray['itemFormElName'] . '[' . $c . ']', 'value' => $p[1], 'checked' => $checked, 'disabled' => $disabled, 'class' => '', 'icon' => !empty($p[2]) ? FormEngineUtility::getIconHtml($p[2]) : IconUtility::getSpriteIcon('empty-empty'), 'title' => htmlspecialchars($p[0], ENT_COMPAT, 'UTF-8', FALSE), 'help' => $help);
$c++;
}
}
}
// Remaining values (invalid):
if (!empty($itemArray) && !$parameterArray['fieldTSConfig']['disableNoMatchingValueElement'] && !$config['disableNoMatchingValueElement']) {
$currentGroup++;
foreach ($itemArray as $theNoMatchValue => $temp) {
// Build item array
$groups[$currentGroup]['items'][] = array('id' => str_replace('.', '', uniqid('select_checkbox_row_', TRUE)), 'name' => $parameterArray['itemFormElName'] . '[' . $c . ']', 'value' => $theNoMatchValue, 'checked' => 1, 'disabled' => $disabled, 'class' => 'danger', 'icon' => '', 'title' => htmlspecialchars(@sprintf($noMatchingLabel, $theNoMatchValue), ENT_COMPAT, 'UTF-8', FALSE), 'help' => '');
$c++;
}
}
// Add an empty hidden field which will send a blank value if all items are unselected.
$output .= '<input type="hidden" class="select-checkbox" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '" value="" />';
// Building the checkboxes
foreach ($groups as $groupKey => $group) {
$groupId = htmlspecialchars($parameterArray['itemFormElID']) . '-group-' . $groupKey;
$output .= '<div class="panel panel-default">';
if (is_array($group['header'])) {
$output .= '
<div class="panel-heading">
<a data-toggle="collapse" href="#' . $groupId . '" aria-expanded="true" aria-controls="' . $groupId . '">
' . $group['header']['icon'] . '
' . $group['header']['title'] . '
</a>
</div>
';
}
//.........这里部分代码省略.........