|
|
File: c:/www/apache/doc2//form/assistant.inc
PHPLib Form Rewrite 2001/03/01 - Form
assistant
form_commonobject | +-- panemanager | +-- assistant
Assistant/wizard that guides a user through several forms.
|
private class assistant extends panemanager
Assistant/wizard that guides a user through several forms.
Authors | Ulf Wendel <ulf.wendel@phpdoc.de> |
Version | $Id: assistant.inc,v 1.18 2000/12/19 13:34:14 uw Exp $ |
|
|
|
Methods inherited from panemanager |
init, getresetbutton, getbutton, gettab, issethttpxvar, isfinishpressed, isexitpressed, ishelppressed, sethelp, setexitbutton, setfinishbutton, showtabs, setstart, setmethod, getstart, start, setfinish, getfinish, finish, arrayregexpkeysearch, setlabels, getpagevalues, getpagevalueswithtranslatednames |
|
|
|
|
Fields inherited from panemanager |
$page_values, $pages, $finish_button, $exit, $help, $method, $form_start, $form_end, $show_tabs, $labels, $show_prevnext |
|
|
Public Field Summary |
string |
$classnamePHPLIB persistance helper, name of this class. |
array |
$persistent_slotsPHPLIB persistance helper, list of persistant "slots". |
|
Private Field Summary |
array |
$page_errorsArray with status (isValid()) information of each page. |
integer |
$lastviewedWhich page was shown last? |
integer |
$selectedWhich page was selected by the user? |
integer |
$nowWhich page will be show now? |
string |
$tplTemplate object. |
string |
$templatePath to the template files. |
string |
$unknownsHow to handle unknowns. |
array |
$template_filesTemplate files. |
string |
$mode"switching mode" |
string |
$buttonnameNameprefix of all buttons generated by assistant. |
string |
$flag_specialsFlag, set if specials. |
|
Public Method Details |
setTemplatePath |
public bool setTemplatePath( string $template )
|
|
Sets the path to the templates
|
Parameter |
|
|
Returns |
bool $ok |
Throws |
form_error |
|
setTemplateFiles |
public void setTemplateFiles( array $files )
|
|
Set the template files
|
Parameter |
|
|
Returns |
void |
See Also |
$template_files |
|
get |
public string get( )
|
|
Returns the current page.
Warning: documentation is missing.
|
Returns |
string $html |
See Also |
show() |
|
currentPageName |
public string currentPageName( )
|
|
Return the name of the current page
|
Returns |
string $page_name |
See Also |
isValid(), currentPageID() |
|
currentPageID |
public int currentPageID( )
|
|
Returns the ID of the current page.
The first page defined with addPage() call gets the ID 0, the second 1 and so on.If a negative number is returned the help or exit button is pressed.
|
Returns |
int $page_id |
See Also |
isValid(), currentPageName() |
|
isValid |
public bool isValid( [ string $page ] )
|
|
Are all pages valid, is the requested page valid?
|
Parameter |
|
|
Returns |
bool $ok |
|
updatePageErrors |
public boolean updatePageErrors( [ mixed $pages ] )
|
|
If you override some page_values in Init() you have to update the page validation flags.
|
Parameter |
|
mixed |
$pages |
= >>""<< |
|
of one page, or array of page names. The default of
an empty string means all pages. |
|
Returns |
boolean $ok |
|
getPageNames |
public array getPageNames( )
|
|
Returns an array with the names of all pages.
page_id => name
|
Returns |
array $pagenames |
Throws |
form_error |
|
addPage |
public bool addPage( array $pagedata )
|
|
Add a page to the assistant
Warning: documentation is missing.
|
Parameter |
|
|
Returns |
bool $ok |
|
setMode |
public void setMode( string $mode )
|
|
Sets the "switching mode".
If set to "strict" the user must complete a form before he gets to thenext tab. If set to "weak" he's free to switch between the tabs.In both cases he's not allowed to finish the assistant beforeall forms/tabs that are not declared as optional are without errors
|
Parameter |
|
|
Returns |
void |
|
|
Private Method Details |
restoreAssistant |
private void restoreAssistant( )
|
|
Restores the Assistant. Load the pages with values, sets validation flags etc.
Warning: documentation is missing.
|
Returns |
void |
|
newTemplate |
private boolean newTemplate( )
|
|
Creates a new template object.
|
Returns |
boolean |
Throws |
form_error |
|
show |
private void show( )
|
|
Prints and returns the HTML code of the assistant.
Warning: documentation is missing.
|
Returns |
void |
See Also |
show() |
|
saveFormValues |
private void saveFormValues( )
|
|
Get the values of the last form.
|
Returns |
void |
|
loadFormValues |
private void loadFormValues( )
|
|
Load the form with values before we display it.
|
Returns |
void |
|
PageNametoPageID |
private integer PageNametoPageID( string $page_name )
|
|
Returns the page_id (page__values/page_errors index) that belongs to a page name.
|
Parameter |
|
|
Returns |
integer -1: not found |
Throws |
form_error |
See Also |
isValid() |
|
getNeighbour |
private array getNeighbour( string $now )
|
|
Find the previous and the next element of the current element.
|
Parameter |
|
|
Returns |
array ($prev, $next) |
|
setPageErrors |
private bool setPageErrors( )
|
|
Sets the error flags of all pages.
|
Returns |
bool $ok |
|
findSelected |
private boolean findSelected( )
|
|
Saves the number of the selected Page to $this->selected
|
Returns |
boolean |
See Also |
$selected, $lastviewed, findPosition() |
|
findPosition |
private void findPosition( )
|
|
Find the page that was gets shown next.
findSelected() searches the ID of the requested page. findPosition()tests wheter the user is allowed to see the requested page or ifhe should get rejected.
|
Returns |
void |
See Also |
findSelected() |
|
|
Public Field Details |
$classname |
public string $classname
>>"assistant" <<
PHPLIB persistance helper, name of this class.
|
|
$persistent_slots |
public array $persistent_slots
>>array("page_errors", "page_values", "lastviewed") <<
PHPLIB persistance helper, list of persistant "slots".
|
|
|
Private Field Details |
$page_errors |
private array $page_errors
>>array() <<
Array with status (isValid()) information of each page.
- must be restored by a session! -
|
|
$lastviewed |
private integer $lastviewed
>> <<
Which page was shown last?
- must be restored by a session! -
|
|
$selected |
private integer $selected
>>-1 <<
Which page was selected by the user?
|
|
$now |
private integer $now
>>-1 <<
Which page will be show now?
|
|
$tpl |
private string $tpl
>>"" <<
Template object.
|
|
$template |
private string $template
>>"" <<
Path to the template files.
|
|
$unknowns |
private string $unknowns
>>"remove" <<
How to handle unknowns.
|
|
$template_files |
private array $template_files
>>array(
"main" => "assistant_main.tpl"
#"tabs" => "assistant_tabs.html"
) <<
Template files.
|
See Also |
setTemplateFiles() |
|
$mode |
private string $mode
>>"strict" <<
"switching mode"
|
See Also |
setMode() |
|
$buttonname |
private string $buttonname
>>"assistant" <<
Nameprefix of all buttons generated by assistant.
|
|
$flag_specials |
private string $flag_specials
>>"" <<
Flag, set if specials.
|
See Also |
get(), findPosition() |
|
|
|
|
PHPDoc 1.0beta |