This trait, Forms_Frontend, provides methods for handling form views, processing form submissions, and sending emails for various form types.

Form View

form($type)

Loads and displays a form based on the specified type.

This method performs the following actions:

  1. Retrieves the item based on the provided pretty URL.
  2. Sets up form data based on the form type.
  3. Loads the appropriate form view.

Form Processing

form_processing()

Processes form submissions for various form types.

This method handles:

  • Validation of required fields
  • Data insertion into the database
  • Sending confirmation emails

The specific fields and validation rules depend on the form type specified in the POST data.

Form Template

form_template()

Processes a specific form template, likely for school program bookings.

This method includes:

  • Validation of form fields
  • Insertion of booking data into the database
  • Sending a 2FA registration email

Mailing Functions

sendMailForm($data, $type, $table_name)

Sends a confirmation email for standard forms.

sendMailRegistration2FA($data)

Sends a 2FA registration email.

sendConfirmationEmail($data, $for_events, $curated)

Sends a confirmation email for gallery-related actions.

All email sending functions use PHPMailer for email composition and delivery.

Constants

The trait uses several constants for form types, such as PROGRAMME_SCHOOLS. These constants are not defined within the provided code snippet but are presumably defined elsewhere in the application.

Ensure that all required constants are properly defined before using this trait.

Dependencies

This trait depends on:

  • CodeIgniter’s form validation library
  • PHPMailer library
  • Language files for internationalization

Make sure all dependencies are properly loaded and configured in your CodeIgniter application.