本文整理汇总了PHP中TYPO3\CMS\Backend\Template\DocumentTemplate::formWidth方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentTemplate::formWidth方法的具体用法?PHP DocumentTemplate::formWidth怎么用?PHP DocumentTemplate::formWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Template\DocumentTemplate
的用法示例。
在下文中一共展示了DocumentTemplate::formWidth方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Main Method, rendering either colorpicker or frameset depending on ->showPicker
*
* @return void
*/
public function main()
{
// Show frameset by default:
if (!GeneralUtility::_GP('showPicker')) {
$this->frameSet();
} else {
// Putting together the items into a form:
$content = '
<form name="colorform" method="post" action="' . htmlspecialchars(BackendUtility::getModuleUrl('wizard_colorpicker')) . '">
' . $this->colorMatrix() . '
' . $this->colorList() . '
' . $this->colorImage() . '
<!-- Value box: -->
<p class="c-head">' . $GLOBALS['LANG']->getLL('colorpicker_colorValue', TRUE) . '</p>
<table border="0" cellpadding="0" cellspacing="3">
<tr>
<td><input type="text" ' . $this->doc->formWidth(7) . ' maxlength="10" name="colorValue" value="' . htmlspecialchars($this->colorValue) . '" /></td>
<td style="background-color:' . htmlspecialchars($this->colorValue) . '; border: 1px solid black;"> <span style="color: black;">' . $GLOBALS['LANG']->getLL('colorpicker_black', TRUE) . '</span> <span style="color: white;">' . $GLOBALS['LANG']->getLL('colorpicker_white', TRUE) . '</span> </td>
<td><input type="submit" name="save_close" value="' . $GLOBALS['LANG']->getLL('colorpicker_setClose', TRUE) . '" /></td>
</tr>
</table>
<!-- Hidden fields with values that has to be kept constant -->
<input type="hidden" name="showPicker" value="1" />
<input type="hidden" name="fieldChangeFunc" value="' . htmlspecialchars($this->fieldChangeFunc) . '" />
<input type="hidden" name="fieldChangeFuncHash" value="' . htmlspecialchars($this->fieldChangeFuncHash) . '" />
<input type="hidden" name="fieldName" value="' . htmlspecialchars($this->fieldName) . '" />
<input type="hidden" name="formName" value="' . htmlspecialchars($this->formName) . '" />
<input type="hidden" name="md5ID" value="' . htmlspecialchars($this->md5ID) . '" />
<input type="hidden" name="exampleImg" value="' . htmlspecialchars($this->exampleImg) . '" />
</form>';
// If the save/close button is clicked, then close:
if (GeneralUtility::_GP('save_close')) {
$content .= $this->doc->wrapScriptTags('
setValue(' . GeneralUtility::quoteJSvalue($this->colorValue) . ');
parent.close();
');
}
// Output:
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('colorpicker_title'), $content, 0, 1);
}
}
示例2: createFolder
/**
* For TBE: Makes a form for creating new folders in the filemount the user is browsing.
* The folder creation request is sent to the tce_file.php script in the core which will handle the creation.
*
* @param Folder $folderObject Absolute filepath on server in which to create the new folder.
* @return string HTML for the create folder form.
* @todo Define visibility
*/
public function createFolder(Folder $folderObject)
{
if (!$folderObject->checkActionPermission('write')) {
return '';
}
if (!($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB'))) {
return '';
}
// Don't show Folder-create form if it's denied
if ($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.hideCreateFolder')) {
return '';
}
// Create header, showing upload path:
$header = $folderObject->getIdentifier();
$code = '
<!--
Form, for creating new folders:
-->
<form action="' . $GLOBALS['BACK_PATH'] . 'tce_file.php" method="post" name="editform2" id="typo3-crFolderForm">
<table border="0" cellpadding="0" cellspacing="0" id="typo3-crFolder">
<tr>
<td>' . $this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle') . ':') . '</td>
</tr>
<tr>
<td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', TRUE) . ':</strong> ' . htmlspecialchars($header) . '</td>
</tr>
<tr>
<td class="c-wCell c-hCell">';
// Create the new-folder name field:
$a = 1;
$code .= '<input' . $this->doc->formWidth(20) . ' type="text" name="file[newfolder][' . $a . '][data]" />' . '<input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($folderObject->getCombinedIdentifier()) . '" />';
// Make footer of upload form, including the submit button:
$redirectValue = $this->getThisScript() . 'act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams);
$code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '<input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" />';
$code .= '</td>
</tr>
</table>
</form>';
return $code;
}
示例3: main
/**
* Main function, redering the actual content of the editing page
*
* @return void
*/
public function main()
{
$docHeaderButtons = $this->getButtons();
$this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle'));
// Hook before compiling the output
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'])) {
$preOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'];
if (is_array($preOutputProcessingHook)) {
$hookParameters = array('content' => &$this->content, 'target' => &$this->target);
foreach ($preOutputProcessingHook as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
}
}
$pageContent = $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle') . ' ' . htmlspecialchars($this->fileObject->getName()));
$pageContent .= $this->doc->spacer(2);
$code = '';
$extList = $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'];
try {
if (!$extList || !GeneralUtility::inList($extList, $this->fileObject->getExtension())) {
throw new \Exception('Files with that extension are not editable.');
}
// Read file content to edit:
$fileContent = $this->fileObject->getContents();
// Making the formfields
$hValue = BackendUtility::getModuleUrl('file_edit', array('target' => $this->origTarget, 'returnUrl' => $this->returnUrl));
// Edit textarea:
$code .= '
<div id="c-edit">
<textarea rows="30" name="file[editfile][0][data]" wrap="off" ' . $this->doc->formWidth(48, TRUE, 'width:98%;height:80%') . ' class="text-monospace t3js-enable-tab">' . GeneralUtility::formatForTextarea($fileContent) . '</textarea>
<input type="hidden" name="file[editfile][0][target]" value="' . $this->fileObject->getUid() . '" />
<input type="hidden" name="redirect" value="' . htmlspecialchars($hValue) . '" />
' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
</div>
<br />';
// Make shortcut:
if ($this->getBackendUser()->mayMakeShortcut()) {
$docHeaderButtons['shortcut'] = $this->doc->makeShortcutIcon('target', '', 'file_edit', 1);
} else {
$docHeaderButtons['shortcut'] = '';
}
} catch (\Exception $e) {
$code .= sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.coundNot'), $extList);
}
// Ending of section and outputting editing form:
$pageContent .= $this->doc->sectionEnd();
$pageContent .= $code;
// Hook after compiling the output
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'])) {
$postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'];
if (is_array($postOutputProcessingHook)) {
$hookParameters = array('pageContent' => &$pageContent, 'target' => &$this->target);
foreach ($postOutputProcessingHook as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
}
}
// Add the HTML as a section:
$markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'BUTTONS' => $docHeaderButtons, 'PATH' => $this->title, 'CONTENT' => $pageContent);
$this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
示例4: main
/**
* Main Method, rendering either colorpicker or frameset depending on ->showPicker
*
* @return void
*/
public function main()
{
// Show frameset by default:
if (!GeneralUtility::_GP('showPicker')) {
$this->frameSet();
} else {
// Putting together the items into a form:
$content = '
<form name="colorform" method="post" action="' . htmlspecialchars(BackendUtility::getModuleUrl('wizard_colorpicker')) . '">
' . $this->colorMatrix() . '
' . $this->colorList() . '
' . $this->colorImage() . '
<!-- Value box: -->
<p class="c-head">' . $this->getLanguageService()->getLL('colorpicker_colorValue', true) . '</p>
<table border="0" cellpadding="0" cellspacing="3">
<tr>
<td>
<input id="colorValue" type="text" ' . $this->doc->formWidth(7) . ' maxlength="10" name="colorValue" value="' . htmlspecialchars($this->colorValue) . '" />
</td>
<td style="background-color:' . htmlspecialchars($this->colorValue) . '; border: 1px solid black;">
<span style="color: black;">' . $this->getLanguageService()->getLL('colorpicker_black', true) . '</span> <span style="color: white;">' . $this->getLanguageService()->getLL('colorpicker_white', true) . '</span>
</td>
<td>
<input class="btn btn-default" type="submit" id="colorpicker-saveclose" value="' . $this->getLanguageService()->getLL('colorpicker_setClose', true) . '" />
</td>
</tr>
</table>
<!-- Hidden fields with values that has to be kept constant -->
<input type="hidden" name="showPicker" value="1" />
<input type="hidden" name="fieldChangeFunc" value="' . htmlspecialchars($this->fieldChangeFunc) . '" />
<input type="hidden" name="fieldChangeFuncHash" value="' . htmlspecialchars($this->fieldChangeFuncHash) . '" />
<input type="hidden" name="fieldName" value="' . htmlspecialchars($this->fieldName) . '" />
<input type="hidden" name="formName" value="' . htmlspecialchars($this->formName) . '" />
<input type="hidden" name="md5ID" value="' . htmlspecialchars($this->md5ID) . '" />
<input type="hidden" name="exampleImg" value="' . htmlspecialchars($this->exampleImg) . '" />
</form>';
$this->content .= $this->doc->section($this->getLanguageService()->getLL('colorpicker_title'), $content, false, true);
}
}
示例5: editLoadedFunc
/**
* Creates lines for the editing form.
*
* @return void
* @todo Define visibility
*/
public function editLoadedFunc()
{
$this->editLoaded = 0;
// sc_group numbers below 0 requires admin to edit those. sc_group
// numbers above zero must always be owned by the user himself.
if (is_array($this->editSC_rec) && ($this->editSC_rec['sc_group'] >= 0 || $GLOBALS['BE_USER']->isAdmin())) {
$this->editLoaded = 1;
$opt = array();
$opt[] = '<option value="0"></option>';
foreach ($this->groupLabels as $k => $v) {
if ($v && strcmp('1', $v)) {
$label = $v;
} else {
$label = $GLOBALS['LANG']->getLL('bookmark_group_' . $k, 1);
// Fallback label
if (!$label) {
$label = $GLOBALS['LANG']->getLL('bookmark_group', 1) . ' ' . $k;
}
}
$opt[] = '<option value="' . $k . '"' . (!strcmp($this->editSC_rec['sc_group'], $k) ? ' selected="selected"' : '') . '>' . $label . '</option>';
}
if ($GLOBALS['BE_USER']->isAdmin()) {
foreach ($this->groupLabels as $k => $v) {
if ($v && strcmp('1', $v)) {
$label = $v;
} else {
$label = $GLOBALS['LANG']->getLL('bookmark_group_' . $k, 1);
// Fallback label
if (!$label) {
$label = $GLOBALS['LANG']->getLL('bookmark_group', 1) . ' ' . $k;
}
}
// Add a prefix for global groups
$label = $GLOBALS['LANG']->getLL('bookmark_global', 1) . ': ' . $label;
$opt[] = '<option value="-' . $k . '"' . (!strcmp($this->editSC_rec['sc_group'], '-' . $k) ? ' selected="selected"' : '') . '>' . $label . '</option>';
}
$opt[] = '<option value="-100"' . (!strcmp($this->editSC_rec['sc_group'], '-100') ? ' selected="selected"' : '') . '>' . $GLOBALS['LANG']->getLL('bookmark_global', 1) . ': ' . $GLOBALS['LANG']->getLL('bookmark_all', 1) . '</option>';
}
// border="0" hspace="2" width="21" height="16" - not XHTML compliant in <input type="image" ...>
$manageForm = '
<!--
Shortcut Editing Form:
-->
<table border="0" cellpadding="0" cellspacing="0" id="typo3-shortcuts-editing">
<tr>
<td> </td>
<td><input type="image" class="c-inputButton" name="_savedok"' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/savedok.gif', '') . ' title="' . $GLOBALS['LANG']->getLL('shortcut_save', 1) . '" /></td>
<td><input type="image" class="c-inputButton" name="_saveclosedok"' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/saveandclosedok.gif', '') . ' title="' . $GLOBALS['LANG']->getLL('bookmark_saveClose', 1) . '" /></td>
<td><input type="image" class="c-inputButton" name="_closedok"' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/closedok.gif', '') . ' title="' . $GLOBALS['LANG']->getLL('bookmark_close', 1) . '" /></td>
<td><input type="image" class="c-inputButton" name="_deletedok"' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/deletedok.gif', '') . ' title="' . $GLOBALS['LANG']->getLL('bookmark_delete', 1) . '" /></td>
<td><input name="editName" type="text" value="' . htmlspecialchars($this->editSC_rec['description']) . '"' . $this->doc->formWidth(15) . ' /></td>
<td><select name="editGroup">' . implode('', $opt) . '</select></td>
</tr>
</table>
<input type="hidden" name="whichItem" value="' . $this->editSC_rec['uid'] . '" />
';
} else {
$manageForm = '';
}
if (!$this->editLoaded && count($this->selOpt) > 1) {
$this->lines[] = '<td> </td>';
$this->lines[] = '<td><select name="_selSC" onchange="eval(this.options[this.selectedIndex].value);this.selectedIndex=0;">' . implode('', $this->selOpt) . '</select></td>';
}
// $this->linesPre contains elements with sc_group>=0
$this->lines = array_merge($this->linesPre, $this->lines);
if (count($this->lines)) {
if (!$GLOBALS['BE_USER']->getTSConfigVal('options.mayNotCreateEditBookmarks')) {
$this->lines = array_merge(array('<td><input type="checkbox" id="editShortcut_check" name="editShortcut_check" value="1"' . ($this->editSC ? ' checked="checked"' : '') . ' />' . ' <label for="editShortcut_check">' . $GLOBALS['LANG']->getLL('bookmark_edit', 1) . '</label> </td>'), $this->lines);
$this->lines[] = '<td>' . $manageForm . '</td>';
}
$this->lines[] = '<td><img src="clear.gif" width="10" height="1" alt="" /></td>';
}
}
示例6: getFormHTML
/**
* Creates the HTML for the Form Wizard:
*
* @param string $formCfgArray Form config array
* @param array $row Current parent record array
* @return string HTML for the form wizard
* @access private
*/
public function getFormHTML($formCfgArray, $row)
{
// Initialize variables:
$specParts = array();
$hiddenFields = array();
$tRows = array();
// Set header row:
$cells = array($this->getLanguageService()->getLL('forms_preview', TRUE) . ':', $this->getLanguageService()->getLL('forms_element', TRUE) . ':', $this->getLanguageService()->getLL('forms_config', TRUE) . ':');
$tRows[] = '
<tr class="bgColor2" id="typo3-formWizardHeader">
<td> </td>
<td><strong>' . implode('</strong></td>
<td><strong>', $cells) . '</strong></td>
</tr>';
// Traverse the number of form elements:
$k = 0;
foreach ($formCfgArray as $confData) {
// Initialize:
$cells = array();
// If there is a configuration line which is active, then render it:
if (!isset($confData['comment'])) {
// Special parts:
if ($this->special == 'formtype_mail' && GeneralUtility::inList('formtype_mail,subject,html_enabled', $confData['fieldname'])) {
$specParts[$confData['fieldname']] = $confData['default'];
} else {
// Render title/field preview COLUMN
$cells[] = $confData['type'] != 'hidden' ? '<strong>' . htmlspecialchars($confData['label']) . '</strong>' : '';
// Render general type/title COLUMN:
$temp_cells = array();
// Field type selector:
$opt = array();
$opt[] = '<option value=""></option>';
$types = explode(',', 'input,textarea,select,check,radio,password,file,hidden,submit,property,label');
foreach ($types as $t) {
$opt[] = '
<option value="' . $t . '"' . ($confData['type'] == $t ? ' selected="selected"' : '') . '>' . $this->getLanguageService()->getLL('forms_type_' . $t, TRUE) . '</option>';
}
$temp_cells[$this->getLanguageService()->getLL('forms_type')] = '
<select name="FORMCFG[c][' . ($k + 1) * 2 . '][type]">
' . implode('
', $opt) . '
</select>';
// Title field:
if (!GeneralUtility::inList('hidden,submit', $confData['type'])) {
$temp_cells[$this->getLanguageService()->getLL('forms_label')] = '<input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][label]" value="' . htmlspecialchars($confData['label']) . '" />';
}
// Required checkbox:
if (!GeneralUtility::inList('check,hidden,submit,label', $confData['type'])) {
$temp_cells[$this->getLanguageService()->getLL('forms_required')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][required]" value="1"' . ($confData['required'] ? ' checked="checked"' : '') . ' title="' . $this->getLanguageService()->getLL('forms_required', TRUE) . '" />';
}
// Put sub-items together into table cell:
$cells[] = $this->formatCells($temp_cells);
// Render specific field configuration COLUMN:
$temp_cells = array();
// Fieldname
if ($this->special == 'formtype_mail' && $confData['type'] == 'file') {
$confData['fieldname'] = 'attachment' . ++$this->attachmentCounter;
}
if (!GeneralUtility::inList('label', $confData['type'])) {
$temp_cells[$this->getLanguageService()->getLL('forms_fieldName')] = '<input type="text"' . $this->doc->formWidth(10) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][fieldname]" value="' . htmlspecialchars($confData['fieldname']) . '" title="' . $this->getLanguageService()->getLL('forms_fieldName', TRUE) . '" />';
}
// Field configuration depending on the fields type:
switch ((string) $confData['type']) {
case 'textarea':
$temp_cells[$this->getLanguageService()->getLL('forms_cols')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][cols]" value="' . htmlspecialchars($confData['cols']) . '" title="' . $this->getLanguageService()->getLL('forms_cols', TRUE) . '" />';
$temp_cells[$this->getLanguageService()->getLL('forms_rows')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][rows]" value="' . htmlspecialchars($confData['rows']) . '" title="' . $this->getLanguageService()->getLL('forms_rows', TRUE) . '" />';
$temp_cells[$this->getLanguageService()->getLL('forms_extra')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][extra]" value="OFF"' . ($confData['extra'] == 'OFF' ? ' checked="checked"' : '') . ' title="' . $this->getLanguageService()->getLL('forms_extra', TRUE) . '" />';
break;
case 'input':
case 'password':
$temp_cells[$this->getLanguageService()->getLL('forms_size')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][size]" value="' . htmlspecialchars($confData['size']) . '" title="' . $this->getLanguageService()->getLL('forms_size', TRUE) . '" />';
$temp_cells[$this->getLanguageService()->getLL('forms_max')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][max]" value="' . htmlspecialchars($confData['max']) . '" title="' . $this->getLanguageService()->getLL('forms_max', TRUE) . '" />';
break;
case 'file':
$temp_cells[$this->getLanguageService()->getLL('forms_size')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][size]" value="' . htmlspecialchars($confData['size']) . '" title="' . $this->getLanguageService()->getLL('forms_size', TRUE) . '" />';
break;
case 'select':
$temp_cells[$this->getLanguageService()->getLL('forms_size')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][size]" value="' . htmlspecialchars($confData['size']) . '" title="' . $this->getLanguageService()->getLL('forms_size', TRUE) . '" />';
$temp_cells[$this->getLanguageService()->getLL('forms_autosize')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][autosize]" value="1"' . ($confData['autosize'] ? ' checked="checked"' : '') . ' title="' . $this->getLanguageService()->getLL('forms_autosize', TRUE) . '" />';
$temp_cells[$this->getLanguageService()->getLL('forms_multiple')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][multiple]" value="1"' . ($confData['multiple'] ? ' checked="checked"' : '') . ' title="' . $this->getLanguageService()->getLL('forms_multiple', TRUE) . '" />';
break;
}
// Field configuration depending on the fields type:
switch ((string) $confData['type']) {
case 'textarea':
case 'input':
case 'password':
if (trim($confData['specialEval']) !== '') {
$hiddenFields[] = '<input type="hidden" name="FORMCFG[c][' . ($k + 1) * 2 . '][specialEval]" value="' . htmlspecialchars($confData['specialEval']) . '" />';
}
break;
}
//.........这里部分代码省略.........
示例7: getTableHTML
/**
* Creates the HTML for the Table Wizard:
*
* @param array $configuration Table config array
* @return string HTML for the table wizard
* @internal
*/
public function getTableHTML($configuration)
{
// Traverse the rows:
$tRows = array();
$k = 0;
$countLines = count($configuration);
foreach ($configuration as $cellArr) {
if (is_array($cellArr)) {
// Initialize:
$cells = array();
$a = 0;
// Traverse the columns:
foreach ($cellArr as $cellContent) {
if ($this->inputStyle) {
$cells[] = '<input class="form-control" type="text"' . $this->doc->formWidth(20) . ' name="TABLE[c][' . ($k + 1) * 2 . '][' . ($a + 1) * 2 . ']" value="' . htmlspecialchars($cellContent) . '" />';
} else {
$cellContent = preg_replace('/<br[ ]?[\\/]?>/i', LF, $cellContent);
$cells[] = '<textarea class="form-control" ' . $this->doc->formWidth(20) . ' rows="6" name="TABLE[c][' . ($k + 1) * 2 . '][' . ($a + 1) * 2 . ']">' . GeneralUtility::formatForTextarea($cellContent) . '</textarea>';
}
// Increment counter:
$a++;
}
// CTRL panel for a table row (move up/down/around):
$onClick = 'document.wizardForm.action+=' . GeneralUtility::quoteJSvalue('#ANC_' . (($k + 1) * 2 - 2)) . ';';
$onClick = ' onclick="' . htmlspecialchars($onClick) . '"';
$ctrl = '';
if ($k !== 0) {
$ctrl .= '<button class="btn btn-default" name="TABLE[row_up][' . ($k + 1) * 2 . ']" title="' . $this->getLanguageService()->getLL('table_up', TRUE) . '"' . $onClick . '><span class="t3-icon fa fa-fw fa-angle-up"></span></button>';
} else {
$ctrl .= '<button class="btn btn-default" name="TABLE[row_bottom][' . ($k + 1) * 2 . ']" title="' . $this->getLanguageService()->getLL('table_bottom', TRUE) . '"' . $onClick . '><span class="t3-icon fa fa-fw fa-angle-double-down"></span></button>';
}
if ($k + 1 !== $countLines) {
$ctrl .= '<button class="btn btn-default" name="TABLE[row_down][' . ($k + 1) * 2 . ']" title="' . $this->getLanguageService()->getLL('table_down', TRUE) . '"' . $onClick . '><span class="t3-icon fa fa-fw fa-angle-down"></span></button>';
} else {
$ctrl .= '<button class="btn btn-default" name="TABLE[row_top][' . ($k + 1) * 2 . ']" title="' . $this->getLanguageService()->getLL('table_top', TRUE) . '"' . $onClick . '><span class="t3-icon fa fa-fw fa-angle-double-up"></span></button>';
}
$ctrl .= '<button class="btn btn-default" name="TABLE[row_remove][' . ($k + 1) * 2 . ']" title="' . $this->getLanguageService()->getLL('table_removeRow', TRUE) . '"' . $onClick . '><span class="t3-icon fa fa-fw fa-trash"></span></button>';
$ctrl .= '<button class="btn btn-default" name="TABLE[row_add][' . ($k + 1) * 2 . ']" title="' . $this->getLanguageService()->getLL('table_addRow', TRUE) . '"' . $onClick . '><span class="t3-icon fa fa-fw fa-plus"></span></button>';
$tRows[] = '
<tr>
<td>
<a name="ANC_' . ($k + 1) * 2 . '"></a>
<span class="btn-group' . ($this->inputStyle ? '' : '-vertical') . '">' . $ctrl . '</span>
</td>
<td>' . implode('</td>
<td>', $cells) . '</td>
</tr>';
// Increment counter:
$k++;
}
}
// CTRL panel for a table column (move left/right/around/delete)
$cells = array();
$cells[] = '';
// Finding first row:
$firstRow = reset($configuration);
if (is_array($firstRow)) {
$cols = count($firstRow);
for ($a = 1; $a <= $cols; $a++) {
$b = $a * 2;
$ctrl = '';
if ($a !== 1) {
$ctrl .= '<button class="btn btn-default" name="TABLE[col_left][' . $b . ']" title="' . $this->getLanguageService()->getLL('table_left', TRUE) . '"><span class="t3-icon fa fa-fw fa-angle-left"></span></button>';
} else {
$ctrl .= '<button class="btn btn-default" name="TABLE[col_end][' . $b . ']" title="' . $this->getLanguageService()->getLL('table_end', TRUE) . '"><span class="t3-icon fa fa-fw fa-angle-double-right"></span></button>';
}
if ($a != $cols) {
$ctrl .= '<button class="btn btn-default" name="TABLE[col_right][' . $b . ']" title="' . $this->getLanguageService()->getLL('table_right', TRUE) . '"><span class="t3-icon fa fa-fw fa-angle-right"></span></button>';
} else {
$ctrl .= '<button class="btn btn-default" name="TABLE[col_start][' . $b . ']" title="' . $this->getLanguageService()->getLL('table_start', TRUE) . '"><span class="t3-icon fa fa-fw fa-angle-double-left"></span></button>';
}
$ctrl .= '<button class="btn btn-default" name="TABLE[col_remove][' . $b . ']" title="' . $this->getLanguageService()->getLL('table_removeColumn', TRUE) . '"><span class="t3-icon fa fa-fw fa-trash"></span></button>';
$ctrl .= '<button class="btn btn-default" name="TABLE[col_add][' . $b . ']" title="' . $this->getLanguageService()->getLL('table_addColumn', TRUE) . '"><span class="t3-icon fa fa-fw fa-plus"></span></button>';
$cells[] = '<span class="btn-group">' . $ctrl . '</span>';
}
$tRows[] = '
<tfoot>
<tr>
<td>' . implode('</td>
<td>', $cells) . '</td>
</tr>
</tfoot>';
}
$content = '';
// Implode all table rows into a string, wrapped in table tags.
$content .= '
<!-- Table wizard -->
<div class="table-fit table-fit-inline-block">
<table id="typo3-tablewizard" class="table table-center">
' . implode('', $tRows) . '
</table>
</div>';
//.........这里部分代码省略.........
示例8: getTableHTML
/**
* Creates the HTML for the Table Wizard:
*
* @param array $cfgArr Table config array
* @param array $row Current parent record array
* @return string HTML for the table wizard
* @access private
* @todo Define visibility
*/
public function getTableHTML($cfgArr, $row)
{
// Traverse the rows:
$tRows = array();
$k = 0;
$countLines = count($cfgArr);
foreach ($cfgArr as $cellArr) {
if (is_array($cellArr)) {
// Initialize:
$cells = array();
$a = 0;
// Traverse the columns:
foreach ($cellArr as $cellContent) {
if ($this->inputStyle) {
$cells[] = '<input type="text"' . $this->doc->formWidth(20) . ' name="TABLE[c][' . ($k + 1) * 2 . '][' . ($a + 1) * 2 . ']" value="' . htmlspecialchars($cellContent) . '" />';
} else {
$cellContent = preg_replace('/<br[ ]?[\\/]?>/i', LF, $cellContent);
$cells[] = '<textarea ' . $this->doc->formWidth(20) . ' rows="5" name="TABLE[c][' . ($k + 1) * 2 . '][' . ($a + 1) * 2 . ']">' . GeneralUtility::formatForTextarea($cellContent) . '</textarea>';
}
// Increment counter:
$a++;
}
// CTRL panel for a table row (move up/down/around):
$onClick = 'document.wizardForm.action+=\'#ANC_' . (($k + 1) * 2 - 2) . '\';';
$onClick = ' onclick="' . htmlspecialchars($onClick) . '"';
$ctrl = '';
$brTag = $this->inputStyle ? '' : '<br />';
if ($k != 0) {
$ctrl .= '<input type="image" name="TABLE[row_up][' . ($k + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/pil2up.gif', '') . $onClick . ' title="' . $GLOBALS['LANG']->getLL('table_up', TRUE) . '" />' . $brTag;
} else {
$ctrl .= '<input type="image" name="TABLE[row_bottom][' . ($k + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/turn_up.gif', '') . $onClick . ' title="' . $GLOBALS['LANG']->getLL('table_bottom', TRUE) . '" />' . $brTag;
}
$ctrl .= '<input type="image" name="TABLE[row_remove][' . ($k + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/garbage.gif', '') . $onClick . ' title="' . $GLOBALS['LANG']->getLL('table_removeRow', TRUE) . '" />' . $brTag;
if ($k + 1 != $countLines) {
$ctrl .= '<input type="image" name="TABLE[row_down][' . ($k + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/pil2down.gif', '') . $onClick . ' title="' . $GLOBALS['LANG']->getLL('table_down', TRUE) . '" />' . $brTag;
} else {
$ctrl .= '<input type="image" name="TABLE[row_top][' . ($k + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/turn_down.gif', '') . $onClick . ' title="' . $GLOBALS['LANG']->getLL('table_top', TRUE) . '" />' . $brTag;
}
$ctrl .= '<input type="image" name="TABLE[row_add][' . ($k + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/add.gif', '') . $onClick . ' title="' . $GLOBALS['LANG']->getLL('table_addRow', TRUE) . '" />' . $brTag;
$tRows[] = '
<tr class="bgColor4">
<td class="bgColor5"><a name="ANC_' . ($k + 1) * 2 . '"></a><span class="c-wizButtonsV">' . $ctrl . '</span></td>
<td>' . implode('</td>
<td>', $cells) . '</td>
</tr>';
// Increment counter:
$k++;
}
}
// CTRL panel for a table column (move left/right/around/delete)
$cells = array();
$cells[] = '';
// Finding first row:
$firstRow = reset($cfgArr);
if (is_array($firstRow)) {
// Init:
$a = 0;
$cols = count($firstRow);
// Traverse first row:
foreach ($firstRow as $temp) {
$ctrl = '';
if ($a != 0) {
$ctrl .= '<input type="image" name="TABLE[col_left][' . ($a + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/pil2left.gif', '') . ' title="' . $GLOBALS['LANG']->getLL('table_left', TRUE) . '" />';
} else {
$ctrl .= '<input type="image" name="TABLE[col_end][' . ($a + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/turn_left.gif', '') . ' title="' . $GLOBALS['LANG']->getLL('table_end', TRUE) . '" />';
}
$ctrl .= '<input type="image" name="TABLE[col_remove][' . ($a + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/garbage.gif', '') . ' title="' . $GLOBALS['LANG']->getLL('table_removeColumn', TRUE) . '" />';
if ($a + 1 != $cols) {
$ctrl .= '<input type="image" name="TABLE[col_right][' . ($a + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/pil2right.gif', '') . ' title="' . $GLOBALS['LANG']->getLL('table_right', TRUE) . '" />';
} else {
$ctrl .= '<input type="image" name="TABLE[col_start][' . ($a + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/turn_right.gif', '') . ' title="' . $GLOBALS['LANG']->getLL('table_start', TRUE) . '" />';
}
$ctrl .= '<input type="image" name="TABLE[col_add][' . ($a + 1) * 2 . ']"' . IconUtility::skinImg($this->doc->backPath, 'gfx/add.gif', '') . ' title="' . $GLOBALS['LANG']->getLL('table_addColumn', TRUE) . '" />';
$cells[] = '<span class="c-wizButtonsH">' . $ctrl . '</span>';
// Incr. counter:
$a++;
}
$tRows[] = '
<tr class="bgColor5">
<td align="center">' . implode('</td>
<td align="center">', $cells) . '</td>
</tr>';
}
$content = '';
// Implode all table rows into a string, wrapped in table tags.
$content .= '
<!--
Table wizard
-->
//.........这里部分代码省略.........
示例9: createFolder
/**
* For TBE: Makes a form for creating new folders in the filemount the user is browsing.
* The folder creation request is sent to the tce_file.php script in the core which will handle the creation.
*
* @param Folder $folderObject Absolute filepath on server in which to create the new folder.
* @return string HTML for the create folder form.
*/
public function createFolder(Folder $folderObject)
{
if (!$folderObject->checkActionPermission('write')) {
return '';
}
$backendUser = $this->getBackendUser();
if (!($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.createFoldersInEB'))) {
return '';
}
// Don't show Folder-create form if it's denied
if ($backendUser->getTSConfigVal('options.folderTree.hideCreateFolder')) {
return '';
}
$lang = $this->getLanguageService();
// Create header, showing upload path:
$header = $folderObject->getIdentifier();
$code = '
<!--
Form, for creating new folders:
-->
<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform2" id="typo3-crFolderForm">
<table border="0" cellpadding="0" cellspacing="0" id="typo3-crFolder">
<tr>
<td>' . $this->barheader($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle') . ':') . '</td>
</tr>
<tr>
<td class="c-wCell c-hCell"><strong>' . $lang->getLL('path', true) . ':</strong> ' . htmlspecialchars($header) . '</td>
</tr>
<tr>
<td class="c-wCell c-hCell">';
// Create the new-folder name field:
$a = 1;
$code .= '<input' . $this->doc->formWidth(20) . ' type="text" name="file[newfolder][' . $a . '][data]" />' . '<input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($folderObject->getCombinedIdentifier()) . '" />';
// Make footer of upload form, including the submit button:
$redirectValue = $this->getThisScript() . 'act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams) . (is_array($this->P) ? GeneralUtility::implodeArrayForUrl('P', $this->P) : '');
$code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />' . '<input class="btn btn-default" type="submit" name="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', true) . '" />';
$code .= '</td>
</tr>
</table>
</form>';
return $code;
}
示例10: main
/**
* Main function, rendering the main module content
*
* @return void
*/
public function main()
{
// Start content compilation
$this->content .= $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle'));
// Make page header:
$pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle'));
$pageContent .= $this->doc->spacer(5);
$pageContent .= $this->doc->divider(5);
if ($this->folderObject->checkActionPermission('add')) {
$code = '<form action="tce_file.php" method="post" name="editform">';
// Making the selector box for the number of concurrent folder-creations
$this->number = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->number, 1, 10);
$code .= '
<div id="c-select">
<label for="number-of-new-folders">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.number_of_folders') . '</label>
<select name="number" id="number-of-new-folders" onchange="reload(this.options[this.selectedIndex].value);">';
for ($a = 1; $a <= $this->folderNumber; $a++) {
$code .= '<option value="' . $a . '"' . ($this->number == $a ? ' selected="selected"' : '') . '>' . $a . '</option>';
}
$code .= '
</select>
</div>
';
// Making the number of new-folder boxes needed:
$code .= '
<div id="c-createFolders">
';
for ($a = 0; $a < $this->number; $a++) {
$code .= '
<input' . $this->doc->formWidth(20) . ' type="text" name="file[newfolder][' . $a . '][data]" onchange="changed=true;" />
<input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($this->target) . '" /><br />
';
}
$code .= '
</div>
';
// Making submit button for folder creation:
$code .= '
<div id="c-submitFolders">
<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" />
<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" />
<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
</div>
';
// CSH:
$code .= BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfolder', $GLOBALS['BACK_PATH'], '<br />');
$pageContent .= $code;
// Add spacer:
$pageContent .= $this->doc->spacer(10);
// Switching form tags:
$pageContent .= $this->doc->sectionEnd() . '</form>';
}
if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')) {
$pageContent .= '<form action="tce_file.php" method="post" name="editform2">';
// Create a list of allowed file extensions with the nice format "*.jpg, *.gif" etc.
$fileExtList = array();
$textfileExt = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], TRUE);
foreach ($textfileExt as $fileExt) {
if (!preg_match('/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] . '/i', '.' . $fileExt)) {
$fileExtList[] = '*.' . $fileExt;
}
}
// Add form fields for creation of a new, blank text file:
$code = '
<div id="c-newFile">
<p>[' . htmlspecialchars(implode(', ', $fileExtList)) . ']</p>
<input' . $this->doc->formWidth(20) . ' type="text" name="file[newfile][0][data]" onchange="changed=true;" />
<input type="hidden" name="file[newfile][0][target]" value="' . htmlspecialchars($this->target) . '" />
</div>
';
// Submit button for creation of a new file:
$code .= '
<div id="c-submitFiles">
<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', TRUE) . '" />
<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" />
<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
</div>
';
// CSH:
$code .= BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfile', $GLOBALS['BACK_PATH'], '<br />');
$pageContent .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile'), $code);
$pageContent .= $this->doc->sectionEnd();
$pageContent .= '</form>';
}
$docHeaderButtons = array('back' => '');
// Back
if ($this->returnUrl) {
$docHeaderButtons['back'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
}
// Add the HTML as a section:
$markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent, 'PATH' => $this->title);
$this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
$this->content .= $this->doc->endPage();
//.........这里部分代码省略.........