Event refers to an application instance. When a distinct HTTP request is made to application, it is accompanied by an value of Event ID or Event Name. In the Batoi Framework, an Event is uniquely identified by Event ID (available as
$APP->ID within the application), or by Event Name (available as
$APP->IDN within the application). The later is usually employed for beautifying URL, and also for tagging event's
ID for readability during development.
An event can be defined for a Controller on the Batoi Framework IDE. You can add an event with the following information:
- Event Name,
$APP->IDN: This is any string of alphanumeric characters without any white space or special characters, but can have dashes or underscores. Event Name must be unique for an application. Event ID is automatically assigned to an event upon addition.
- Set as Default: You can specify if this event is the default event; i.e., this event is invoked when the controller is called without specifying the Event ID or Event Name. You should have only one event to be set as default within a Controller.
- Roles: You can specify the user roles that can access this event of the application. You can specify multiple roles. The role
Administratoris selected by default and cannot be modified.
- Event Verifier: Additional boolean expression that needs to be satisfied to make the event executed successfully; e.g.,
$iMyVariable == 'N'
- Form Rules: This is an array with information about form validation and sanitization as required in the scope of the application. This array is used with
Delight_Formclass (an Batoi Framework Library Class) to validate and sanitize form data at the server side. For example, if we have two text-box values like Username and Password that we want to validate for and sanitise the input, we write the array as
"txtUsername" => array("validate" => 1, "validation_type" => "required", "reg_exp" => "", "error_message" => "This field is required", "sanitize" => 1, "sanitize_type" => "safe"),"txtPassword" => array("validate" => 1, "validation_type" => "required", "reg_exp" => "", "error_message" => "This field is required", "sanitize" => 1, "sanitize_type" => "safe")
and use the following code within the Event Case (next field with code editor on the same page on the Batoi Framework IDE):
$oForm = new Delight_Form($_POST, $APP->FORMRULES); $aForm = iterator_to_array($oForm);
Now, the variable
$aFormcarries validated and sanitized posted form data, which can be used within the application.
- Code for Calling Application Objects and Including External Scripts: Here, you instantiate Application classes or include Script Includes to perform business logic operations.
- View Page Parts: A comma-separated ordered list of View Page Part files to be called for creating UI.
- View (Web) Page Variables:
TITLE, HEADERTEXT, BREADCRUMBare defined here along with any other View Page Variables that are defined in sections specified.
An event can be made active or inactive on the Batoi Framework IDE. The list of the events can be ordered for display (used for readability purpose on the Opendelight IDE only).