tangra logo
   
[ class tree: tangra_lib ] [ index: tangra_lib ] [ all elements ]
 

Class: Form_Ctrl

Source Location: /form/form_ctrl.class.php

Class Form_Ctrl

Class Overview

Controller for Form and Form_View objects

Form_Ctrl is class intended to provide objects that control Form and Form_View objects. It servers as a controller in the MVC triad where Form is the model and Form_View is the view.

Located in /form/form_ctrl.class.php [line 51]

Tangra_Class
   |
   --Form_Ctrl
Author(s):
API Tags:
Abstract:  

Properties

Methods

[ Top ]
Descendants
Child Class Description
GForm_Ctrl Controller for Guarder_Form

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Tangra_Class

Tangra_Class::get_class_name()
Alias of get_class(). Exist because of historical reasons.
Tangra_Class::__set()
Overides PHP built-in method and just throws exception if called. Purpose - to "forbid" autosetting of nonexisting class properties.

[ Top ]
Constant Summary
SUBMIT_RESULT_ERROR   Submited form contains errors (missing required fields, invalid dates/emails, etc.)
SUBMIT_RESULT_OK   Submited form is OK

[ Top ]
Property Summary
TPLE_Exports   $exports   TPLE_Exports holder
Form   $form   Form object
Form_View   $form_view   Form_View Object
string   $system_name   name of the controler

[ Top ]
Method Summary
Form_Ctrl   __construct()   Constructor
void   create_form()   User have to define this method and to return instance of Form
void   create_form_view()   User have to define this method and to return instance of Form_View
void   export()   Alias of $this->exports->add_pair()
Form   get_form()   Returns reference to Form object
unknown   get_form_submit_event()   Returns form's submit event
arrray   get_form_submit_events()   Returns events of form submission both for <input type="submit" and <input type="image"
Form_View   get_form_view()   Return reference to Form_View object
unknown   get_system_name()   Gets name
TPLE_Exports   get_tple_exports()   Gets TPLE_Exports for the form
void   on_bad_submit()   This method will be called when form submit is not good, i.e. Form_Ctrl::SUBMIT_RESULT_ERROR
void   on_good_submit()   This method is called when submit is OK.
void   prepare_for_show()   Descendants of Form_Ctrl may use this method to prepare the form
boolean   process_submit()   Processes submit of the form
Form   query_form()   Returns copy of Form object
Form_View   query_form_view()   Returns copy of Form_View object
void   set_system_name()   Sets this object's name
void   _create_form()   Internally called method which sole purpose is to verify that value returned by create_form method is really a instance of Form
void   _create_form_view()   Internally called method which sole purpose is to verify that value returned by create_form method is really a instance of Form_View

[ Top ]
Properties
TPLE_Exports   $exports [line 93]

TPLE_Exports holder

API Tags:
Internal:  
Access:  protected


[ Top ]
Form   $form [line 70]

Form object

API Tags:
Internal:  
Access:  protected


[ Top ]
Form_View   $form_view [line 78]

Form_View Object

API Tags:
Internal:  
Access:  protected


[ Top ]
string   $system_name [line 85]

name of the controler

API Tags:
Access:  private


[ Top ]
Methods
Constructor __construct  [line 100]

  Form_Ctrl __construct( string $system_name  )

Constructor

Parameters:
string   $system_name:  Name of the controller. Must be alphanumeric (underscore allowed), starting with letter, 50 characters max.


Redefined in descendants as:

[ Top ]
create_form  [line 315]

  void create_form( )

User have to define this method and to return instance of Form


API Tags:
Abstract:  
Access:  protected


[ Top ]
create_form_view  [line 322]

  void create_form_view( )

User have to define this method and to return instance of Form_View


API Tags:
Abstract:  
Access:  protected


[ Top ]
export  [line 305]

  void export( string $key, string $value  )

Alias of $this->exports->add_pair()

Parameters:
string   $key: 
string   $value: 

API Tags:
Access:  public


[ Top ]
get_form  [line 251]

  Form get_form( )

Returns reference to Form object

Use this method *only* if you will change something in it. If you just need to extrac some value - use query_form();


API Tags:
See:  Form_Ctrl::query_form()
Access:  public


[ Top ]
get_form_submit_event  [line 114]

  unknown get_form_submit_event( )

Returns form's submit event


API Tags:
Access:  public


[ Top ]
get_form_submit_events  [line 141]

  arrray get_form_submit_events( )

Returns events of form submission both for <input type="submit" and <input type="image"


API Tags:
Return:  Simple array of Web_Event_Simple elements
Access:  public


[ Top ]
get_form_view  [line 229]

  Form_View get_form_view( )

Return reference to Form_View object

Use this method *only* if you will change something in it. If you just need to extrac some value - use query_form_view();


API Tags:
See:  qForm_Ctrl::uery_form_view()
Access:  public


[ Top ]
get_system_name  [line 205]

  unknown get_system_name( )

Gets name


API Tags:
Access:  public


[ Top ]
get_tple_exports  [line 215]

  TPLE_Exports get_tple_exports( )

Gets TPLE_Exports for the form


API Tags:
Access:  public


[ Top ]
on_bad_submit  [line 337]

  void on_bad_submit( )

This method will be called when form submit is not good, i.e. Form_Ctrl::SUBMIT_RESULT_ERROR


API Tags:
Abstract:  
Access:  protected


[ Top ]
on_good_submit  [line 331]

  void on_good_submit( )

This method is called when submit is OK.

User can use this method make additional checks for fields validation. If this method exits with Form_Ctrl::SUBMIT_RESULT_ERROR then calling method process() will also exit with same result Same is valid for


API Tags:
Abstract:  
Access:  protected


[ Top ]
prepare_for_show  [line 181]

  void prepare_for_show( )

Descendants of Form_Ctrl may use this method to prepare the form

This method is empty (not abstract) for convinience reasons.


API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
process_submit  [line 156]

  boolean process_submit( Web_Context $context  )

Processes submit of the form

Returns Form_Ctrl::SUBMIT_RESULT_OK if form is OK, Form_Ctrl::SUBMIT_RESULT_ERROR otherwise

Parameters:
Web_Context   $context: 

API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
query_form  [line 261]

  Form query_form( )

Returns copy of Form object


API Tags:
Access:  public


[ Top ]
query_form_view  [line 238]

  Form_View query_form_view( )

Returns copy of Form_View object


API Tags:
Access:  public


[ Top ]
set_system_name  [line 191]

  void set_system_name( string $system_name  )

Sets this object's name

Parameters:
string   $system_name:  ust be alphanumeric (underscore allowed), starting with letter, 50 characters max.

API Tags:
Access:  public


[ Top ]
_create_form  [line 272]

  void _create_form( )

Internally called method which sole purpose is to verify that value returned by create_form method is really a instance of Form


API Tags:
Internal:  
Access:  protected

Information Tags:
Throws:  Tangra_Exception

[ Top ]
_create_form_view  [line 289]

  void _create_form_view( )

Internally called method which sole purpose is to verify that value returned by create_form method is really a instance of Form_View


API Tags:
Internal:  
Access:  protected

Information Tags:
Throws:  Tangra_Exception

[ Top ]
Constants
SUBMIT_RESULT_ERROR = 0 [line 56]

Submited form contains errors (missing required fields, invalid dates/emails, etc.)


[ Top ]
SUBMIT_RESULT_OK = 1 [line 62]

Submited form is OK


[ Top ]