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

SC_wizard_forms Class Reference

List of all members.

Public Member Functions

 init ()
 Initialization the class.
 main ()
 Main function for rendering the form wizard HTML.
 printContent ()
 Outputting the accumulated content to screen.
 formsWizard ()
 Draws the form 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.
 getFormHTML ($formCfgArray, $row)
 Creates the HTML for the Form Wizard:.

Public Attributes

 $doc
 $content
 $include_once = array()
 $attachmentCounter = 0
 $xmlStorage = 0
 $P
 $FORMCFG
 $special

Member Function Documentation

SC_wizard_forms::formsWizard  ) 
 

Draws the form wizard content.

Returns:
string HTML content for the form.

Definition at line 267 of file wizard_forms.php.

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

00267                            {
00268 
00269          // First, check the references by selecting the record:
00270       $row=t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
00271       if (!is_array($row)) {
00272          t3lib_BEfunc::typo3PrintError ('Wizard Error','No reference to record',0);
00273          exit;
00274       }
00275 
00276          // 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.
00277       $formCfgArray = $this->getConfigCode($row);
00278 
00279          // Generation of the Form Wizards HTML code:
00280       $content = $this->getFormHTML($formCfgArray,$row);
00281 
00282          // Return content:
00283       return $content;
00284    }

SC_wizard_forms::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 (passed by value!)
Returns:
array Configuration Array private

Definition at line 310 of file wizard_forms.php.

References cfgArray2CfgString(), cfgString2CfgArray(), changeFunc(), t3lib_BEfunc::getRecord(), header(), and table().

00310                                  {
00311 
00312          // If some data has been submitted, then construct
00313       if (isset($this->FORMCFG['c']))  {
00314 
00315             // Process incoming:
00316          $this->changeFunc();
00317 
00318             // Convert to string (either line based or XML):
00319          if ($this->xmlStorage)  {
00320                // Convert the input array to XML:
00321             $bodyText = t3lib_div::array2xml($this->FORMCFG['c'],'',0,'T3FormWizard');
00322 
00323                // Setting cfgArr directly from the input:
00324             $cfgArr = $this->FORMCFG['c'];
00325          } else {
00326                // Convert the input array to a string of configuration code:
00327             $bodyText = $this->cfgArray2CfgString($this->FORMCFG['c']);
00328 
00329                // Create cfgArr from the string based configuration - that way it is cleaned up and any incompatibilities will be removed!
00330             $cfgArr = $this->cfgString2CfgArray($bodyText);
00331          }
00332 
00333             // If a save button has been pressed, then save the new field content:
00334          if ($_POST['savedok_x'] || $_POST['saveandclosedok_x'])  {
00335 
00336                // Make TCEmain object:
00337             $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00338             $tce->stripslashes_values=0;
00339 
00340                // Put content into the data array:
00341             $data=array();
00342             $data[$this->P['table']][$this->P['uid']][$this->P['field']]=$bodyText;
00343             if ($this->special=='formtype_mail')   {
00344                $data[$this->P['table']][$this->P['uid']]['subheader']=$this->FORMCFG['recipient'];
00345             }
00346 
00347                // Perform the update:
00348             $tce->start($data,array());
00349             $tce->process_datamap();
00350 
00351                // Re-load the record content:
00352             $row = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
00353 
00354                // If the save/close button was pressed, then redirect the screen:
00355             if ($_POST['saveandclosedok_x']) {
00356                header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
00357                exit;
00358             }
00359          }
00360       } else { // If nothing has been submitted, load the $bodyText variable from the selected database row:
00361          if ($this->xmlStorage)  {
00362             $cfgArr = t3lib_div::xml2array($row[$this->P['field']]);
00363          } else { // Regular linebased form configuration:
00364             $cfgArr = $this->cfgString2CfgArray($row[$this->P['field']]);
00365          }
00366          $cfgArr = is_array($cfgArr) ? $cfgArr : array();
00367       }
00368 
00369          // Return configuration code:
00370       return $cfgArr;
00371    }

SC_wizard_forms::getFormHTML formCfgArray,
row
 

Creates the HTML for the Form Wizard:.

Parameters:
string Form config array
array Current parent record array
Returns:
string HTML for the form wizard private

Definition at line 381 of file wizard_forms.php.

References $cells, $content, $LANG, $tRows, t3lib_BEfunc::cshItem(), formatCells(), and table().

SC_wizard_forms::init  ) 
 

Initialization the class.

Returns:
void

Definition at line 203 of file wizard_forms.php.

00203                      {
00204       global $BACK_PATH;
00205 
00206          // GPvars:
00207       $this->P = t3lib_div::_GP('P');
00208       $this->special = t3lib_div::_GP('special');
00209       $this->FORMCFG = t3lib_div::_GP('FORMCFG');
00210 
00211          // Setting options:
00212       $this->xmlStorage = $this->P['params']['xmlOutput'];
00213 
00214          // Document template object:
00215       $this->doc = t3lib_div::makeInstance('mediumDoc');
00216       $this->doc->docType = 'xhtml_trans';
00217       $this->doc->backPath = $BACK_PATH;
00218       $this->doc->JScode=$this->doc->wrapScriptTags('
00219          function jumpToUrl(URL,formEl)   {  //
00220             document.location = URL;
00221          }
00222       ');
00223 
00224          // Setting form tag:
00225       list($rUri) = explode('#',t3lib_div::getIndpEnv('REQUEST_URI'));
00226       $this->doc->form ='<form action="'.htmlspecialchars($rUri).'" method="post" name="wizardForm">';
00227 
00228          // Start page:
00229       $this->content=$this->doc->startPage('Form Wizard');
00230 
00231          // If save command found, include tcemain:
00232       if ($_POST['savedok_x'] || $_POST['saveandclosedok_x'])  {
00233          $this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php';
00234       }
00235    }

SC_wizard_forms::main  ) 
 

Main function for rendering the form wizard HTML.

Returns:
void

Definition at line 242 of file wizard_forms.php.

References table().

00242                      {
00243       global $LANG;
00244 
00245       if ($this->P['table'] && $this->P['field'] && $this->P['uid']) {
00246          $this->content.=$this->doc->section($LANG->getLL('forms_title'),$this->formsWizard(),0,1);
00247       } else {
00248          $this->content.=$this->doc->section($LANG->getLL('forms_title'),'<span class="typo3-red">'.$LANG->getLL('table_noData',1).'</span>',0,1);
00249       }
00250       $this->content.=$this->doc->endPage();
00251    }

SC_wizard_forms::printContent  ) 
 

Outputting the accumulated content to screen.

Returns:
void

Definition at line 258 of file wizard_forms.php.

00258                            {
00259       echo $this->content;
00260    }


Member Data Documentation

SC_wizard_forms::$attachmentCounter = 0
 

Definition at line 181 of file wizard_forms.php.

SC_wizard_forms::$content
 

Definition at line 179 of file wizard_forms.php.

SC_wizard_forms::$doc
 

Definition at line 178 of file wizard_forms.php.

SC_wizard_forms::$FORMCFG
 

Definition at line 190 of file wizard_forms.php.

SC_wizard_forms::$include_once = array()
 

Definition at line 180 of file wizard_forms.php.

SC_wizard_forms::$P
 

Definition at line 189 of file wizard_forms.php.

SC_wizard_forms::$special
 

Definition at line 191 of file wizard_forms.php.

SC_wizard_forms::$xmlStorage = 0
 

Definition at line 185 of file wizard_forms.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