GForm_Ctrl __construct(
$system_name, Vars_Manager
$vm, stying
$
|
|
Constructor
Parameters:
|
stying |
$ |
Name of the controller |
|
Vars_Manager |
$vm: |
Permanent Vars_Manager that will be used. Session of Thread VM |
|
|
$system_name: |
|
Redefinition of:
- Form_Ctrl::__construct()
- Constructor
Redefined in descendants as:
void add_processed_state(
string
$form_id, boolean
$state
)
|
|
Adds new processed state
Parameters:
|
string |
$form_id: |
|
|
boolean |
$state: |
|
API Tags:
| Internal: | |
| Access: | private |
void compose_external_params_var_name(
)
|
|
API Tags:
void get_permanent_external_param(
$param_name, [
$forgiving = false]
)
|
|
Parameters:
API Tags:
boolean get_processed_state(
string
$form_id
)
|
|
Returns processed state for submit identified with $form_id
Parameters:
API Tags:
Returns reference to used Vars_Mananger
API Tags:
| Internal: | |
| Access: | protected |
unknown handle_fresh_submit(
unknown_type
$form_id
)
|
|
Handles fresh submit of the form.
GForm_Ctrl guarantees that only one submit of the form (with same data, for example when visitor to your site clicks multiple times on submit button) will be processed. That means, for example, that you will not get multiple rows in your database with same data, just because visitor was impatient and pumped same form again and again.
Parameters:
API Tags:
unknown handle_repeated_submit(
unknown_type
$form_id
)
|
|
Handles repeated submit.
A submit is considered repeated when form_guard detects that same data is submited more than once. In this case "same data" means not just the casual form data but also form_id and guard_value hidden fields. handle_repeated_submit is smart enough to detect state of the last fresh submit (@see GForm_Ctrl::handle_fresh_submit) and to return it.
Usualy repeated submits happens when impatient visitor to your site clicks submit button on a form multile times. Other case is when page that has received submit is refreshed with F5 or "Refresh" button of the browser.
From application point of view repeated submits are just "skipped", i.e. there are no calls of on_process_submit
From visitor's point of view repeated submit is 100% transparent - he/she does not notice any additional activities
Parameters:
API Tags:
| Internal: | |
| Access: | private |
Initialization of guard pairs array and permanent variable
API Tags:
| Internal: | |
| Access: | protected |
boolean is_already_processed(
string
$form_id
)
|
|
Checks if this submit is already processed
Parameters:
API Tags:
| Internal: | |
| Access: | private |
void on_accepted_submit(
)
|
|
Called right after submit is accepted.
After a form is submited and basic_check is passed, Form->accept_submit() method is called to transfer values from $_POST to fields' values. Immediately after that $this->on_accepted_submit() is called in order to give the user a chance to manipulate fields values if there is such need (which happens vary rare, only in low level code. If required in high level code that may indicate that there is some design flaw).
API Tags:
Redefined in descendants as:
void on_process_submit(
)
|
|
Place for your own processing of the validated form data.
Called after form is passed successfully basic_check and also on_good_submit returned true.
For the sake of example - this method is used in form controllers with object to save the object in the DB. Normally is not used in high level code.
API Tags:
Redefined in descendants as:
Prepares form for show
API Tags:
Redefinition of:
- Form_Ctrl::prepare_for_show()
- Descendants of Form_Ctrl may use this method to prepare the form
Redefined in descendants as:
Processes submit
Parameters:
API Tags:
| Return: | Returned value will be Form_Ctrl::SUBMIT_RESULT_ERROR or Form_Ctrl::SUBMIT_RESULT_OK |
| Internal: | |
| Access: | public |
Redefinition of:
- Form_Ctrl::process_submit()
- Processes submit of the form
Vars_Mananger query_vm(
)
|
|
Returns copy of used Vars_Mananger
API Tags:
| Internal: | |
| Access: | protected |
void retrieve_permanent_external_params(
$form_id
)
|
|
Parameters:
API Tags:
void set_permanent_external_param(
$param_name,
$param_value
)
|
|
Parameters:
|
|
$param_name: |
|
|
|
$param_value: |
|
API Tags:
void set_permanent_external_params(
$form_id
)
|
|
Parameters:
API Tags:
Sets Vars_Manager that will be used
Parameters:
API Tags:
| Internal: | |
| Access: | protected |