Go to the source code of this file.
Namespaces | |
namespace | TYPO3 |
Classes | |
class | SC_wizard_forms |
Functions | |
changeFunc () | |
Detects if a control button (up/down/around/delete) has been pressed for an item and accordingly it will manipulate the internal FORMCFG array. | |
cfgArray2CfgString ($cfgArr) | |
Converts the input array to a configuration code string. | |
cfgString2CfgArray ($cfgStr) | |
Converts the input configuration code string into an array. | |
cleanT ($tArr) | |
Removes any "trailing elements" in the array which consists of whitespace (little like trim() does for strings, so this does for arrays). | |
formatCells ($fArr) | |
Wraps items in $fArr in table cells/rows, displaying them vertically. | |
Variables | |
$BACK_PATH = '' | |
[CLASS/FUNCTION INDEX of SCRIPT] | |
$content = '<input type="image" class="c-inputButton" name="_refresh"'.t3lib_iconWorks::skinImg('','gfx/refresh_n.gif','').' title="'.$LANG->getLL('forms_refresh',1).'" />' | |
$SOBE = t3lib_div::makeInstance('SC_wizard_forms') |
|
Converts the input array to a configuration code string.
Definition at line 719 of file wizard_forms.php. References cleanT(). 00719 { 00720 00721 // Initialize: 00722 $inLines=array(); 00723 00724 // Traverse the elements of the form wizard and transform the settings into configuration code. 00725 foreach($cfgArr as $vv) { 00726 if ($vv['comment']) { // If "content" is found, then just pass it over. 00727 $inLines[]=trim($vv['comment']); 00728 } else { // Begin to put together the single-line configuration code of this field: 00729 00730 // Reset: 00731 $thisLine=array(); 00732 00733 // Set Label: 00734 $thisLine[0]=str_replace('|','',$vv['label']); 00735 00736 // Set Type: 00737 if ($vv['type']) { 00738 $thisLine[1]=($vv['required']?'*':'').str_replace(',','',($vv['fieldname']?$vv['fieldname'].'=':'').$vv['type']); 00739 00740 // Default: 00741 $tArr=array('','','','','',''); 00742 switch((string)$vv['type']) { 00743 case 'textarea': 00744 if (intval($vv['cols'])) $tArr[0]=intval($vv['cols']); 00745 if (intval($vv['rows'])) $tArr[1]=intval($vv['rows']); 00746 if (trim($vv['extra'])) $tArr[2]=trim($vv['extra']); 00747 if (strlen($vv['specialEval'])) { 00748 $thisLine[2] = ''; // Preset blank default value so position 3 can get a value... 00749 $thisLine[3] = $vv['specialEval']; 00750 } 00751 break; 00752 case 'input': 00753 case 'password': 00754 if (intval($vv['size'])) $tArr[0]=intval($vv['size']); 00755 if (intval($vv['max'])) $tArr[1]=intval($vv['max']); 00756 if (strlen($vv['specialEval'])) { 00757 $thisLine[2] = ''; // Preset blank default value so position 3 can get a value... 00758 $thisLine[3] = $vv['specialEval']; 00759 } 00760 break; 00761 case 'file': 00762 if (intval($vv['size'])) $tArr[0]=intval($vv['size']); 00763 break; 00764 case 'select': 00765 if (intval($vv['size'])) $tArr[0]=intval($vv['size']); 00766 if ($vv['autosize']) $tArr[0]='auto'; 00767 if ($vv['multiple']) $tArr[1]='m'; 00768 break; 00769 } 00770 $tArr = $this->cleanT($tArr); 00771 if (count($tArr)) $thisLine[1].=','.implode(',',$tArr); 00772 00773 $thisLine[1]=str_replace('|','',$thisLine[1]); 00774 00775 // Default: 00776 if ($vv['type']=='select' || $vv['type']=='radio') { 00777 $thisLine[2]=str_replace(chr(10),', ',str_replace(',','',$vv['options'])); 00778 } elseif ($vv['type']=='check') { 00779 if ($vv['default']) $thisLine[2]=1; 00780 } elseif (strcmp(trim($vv['default']),'')) { 00781 $thisLine[2]=$vv['default']; 00782 } 00783 if (isset($thisLine[2])) $thisLine[2]=str_replace('|','',$thisLine[2]); 00784 } 00785 00786 // Compile the final line: 00787 $inLines[]=ereg_replace("[\n\r]*",'',implode(' | ',$thisLine)); 00788 } 00789 } 00790 // Finally, implode the lines into a string, and return it: 00791 return implode(chr(10),$inLines); 00792 }
|
|
Converts the input configuration code string into an array.
Definition at line 801 of file wizard_forms.php. References $val. 00801 { 00802 00803 // Traverse the number of form elements: 00804 $tLines=explode(chr(10),$cfgStr); 00805 foreach($tLines as $k => $v) { 00806 00807 // Initialize: 00808 $confData=array(); 00809 $val=trim($v); 00810 00811 // Accept a line as configuration if a) it is blank(! - because blank lines indicates new, unconfigured fields) or b) it is NOT a comment. 00812 if (!$val || strcspn($val,'#/')) { 00813 00814 // Split: 00815 $parts = t3lib_div::trimExplode('|',$val); 00816 00817 // Label: 00818 $confData['label'] = trim($parts[0]); 00819 00820 // Field: 00821 $fParts = t3lib_div::trimExplode(',',$parts[1]); 00822 $fParts[0]=trim($fParts[0]); 00823 if (substr($fParts[0],0,1)=='*') { 00824 $confData['required'] = 1; 00825 $fParts[0] = substr($fParts[0],1); 00826 } 00827 00828 $typeParts = t3lib_div::trimExplode('=',$fParts[0]); 00829 $confData['type'] = trim(strtolower(end($typeParts))); 00830 00831 if ($confData['type']) { 00832 if (count($typeParts)==1) { 00833 $confData['fieldname'] = substr(ereg_replace('[^a-zA-Z0-9_]','',str_replace(' ','_',trim($parts[0]))),0,30); 00834 00835 // Attachment names... 00836 if ($confData['type']=='file') { 00837 $confData['fieldname']='attachment'.$attachmentCounter; 00838 $attachmentCounter=intval($attachmentCounter)+1; 00839 } 00840 } else { 00841 $confData['fieldname'] = str_replace(' ','_',trim($typeParts[0])); 00842 } 00843 00844 switch((string)$confData['type']) { 00845 case 'select': 00846 case 'radio': 00847 $confData['default'] = implode(chr(10),t3lib_div::trimExplode(',',$parts[2])); 00848 break; 00849 default: 00850 $confData['default'] = trim($parts[2]); 00851 break; 00852 } 00853 00854 // Field configuration depending on the fields type: 00855 switch((string)$confData['type']) { 00856 case 'textarea': 00857 $confData['cols'] = $fParts[1]; 00858 $confData['rows'] = $fParts[2]; 00859 $confData['extra'] = strtoupper($fParts[3])=='OFF' ? 'OFF' : ''; 00860 $confData['specialEval'] = trim($parts[3]); 00861 break; 00862 case 'input': 00863 case 'password': 00864 $confData['size'] = $fParts[1]; 00865 $confData['max'] = $fParts[2]; 00866 $confData['specialEval'] = trim($parts[3]); 00867 break; 00868 case 'file': 00869 $confData['size'] = $fParts[1]; 00870 break; 00871 case 'select': 00872 $confData['size'] = intval($fParts[1])?$fParts[1]:''; 00873 $confData['autosize'] = strtolower(trim($fParts[1]))=='auto' ? 1 : 0; 00874 $confData['multiple'] = strtolower(trim($fParts[2]))=='m' ? 1 : 0; 00875 break; 00876 } 00877 } 00878 } else { 00879 // No configuration, only a comment: 00880 $confData=array( 00881 'comment' => $val 00882 ); 00883 } 00884 00885 // Adding config array: 00886 $cfgArr[]=$confData; 00887 } 00888 00889 // Return cfgArr 00890 return $cfgArr; 00891 }
|
|
Detects if a control button (up/down/around/delete) has been pressed for an item and accordingly it will manipulate the internal FORMCFG array.
Definition at line 660 of file wizard_forms.php. Referenced by SC_wizard_table::getConfigCode(), and SC_wizard_forms::getConfigCode(). 00660 { 00661 if ($this->FORMCFG['row_remove']) { 00662 $kk = key($this->FORMCFG['row_remove']); 00663 $cmd='row_remove'; 00664 } elseif ($this->FORMCFG['row_add']) { 00665 $kk = key($this->FORMCFG['row_add']); 00666 $cmd='row_add'; 00667 } elseif ($this->FORMCFG['row_top']) { 00668 $kk = key($this->FORMCFG['row_top']); 00669 $cmd='row_top'; 00670 } elseif ($this->FORMCFG['row_bottom']) { 00671 $kk = key($this->FORMCFG['row_bottom']); 00672 $cmd='row_bottom'; 00673 } elseif ($this->FORMCFG['row_up']) { 00674 $kk = key($this->FORMCFG['row_up']); 00675 $cmd='row_up'; 00676 } elseif ($this->FORMCFG['row_down']) { 00677 $kk = key($this->FORMCFG['row_down']); 00678 $cmd='row_down'; 00679 } 00680 00681 if ($cmd && t3lib_div::testInt($kk)) { 00682 if (substr($cmd,0,4)=='row_') { 00683 switch($cmd) { 00684 case 'row_remove': 00685 unset($this->FORMCFG['c'][$kk]); 00686 break; 00687 case 'row_add': 00688 $this->FORMCFG['c'][$kk+1]=array(); 00689 break; 00690 case 'row_top': 00691 $this->FORMCFG['c'][1]=$this->FORMCFG['c'][$kk]; 00692 unset($this->FORMCFG['c'][$kk]); 00693 break; 00694 case 'row_bottom': 00695 $this->FORMCFG['c'][1000000]=$this->FORMCFG['c'][$kk]; 00696 unset($this->FORMCFG['c'][$kk]); 00697 break; 00698 case 'row_up': 00699 $this->FORMCFG['c'][$kk-3]=$this->FORMCFG['c'][$kk]; 00700 unset($this->FORMCFG['c'][$kk]); 00701 break; 00702 case 'row_down': 00703 $this->FORMCFG['c'][$kk+3]=$this->FORMCFG['c'][$kk]; 00704 unset($this->FORMCFG['c'][$kk]); 00705 break; 00706 } 00707 ksort($this->FORMCFG['c']); 00708 } 00709 } 00710 }
|
|
Removes any "trailing elements" in the array which consists of whitespace (little like trim() does for strings, so this does for arrays).
Definition at line 900 of file wizard_forms.php. References $a. Referenced by cfgArray2CfgString(). 00900 { 00901 for($a=count($tArr);$a>0;$a--) { 00902 if (strcmp($tArr[$a-1],'')) { 00903 break; 00904 } else { 00905 unset($tArr[$a-1]); 00906 } 00907 } 00908 return $tArr; 00909 }
|
|
Wraps items in $fArr in table cells/rows, displaying them vertically.
Definition at line 918 of file wizard_forms.php. References table(). Referenced by SC_wizard_forms::getFormHTML(). 00918 { 00919 00920 // Traverse the elements in $fArr and wrap them in table cells: 00921 $lines=array(); 00922 foreach($fArr as $l => $c) { 00923 $lines[]=' 00924 <tr> 00925 <td nowrap="nowrap">'.htmlspecialchars($l.':').' </td> 00926 <td>'.$c.'</td> 00927 </tr>'; 00928 } 00929 00930 // Add a cell which will set a minimum width: 00931 $lines[]=' 00932 <tr> 00933 <td nowrap="nowrap"><img src="clear.gif" width="70" height="1" alt="" /></td> 00934 <td></td> 00935 </tr>'; 00936 00937 // Wrap in table and return: 00938 return ' 00939 <table border="0" cellpadding="0" cellspacing="0"> 00940 '.implode('',$lines).' 00941 </table>'; 00942 }
|
|
[CLASS/FUNCTION INDEX of SCRIPT] 175: class SC_wizard_forms 203: function init() 242: function main() 258: function printContent() 267: function formsWizard() SECTION: Helper functions 310: function getConfigCode(&$row) 381: function getFormHTML($formCfgArray,$row) 660: function changeFunc() 719: function cfgArray2CfgString($cfgArr) 801: function cfgString2CfgArray($cfgStr) 900: function cleanT($tArr) 918: function formatCells($fArr) TOTAL FUNCTIONS: 11 (This index is automatically created/updated by the extension "extdeveval") Definition at line 63 of file wizard_forms.php. |
|
Definition at line 651 of file wizard_forms.php. |
|
Definition at line 962 of file wizard_forms.php. |