165 $GLOBALS[
'LANG']->includeLLFile(
'EXT:lang/locallang_wizards.xlf');
182 $this->xmlStorage = $this->P[
'params'][
'xmlOutput'];
185 $this->doc->backPath =
$GLOBALS[
'BACK_PATH'];
186 $this->doc->setModuleTemplate(
'EXT:backend/Resources/Private/Templates/wizard_forms.html');
189 $this->doc->form =
'<form action="' . htmlspecialchars($rUri) .
'" method="post" name="wizardForm">';
198 if ($this->P[
'table'] && $this->P[
'field'] && $this->P[
'uid']) {
199 $this->content .= $this->doc->section(
$GLOBALS[
'LANG']->getLL(
'forms_title'), $this->
formsWizard(), 0, 1);
201 $this->content .= $this->doc->section(
$GLOBALS[
'LANG']->getLL(
'forms_title'),
'<span class="typo3-red">' .
$GLOBALS[
'LANG']->getLL(
'table_noData', 1) .
'</span>', 0, 1);
205 $markers[
'CSH'] = $docHeaderButtons[
'csh'];
208 $this->content = $this->doc->startPage(
'Form Wizard');
209 $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
210 $this->content .= $this->doc->endPage();
211 $this->content = $this->doc->insertStylesAndJS($this->content);
238 if ($this->P[
'table'] && $this->P[
'field'] && $this->P[
'uid']) {
244 $buttons[
'close'] =
'<a href="#" onclick="' . htmlspecialchars((
'jumpToUrl(unescape(\'' . rawurlencode(
GeneralUtility::sanitizeLocalUrl($this->P[
'returnUrl'])) .
'\'));
return false;
')) . '">' . IconUtility::getSpriteIcon('actions-document-close', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE))) . '</a>'; 246 $buttons['save'] = '<input type="image
" class="c-inputButton
" name="savedok
"' . IconUtility::skinImg($this->doc->backPath, 'gfx/savedok.gif') . ' title="' . $GLOBALS['LANG
']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc
', TRUE) . '" />'; 248 $buttons['save_close'] = '<input type="image
" class="c-inputButton
" name="saveandclosedok
"' . IconUtility::skinImg($this->doc->backPath, 'gfx/saveandclosedok.gif') . ' title="' . $GLOBALS['LANG
']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc
', TRUE) . '" />'; 250 $buttons['reload'] = '<input type="image
" class="c-inputButton
" name="_refresh
"' . IconUtility::skinImg('', 'gfx/refresh_n.gif') . ' title="' . $GLOBALS['LANG
']->getLL('forms_refresh
', TRUE) . '" />'; 261 public function formsWizard() { 262 if (!$this->checkEditAccess($this->P['table'], $this->P['uid'])) { 263 throw new \RuntimeException('Wizard Error: No access', 1385807526); 265 // First, check the references by selecting the record: 266 $row = BackendUtility::getRecord($this->P['table'], $this->P['uid']); 267 if (!is_array($row)) { 268 throw new \RuntimeException('Wizard Error: No reference to record', 1294587124); 270 // This will get the content of the form configuration code field to us - possibly 271 // cleaned up, saved to database etc. if the form has been submitted in the meantime. 272 $formCfgArray = $this->getConfigCode($row); 273 // Generation of the Form Wizards HTML code: 274 $content = $this->getFormHTML($formCfgArray, $row); 279 /**************************** 283 ***************************/ 293 public function getConfigCode(&$row) { 294 // If some data has been submitted, then construct 295 if (isset($this->FORMCFG['c'])) { 298 // Convert to string (either line based or XML): 299 if ($this->xmlStorage) { 300 // Convert the input array to XML: 301 $bodyText = GeneralUtility::array2xml_cs($this->FORMCFG['c'], 'T3FormWizard'); 302 // Setting cfgArr directly from the input: 303 $cfgArr = $this->FORMCFG['c']; 305 // Convert the input array to a string of configuration code: 306 $bodyText = $this->cfgArray2CfgString($this->FORMCFG['c']); 307 // Create cfgArr from the string based configuration - that way it is cleaned 308 // up and any incompatibilities will be removed! 309 $cfgArr = $this->cfgString2CfgArray($bodyText); 311 // If a save button has been pressed, then save the new field content: 312 if ($_POST['savedok_x'] || $_POST['saveandclosedok_x']) { 313 // Make TCEmain object: 314 $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); 315 $tce->stripslashes_values = 0; 316 // Put content into the data array: 318 $data[$this->P['table']][$this->P['uid']][$this->P['field']] = $bodyText; 319 if ($this->special == 'formtype_mail') { 320 $data[$this->P['table']][$this->P['uid']]['subheader'] = $this->FORMCFG['recipient']; 322 // Perform the update: 323 $tce->start($data, array()); 324 $tce->process_datamap(); 325 // Re-load the record content: 326 $row = BackendUtility::getRecord($this->P['table'], $this->P['uid']); 327 // If the save/close button was pressed, then redirect the screen: 328 if ($_POST['saveandclosedok_x']) { 329 \TYPO3\CMS\Core\Utility\HttpUtility::redirect(GeneralUtility::sanitizeLocalUrl($this->P['returnUrl'])); 333 // If nothing has been submitted, load the $bodyText variable from the selected database row: 334 if ($this->xmlStorage) { 335 $cfgArr = GeneralUtility::xml2array($row[$this->P['field']]); 337 // Regular linebased form configuration: 338 $cfgArr = $this->cfgString2CfgArray($row[$this->P['field']]); 340 $cfgArr = is_array($cfgArr) ? $cfgArr : array(); 342 // Return configuration code: 355 public function getFormHTML($formCfgArray, $row) { 356 // Initialize variables: 357 $specParts = array(); 358 $hiddenFields = array(); 362 $GLOBALS['LANG']->getLL('forms_preview', TRUE) . ':', 363 $GLOBALS['LANG']->getLL('forms_element', TRUE) . ':', 364 $GLOBALS['LANG']->getLL('forms_config', TRUE) . ':' 367 <tr class="bgColor2
" id="typo3-formWizardHeader
"> 369 <td>' . implode('</td> 370 <td>', $cells) . '</td> 372 // Traverse the number of form elements: 374 foreach ($formCfgArray as $confData) { 377 // If there is a configuration line which is active, then render it: 378 if (!isset($confData['comment'])) { 380 if ($this->special == 'formtype_mail' && GeneralUtility::inList('formtype_mail,subject,html_enabled', $confData['fieldname'])) { 381 $specParts[$confData['fieldname']] = $confData['default']; 383 // Render title/field preview COLUMN 384 $cells[] = $confData['type'] != 'hidden' ? '<strong>' . htmlspecialchars($confData['label']) . '</strong>' : ''; 385 // Render general type/title COLUMN: 386 $temp_cells = array(); 387 // Field type selector: 389 $opt[] = '<option value=""></option>'; 390 $types = explode(',', 'input,textarea,select,check,radio,password,file,hidden,submit,property,label'); 391 foreach ($types as $t) { 393 <option value="' . $t . '"' . ($confData['type'] == $t ? ' selected="selected
"' : '') . '>' . $GLOBALS['LANG']->getLL(('forms_type_' . $t), TRUE) . '</option>'; 395 $temp_cells[$GLOBALS['LANG']->getLL('forms_type')] = ' 396 <select name="FORMCFG[c][
' . ($k + 1) * 2 . '][type]
"> 401 if (!GeneralUtility::inList('hidden,submit', $confData['type'])) { 402 $temp_cells[$GLOBALS['LANG']->getLL('forms_label')] = '<input type="text
"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][
' . ($k + 1) * 2 . '][label]
" value="' . htmlspecialchars($confData['label
']) . '" />'; 404 // Required checkbox: 405 if (!GeneralUtility::inList('check,hidden,submit,label', $confData['type'])) { 406 $temp_cells[$GLOBALS['LANG']->getLL('forms_required')] = '<input type="checkbox
" name="FORMCFG[c][
' . ($k + 1) * 2 . '][required]
" value="1
"' . ($confData['required'] ? ' checked="checked
"' : '') . ' title="' . $GLOBALS['LANG
']->getLL('forms_required
', TRUE) . '" />'; 408 // Put sub-items together into table cell: 409 $cells[] = $this->formatCells($temp_cells); 410 // Render specific field configuration COLUMN: 411 $temp_cells = array(); 413 if ($this->special == 'formtype_mail' && $confData['type'] == 'file') { 414 $confData['fieldname'] = 'attachment' . ++$this->attachmentCounter; 416 if (!GeneralUtility::inList('label', $confData['type'])) { 417 $temp_cells[$GLOBALS['LANG']->getLL('forms_fieldName')] = '<input type="text
"' . $this->doc->formWidth(10) . ' name="FORMCFG[c][
' . ($k + 1) * 2 . '][fieldname]
" value="' . htmlspecialchars($confData['fieldname
']) . '" title="' . $GLOBALS['LANG
']->getLL('forms_fieldName
', TRUE) . '" />'; 419 // Field configuration depending on the fields type: 420 switch ((string) $confData['type']) { 422 $temp_cells[$GLOBALS['LANG']->getLL('forms_cols')] = '<input type="text
"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][
' . ($k + 1) * 2 . '][cols]
" value="' . htmlspecialchars($confData['cols
']) . '" title="' . $GLOBALS['LANG
']->getLL('forms_cols
', TRUE) . '" />'; 423 $temp_cells[$GLOBALS['LANG']->getLL('forms_rows')] = '<input type="text
"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][
' . ($k + 1) * 2 . '][rows]
" value="' . htmlspecialchars($confData['rows
']) . '" title="' . $GLOBALS['LANG
']->getLL('forms_rows
', TRUE) . '" />'; 424 $temp_cells[$GLOBALS['LANG']->getLL('forms_extra')] = '<input type="checkbox
" name="FORMCFG[c][
' . ($k + 1) * 2 . '][extra]
" value="OFF
"' . ($confData['extra'] == 'OFF' ? ' checked="checked
"' : '') . ' title="' . $GLOBALS['LANG
']->getLL('forms_extra
', TRUE) . '" />'; 429 $temp_cells[$GLOBALS['LANG']->getLL('forms_size')] = '<input type="text
"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][
' . ($k + 1) * 2 . '][size]
" value="' . htmlspecialchars($confData['size
']) . '" title="' . $GLOBALS['LANG
']->getLL('forms_size
', TRUE) . '" />'; 430 $temp_cells[$GLOBALS['LANG']->getLL('forms_max')] = '<input type="text
"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][
' . ($k + 1) * 2 . '][max]
" value="' . htmlspecialchars($confData['max
']) . '" title="' . $GLOBALS['LANG
']->getLL('forms_max
', TRUE) . '" />'; 433 $temp_cells[$GLOBALS['LANG']->getLL('forms_size')] = '<input type="text
"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][
' . ($k + 1) * 2 . '][size]
" value="' . htmlspecialchars($confData['size
']) . '" title="' . $GLOBALS['LANG
']->getLL('forms_size
', TRUE) . '" />'; 436 $temp_cells[$GLOBALS['LANG']->getLL('forms_size')] = '<input type="text
"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][
' . ($k + 1) * 2 . '][size]
" value="' . htmlspecialchars($confData['size
']) . '" title="' . $GLOBALS['LANG
']->getLL('forms_size
', TRUE) . '" />'; 437 $temp_cells[$GLOBALS['LANG']->getLL('forms_autosize')] = '<input type="checkbox
" name="FORMCFG[c][
' . ($k + 1) * 2 . '][autosize]
" value="1
"' . ($confData['autosize'] ? ' checked="checked
"' : '') . ' title="' . $GLOBALS['LANG
']->getLL('forms_autosize
', TRUE) . '" />'; 438 $temp_cells[$GLOBALS['LANG']->getLL('forms_multiple')] = '<input type="checkbox
" name="FORMCFG[c][
' . ($k + 1) * 2 . '][multiple]
" value="1
"' . ($confData['multiple'] ? ' checked="checked
"' : '') . ' title="' . $GLOBALS['LANG
']->getLL('forms_multiple
', TRUE) . '" />'; 441 // Field configuration depending on the fields type: 442 switch ((string) $confData['type']) { 448 if (strlen(trim($confData['specialEval']))) { 449 $hiddenFields[] = '<input type="hidden
" name="FORMCFG[c][
' . ($k + 1) * 2 . '][specialEval]
" value="' . htmlspecialchars($confData['specialEval
']) . '" />'; 454 if ($confData['type'] == 'select' || $confData['type'] == 'radio') { 455 $temp_cells[$GLOBALS['LANG']->getLL('forms_options')] = '<textarea ' . $this->doc->formWidth(15) . ' rows="4
" name="FORMCFG[c][
' . ($k + 1) * 2 . '][options]
" title="' . $GLOBALS['LANG
']->getLL('forms_options
', TRUE) . '">' . GeneralUtility::formatForTextarea($confData['default']) . '</textarea>'; 456 } elseif ($confData['type'] == 'check') { 457 $temp_cells[$GLOBALS['LANG']->getLL('forms_checked')] = '<input type="checkbox
" name="FORMCFG[c][
' . ($k + 1) * 2 . '][
default]
" value="1
"' . (trim($confData['default']) ? ' checked="checked
"' : '') . ' title="' . $GLOBALS['LANG
']->getLL('forms_checked
', TRUE) . '" />'; 458 } elseif ($confData['type'] && $confData['type'] != 'file') { 459 $temp_cells[$GLOBALS['LANG']->getLL('forms_default')] = '<input type="text
"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][
' . ($k + 1) * 2 . '][
default]
" value="' . htmlspecialchars($confData['default']) . '" title="' . $GLOBALS['LANG
']->getLL('forms_default
', TRUE) . '" />'; 461 $cells[] = $confData['type'] ? $this->formatCells($temp_cells) : ''; 462 // CTRL panel for an item (move up/down/around): 464 $onClick = 'document.wizardForm.action+=\'#ANC_' . (($k + 1) * 2 - 2) . '\';'; 465 $onClick = ' onclick="' . htmlspecialchars($onClick) . '"'; 466 // FIXME $inputStyle undefined 467 $brTag = $inputStyle ? '' : '<br />'; 469 $ctrl .= '<input type="image
" name="FORMCFG[row_up][
' . ($k + 1) * 2 . ']
"' . IconUtility::skinImg($this->doc->backPath, 'gfx/pil2up.gif', '') . $onClick . ' title="' . $GLOBALS['LANG
']->getLL('table_up
', TRUE) . '" />' . $brTag; 471 $ctrl .= '<input type="image
" name="FORMCFG[row_bottom][
' . ($k + 1) * 2 . ']
"' . IconUtility::skinImg($this->doc->backPath, 'gfx/turn_up.gif', '') . $onClick . ' title="' . $GLOBALS['LANG
']->getLL('table_bottom
', TRUE) . '" />' . $brTag; 473 $ctrl .= '<input type="image
" name="FORMCFG[row_remove][
' . ($k + 1) * 2 . ']
"' . IconUtility::skinImg($this->doc->backPath, 'gfx/garbage.gif', '') . $onClick . ' title="' . $GLOBALS['LANG
']->getLL('table_removeRow
', TRUE) . '" />' . $brTag; 474 // FIXME $tLines undefined 475 if ($k + 1 != count($tLines)) { 476 $ctrl .= '<input type="image
" name="FORMCFG[row_down][
' . ($k + 1) * 2 . ']
"' . IconUtility::skinImg($this->doc->backPath, 'gfx/pil2down.gif', '') . $onClick . ' title="' . $GLOBALS['LANG
']->getLL('table_down
', TRUE) . '" />' . $brTag; 478 $ctrl .= '<input type="image
" name="FORMCFG[row_top][
' . ($k + 1) * 2 . ']
"' . IconUtility::skinImg($this->doc->backPath, 'gfx/turn_down.gif', '') . $onClick . ' title="' . $GLOBALS['LANG
']->getLL('table_top
', TRUE) . '" />' . $brTag; 480 $ctrl .= '<input type="image
" name="FORMCFG[row_add][
' . ($k + 1) * 2 . ']
"' . IconUtility::skinImg($this->doc->backPath, 'gfx/add.gif', '') . $onClick . ' title="' . $GLOBALS['LANG
']->getLL('table_addRow
', TRUE) . '" />' . $brTag; 481 $ctrl = '<span class="c-wizButtonsV
">' . $ctrl . '</span>'; 482 // Finally, put together the full row from the generated content above: 483 $bgC = $confData['type'] ? ' class="bgColor5
"' : ''; 486 <td><a name="ANC_
' . ($k + 1) * 2 . '"></a>' . $ctrl . '</td> 487 <td class="bgColor4
">' . implode('</td> 488 <td valign="top
">', $cells) . '</td> 492 $hiddenFields[] = '<input type="hidden
" name="FORMCFG[c][
' . ($k + 1) * 2 . '][comment]
" value="' . htmlspecialchars($confData['comment
']) . '" />'; 494 // Increment counter: 497 // If the form is of the special type "formtype_mail
" (used for tt_content elements): 498 if ($this->special == 'formtype_mail') { 502 <td colspan="4
"> </td> 507 <td colspan="2
" class="bgColor2
"> </td> 508 <td colspan="2
" class="bgColor2
"><strong>' . $GLOBALS['LANG']->getLL('forms_special_eform', TRUE) . ':</strong>' . BackendUtility::cshItem('xMOD_csh_corebe', 'wizard_forms_wiz_formmail_info', $GLOBALS['BACK_PATH'], '') . '</td> 512 <tr class="bgColor5
"> 514 <td class="bgColor4
"> </td> 515 <td>' . $GLOBALS['LANG']->getLL('forms_eform_formtype_mail', TRUE) . ':</td> 517 <input type="hidden
" name="FORMCFG[c][
' . 1000 * 2 . '][fieldname]
" value="formtype_mail
" /> 518 <input type="hidden
" name="FORMCFG[c][
' . 1000 * 2 . '][type]
" value="submit
" /> 519 <input type="text
"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][
' . 1000 * 2 . '][
default]
" value="' . htmlspecialchars($specParts['formtype_mail
']) . '" /> 524 <tr class="bgColor5
"> 526 <td class="bgColor4
"> </td> 527 <td>' . $GLOBALS['LANG']->getLL('forms_eform_html_enabled', TRUE) . ':</td> 529 <input type="hidden
" name="FORMCFG[c][
' . 1001 * 2 . '][fieldname]
" value="html_enabled
" /> 530 <input type="hidden
" name="FORMCFG[c][
' . 1001 * 2 . '][type]
" value="hidden
" /> 531 <input type="checkbox
" name="FORMCFG[c][
' . 1001 * 2 . '][
default]
" value="1
"' . ($specParts['html_enabled'] ? ' checked="checked
"' : '') . ' /> 536 <tr class="bgColor5
"> 538 <td class="bgColor4
"> </td> 539 <td>' . $GLOBALS['LANG']->getLL('forms_eform_subject', TRUE) . ':</td> 541 <input type="hidden
" name="FORMCFG[c][
' . 1002 * 2 . '][fieldname]
" value="subject
" /> 542 <input type="hidden
" name="FORMCFG[c][
' . 1002 * 2 . '][type]
" value="hidden
" /> 543 <input type="text
"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][
' . 1002 * 2 . '][
default]
" value="' . htmlspecialchars($specParts['subject
']) . '" /> 548 <tr class="bgColor5
"> 550 <td class="bgColor4
"> </td> 551 <td>' . $GLOBALS['LANG']->getLL('forms_eform_recipient', TRUE) . ':</td> 553 <input type="text
"' . $this->doc->formWidth(15) . ' name="FORMCFG[recipient]
" value="' . htmlspecialchars($row['subheader
']) . '" /> 558 // Implode all table rows into a string, wrapped in table tags. 564 <table border="0
" cellpadding="1
" cellspacing="1
" id="typo3-formwizard
"> 565 ' . implode('', $tRows) . ' 567 // Add hidden fields: 568 $content .= implode('', $hiddenFields); 580 public function changeFunc() { 581 if ($this->FORMCFG['row_remove']) { 582 $kk = key($this->FORMCFG['row_remove']); 584 } elseif ($this->FORMCFG['row_add']) { 585 $kk = key($this->FORMCFG['row_add']); 587 } elseif ($this->FORMCFG['row_top']) { 588 $kk = key($this->FORMCFG['row_top']); 590 } elseif ($this->FORMCFG['row_bottom']) { 591 $kk = key($this->FORMCFG['row_bottom']); 593 } elseif ($this->FORMCFG['row_up']) { 594 $kk = key($this->FORMCFG['row_up']); 596 } elseif ($this->FORMCFG['row_down']) { 597 $kk = key($this->FORMCFG['row_down']); 600 if ($cmd && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($kk)) { 601 if (substr($cmd, 0, 4) == 'row_') { 604 unset($this->FORMCFG['c'][$kk]); 607 $this->FORMCFG['c'][$kk + 1] = array(); 610 $this->FORMCFG['c'][1] = $this->FORMCFG['c'][$kk]; 611 unset($this->FORMCFG['c'][$kk]); 614 $this->FORMCFG['c'][1000000] = $this->FORMCFG['c'][$kk]; 615 unset($this->FORMCFG['c'][$kk]); 618 $this->FORMCFG['c'][$kk - 3] = $this->FORMCFG['c'][$kk]; 619 unset($this->FORMCFG['c'][$kk]); 622 $this->FORMCFG['c'][$kk + 3] = $this->FORMCFG['c'][$kk]; 623 unset($this->FORMCFG['c'][$kk]); 626 ksort($this->FORMCFG['c']); 639 public function cfgArray2CfgString($cfgArr) { 642 // Traverse the elements of the form wizard and transform the settings into configuration code. 643 foreach ($cfgArr as $vv) { 644 // If "content
" is found, then just pass it over. 645 if ($vv['comment']) { 646 $inLines[] = trim($vv['comment']); 648 // Begin to put together the single-line configuration code of this field: 652 $thisLine[0] = str_replace('|', '', $vv['label']); 655 $thisLine[1] = ($vv['required'] ? '*' : '') . str_replace(',', '', (($vv['fieldname'] ? $vv['fieldname'] . '=' : '') . $vv['type'])); 657 $tArr = array('', '', '', '', '', ''); 658 switch ((string) $vv['type']) { 660 if ((int)$vv['cols']) { 661 $tArr[0] = (int)$vv['cols']; 663 if ((int)$vv['rows']) { 664 $tArr[1] = (int)$vv['rows']; 666 if (trim($vv['extra'])) { 667 $tArr[2] = trim($vv['extra']); 669 if (strlen($vv['specialEval'])) { 670 // Preset blank default value so position 3 can get a value... 672 $thisLine[3] = $vv['specialEval']; 677 if ((int)$vv['size']) { 678 $tArr[0] = (int)$vv['size']; 680 if ((int)$vv['max']) { 681 $tArr[1] = (int)$vv['max']; 683 if (strlen($vv['specialEval'])) { 684 // Preset blank default value so position 3 can get a value... 686 $thisLine[3] = $vv['specialEval']; 690 if ((int)$vv['size']) { 691 $tArr[0] = (int)$vv['size']; 695 if ((int)$vv['size']) { 696 $tArr[0] = (int)$vv['size']; 698 if ($vv['autosize']) { 701 if ($vv['multiple']) { 706 $tArr = $this->cleanT($tArr); 708 $thisLine[1] .= ',' . implode(',', $tArr); 710 $thisLine[1] = str_replace('|', '', $thisLine[1]); 712 if ($vv['type'] == 'select' || $vv['type'] == 'radio') { 713 $options = str_replace(',', '', $vv['options']); 714 $options = str_replace( 715 array(CR . LF, CR, LF), 718 $thisLine[2] = $options; 719 } elseif ($vv['type'] == 'check') { 720 if ($vv['default']) { 723 } elseif (trim($vv['default']) !== '') { 724 $thisLine[2] = $vv['default']; 726 if (isset($thisLine[2])) { 727 $thisLine[2] = str_replace('|', '', $thisLine[2]); 730 // Compile the final line: 731 $inLines[] = preg_replace('/[ 733 ]*/', '', implode(' | ', $thisLine)); 736 // Finally, implode the lines into a string, and return it: 737 return implode(LF, $inLines); 748 public function cfgString2CfgArray($cfgStr) { 749 // Traverse the number of form elements: 750 $tLines = explode(LF, $cfgStr); 751 $attachmentCounter = 0; 752 foreach ($tLines as $k => $v) { 756 // Accept a line as configuration if a) it is blank(! - because blank lines indicates new, 757 // unconfigured fields) or b) it is NOT a comment. 758 if (!$val || strcspn($val, '#/')) { 760 $parts = GeneralUtility::trimExplode('|', $val); 762 $confData['label'] = trim($parts[0]); 764 $fParts = GeneralUtility::trimExplode(',', $parts[1]); 765 $fParts[0] = trim($fParts[0]); 766 if ($fParts[0][0] === '*') { 767 $confData['required'] = 1; 768 $fParts[0] = substr($fParts[0], 1); 770 $typeParts = GeneralUtility::trimExplode('=', $fParts[0]); 771 $confData['type'] = trim(strtolower(end($typeParts))); 772 if ($confData['type']) { 773 if (count($typeParts) == 1) { 774 $confData['fieldname'] = substr(preg_replace('/[^a-zA-Z0-9_]/', '', str_replace(' ', '_', trim($parts[0]))), 0, 30); 775 // Attachment names... 776 if ($confData['type'] == 'file') { 777 $confData['fieldname'] = 'attachment' . $attachmentCounter; 778 $attachmentCounter = (int)$attachmentCounter + 1; 781 $confData['fieldname'] = str_replace(' ', '_', trim($typeParts[0])); 783 switch ((string) $confData['type']) { 786 $confData['default'] = implode(LF, GeneralUtility::trimExplode(',', $parts[2])); 789 $confData['default'] = trim($parts[2]); 791 // Field configuration depending on the fields type: 792 switch ((string) $confData['type']) { 794 $confData['cols'] = $fParts[1]; 795 $confData['rows'] = $fParts[2]; 796 $confData['extra'] = strtoupper($fParts[3]) == 'OFF' ? 'OFF' : ''; 797 $confData['specialEval'] = trim($parts[3]); 801 $confData['size'] = $fParts[1]; 802 $confData['max'] = $fParts[2]; 803 $confData['specialEval'] = trim($parts[3]); 806 $confData['size'] = $fParts[1]; 809 $confData['size'] = (int)$fParts[1] ? $fParts[1] : ''; 810 $confData['autosize'] = strtolower(trim($fParts[1])) === 'auto' ? 1 : 0; 811 $confData['multiple'] = strtolower(trim($fParts[2])) === 'm' ? 1 : 0; 816 // No configuration, only a comment: 821 // Adding config array: 822 $cfgArr[] = $confData; 836 public function cleanT($tArr) { 837 for ($a = count($tArr); $a > 0; $a--) { 838 if ((string)$tArr[$a - 1] !== '') { 841 unset($tArr[$a - 1]); 855 public function formatCells($fArr) { 856 // Traverse the elements in $fArr and wrap them in table cells: 858 foreach ($fArr as $l => $c) { 861 <td nowrap="nowrap
">' . htmlspecialchars(($l . ':')) . ' </td> 865 // Add a cell which will set a minimum width: 868 <td nowrap="nowrap
"><img src="clear.gif
" width="70
" height="1
" alt="" /></td> 871 // Wrap in table and return: 873 <table border="0
" cellpadding="0
" cellspacing="0
"> 874 ' . implode('', $lines) . ' 886 protected function checkEditAccess($table, $uid) { 887 $calcPRec = BackendUtility::getRecord($table, $uid); 888 BackendUtility::fixVersioningPid($table, $calcPRec); 889 if (is_array($calcPRec)) { 891 if ($table == 'pages') { 892 $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec); 893 $hasAccess = $CALC_PERMS & 2 ? TRUE : FALSE; 895 // Fetching pid-record first. 896 $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $calcPRec['pid'])); 897 $hasAccess = $CALC_PERMS & 16 ? TRUE : FALSE; 899 // Check internals regarding access: 901 $hasAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($table, $calcPRec);
static cshItem($table, $field, $BACK_PATH, $wrap='', $onlyIconMode=FALSE, $styleAttrib='')
static getIndpEnv($getEnvName)
static makeInstance($className)
static sanitizeLocalUrl($url='')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]