Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

SC_wizard_table Class Reference

List of all members.

Public Member Functions

 init ()
 Initialization of the class.
 main ()
 Main function, rendering the table wizard.
 printContent ()
 Outputting the accumulated content to screen.
 tableWizard ()
 Draws the table wizard content.
 getConfigCode ($row)
 Will get and return the configuration code string Will also save (and possibly redirect/exit) the content if a save button has been pressed.
 getTableHTML ($cfgArr, $row)
 Creates the HTML for the Table Wizard:.

Public Attributes

 $doc
 $content
 $include_once = array()
 $inputStyle = 0
 $xmlStorage = 0
 $colsFieldName = 'cols'
 $P
 $TABLECFG

Member Function Documentation

SC_wizard_table::getConfigCode row  ) 
 

Will get and return the configuration code string Will also save (and possibly redirect/exit) the content if a save button has been pressed.

Parameters:
array Current parent record row
Returns:
array Table config code in an array private

Definition at line 217 of file wizard_table.php.

References cfgArray2CfgString(), cfgString2CfgArray(), changeFunc(), header(), and table().

00217                                  {
00218 
00219          // If some data has been submitted, then construct
00220       if (isset($this->TABLECFG['c'])) {
00221 
00222             // Process incoming:
00223          $this->changeFunc();
00224 
00225 
00226             // Convert to string (either line based or XML):
00227          if ($this->xmlStorage)  {
00228                // Convert the input array to XML:
00229             $bodyText = t3lib_div::array2xml($this->TABLECFG['c'],'',0,'T3TableWizard');
00230 
00231                // Setting cfgArr directly from the input:
00232             $cfgArr = $this->TABLECFG['c'];
00233          } else {
00234                // Convert the input array to a string of configuration code:
00235             $bodyText = $this->cfgArray2CfgString($this->TABLECFG['c']);
00236 
00237                // Create cfgArr from the string based configuration - that way it is cleaned up and any incompatibilities will be removed!
00238             $cfgArr = $this->cfgString2CfgArray($bodyText,$row[$this->colsFieldName]);
00239          }
00240 
00241             // If a save button has been pressed, then save the new field content:
00242          if ($_POST['savedok_x'] || $_POST['saveandclosedok_x'])  {
00243 
00244                // Make TCEmain object:
00245             $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00246             $tce->stripslashes_values=0;
00247 
00248                // Put content into the data array:
00249             $data=array();
00250             $data[$this->P['table']][$this->P['uid']][$this->P['field']]=$bodyText;
00251 
00252                // Perform the update:
00253             $tce->start($data,array());
00254             $tce->process_datamap();
00255 
00256                // If the save/close button was pressed, then redirect the screen:
00257             if ($_POST['saveandclosedok_x']) {
00258                header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
00259                exit;
00260             }
00261          }
00262       } else { // If nothing has been submitted, load the $bodyText variable from the selected database row:
00263          if ($this->xmlStorage)  {
00264             $cfgArr = t3lib_div::xml2array($row[$this->P['field']]);
00265          } else { // Regular linebased table configuration:
00266             $cfgArr = $this->cfgString2CfgArray($row[$this->P['field']],$row[$this->colsFieldName]);
00267          }
00268          $cfgArr = is_array($cfgArr) ? $cfgArr : array();
00269       }
00270 
00271       return $cfgArr;
00272    }

SC_wizard_table::getTableHTML cfgArr,
row
 

Creates the HTML for the Table Wizard:.

Parameters:
array Table config array
array Current parent record array
Returns:
string HTML for the table wizard private

Definition at line 282 of file wizard_table.php.

References $a, $cells, and $tRows.

SC_wizard_table::init  ) 
 

Initialization of the class.

Returns:
void

Definition at line 112 of file wizard_table.php.

00112                      {
00113       global $BACK_PATH;
00114 
00115          // GPvars:
00116       $this->P = t3lib_div::_GP('P');
00117       $this->TABLECFG = t3lib_div::_GP('TABLE');
00118 
00119          // Setting options:
00120       $this->xmlStorage = $this->P['params']['xmlOutput'];
00121 
00122          // Textareas or input fields:
00123       $this->inputStyle=isset($this->TABLECFG['textFields']) ? $this->TABLECFG['textFields'] : 1;
00124 
00125          // Document template object:
00126       $this->doc = t3lib_div::makeInstance('mediumDoc');
00127       $this->doc->docType = 'xhtml_trans';
00128       $this->doc->backPath = $BACK_PATH;
00129       $this->doc->JScode=$this->doc->wrapScriptTags('
00130          function jumpToUrl(URL,formEl)   {  //
00131             document.location = URL;
00132          }
00133       ');
00134 
00135          // Setting form tag:
00136       list($rUri) = explode('#',t3lib_div::getIndpEnv('REQUEST_URI'));
00137       $this->doc->form ='<form action="'.htmlspecialchars($rUri).'" method="post" name="wizardForm">';
00138 
00139          // Start page:
00140       $this->content.=$this->doc->startPage('Table');
00141 
00142          // If save command found, include tcemain:
00143       if ($_POST['savedok_x'] || $_POST['saveandclosedok_x'])  {
00144          $this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php';
00145       }
00146    }

SC_wizard_table::main  ) 
 

Main function, rendering the table wizard.

Returns:
void

Definition at line 153 of file wizard_table.php.

References table().

00153                      {
00154       global $LANG;
00155 
00156       if ($this->P['table'] && $this->P['field'] && $this->P['uid']) {
00157          $this->content.=$this->doc->section($LANG->getLL('table_title'),$this->tableWizard(),0,1);
00158       } else {
00159          $this->content.=$this->doc->section($LANG->getLL('table_title'),'<span class="typo3-red">'.$LANG->getLL('table_noData',1).'</span>',0,1);
00160       }
00161       $this->content.=$this->doc->endPage();
00162    }

SC_wizard_table::printContent  ) 
 

Outputting the accumulated content to screen.

Returns:
void

Definition at line 169 of file wizard_table.php.

00169                            {
00170       echo $this->content;
00171    }

SC_wizard_table::tableWizard  ) 
 

Draws the table wizard content.

Returns:
string HTML content for the form.

Definition at line 178 of file wizard_table.php.

References $content, t3lib_BEfunc::getRecord(), table(), and typo3PrintError().

00178                            {
00179 
00180          // First, check the references by selecting the record:
00181       $row=t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
00182       if (!is_array($row)) {
00183          t3lib_BEfunc::typo3PrintError ('Wizard Error','No reference to record',0);
00184          exit;
00185       }
00186 
00187          // This will get the content of the form configuration code field to us - possibly cleaned up, saved to database etc. if the form has been submitted in the meantime.
00188       $tableCfgArray = $this->getConfigCode($row);
00189 
00190          // Generation of the Table Wizards HTML code:
00191       $content = $this->getTableHTML($tableCfgArray,$row);
00192 
00193          // Return content:
00194       return $content;
00195    }


Member Data Documentation

SC_wizard_table::$colsFieldName = 'cols'
 

Definition at line 95 of file wizard_table.php.

SC_wizard_table::$content
 

Definition at line 88 of file wizard_table.php.

SC_wizard_table::$doc
 

Definition at line 87 of file wizard_table.php.

SC_wizard_table::$include_once = array()
 

Definition at line 89 of file wizard_table.php.

SC_wizard_table::$inputStyle = 0
 

Definition at line 90 of file wizard_table.php.

SC_wizard_table::$P
 

Definition at line 99 of file wizard_table.php.

SC_wizard_table::$TABLECFG
 

Definition at line 100 of file wizard_table.php.

SC_wizard_table::$xmlStorage = 0
 

Definition at line 94 of file wizard_table.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 3 01:06:35 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913