Event in Batoi RAD Framework


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 RAD 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 RAD Framework IDE. You can add an event with the following information:

  1. 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.
  2. 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.
  3. Roles: You can specify the user roles that can access this event of the application. You can specify multiple roles. The role Administrator is selected by default and cannot be modified.
  4. Verifier: Additional boolean expression that needs to be satisfied to make the event executed successfully; e.g., $iMyVariable == 'N'
  5. 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_Form class (a Batoi RAD 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 RAD Framework IDE):
    $oForm = new Delight_Form($_POST, $APP->FORMRULES); $aForm = iterator_to_array($oForm);
    Now, the variable $aForm carries validated and sanitized posted form data, which can be used within the application.
  6. Code for Calling Application Objects and Including External Scripts: Here, you instantiate Application classes or include Script Includes to perform business logic operations.
  7. View Page Parts: A comma-separated ordered list of View Page Part files to be called for creating UI.
  8. View (Web) Page Variables: TITLE, HEADERTEXT, BREADCRUMB are 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 RAD Framework IDE. The list of the events can be ordered for display (used for readability purpose on the Batoi RAD Framework IDE only).