This page documents the development tools, utility functions, file management, and form handling systems that support the Hotelaro platform. It is intended for developers and technical maintainers who need to understand the shared infrastructure and helper mechanisms that underpin the main application modules.
Scope:
For information about the main booking system, see Core Booking System. For system configuration, see Setup & Configuration. For frontend website customization, see Website Builder.
Diagram: "Development & Utilities System Overview"
Form Handling
File Management
JS Utilities
PHP Helpers
Used by
Used by
Handles
Uploads to
Reads
Notification
Notification
app/Helpers/Common_helper.php
app/Views/common_script/formsubmit.php
app/Views/common_script/multifileuploader.php
inc/themes/backend/Admin/Views/toster.php
uploads/
assets/countries_states_cities.json
inc/themes/backend/Admin/Views/submitit.php
The file app/Helpers/Common_helper.php contains a large set of global helper functions used throughout the application. These functions provide:
The function permissionvaluecheck($permissionname, $permissiontype) checks if the current user session has a specific permission, based on their role and the permissions stored in the database.
The function form_open($action, $attributes, $hidden) generates a form opening tag with CSRF protection automatically included if enabled in the configuration.
| Function Name | Purpose | Source Line(s) |
|---|---|---|
| getInfoById | Fetch value by ID from a table | 6-16 |
| getInfoByUid | Fetch value by admin_uid from a table | 19-29 |
| getOrdinalSuffix | Get ordinal suffix for a number | 32-43 |
| form_open | Generate form tag with CSRF | 258-313 |
| permissionvaluecheck | Check user permission | 417-450 |
| emailtemplate | Send email with template and placeholders | 505-556 |
| tz_list | List all timezones with UTC offsets | 453-470 |
app/Helpers/Common_helper.php
getInfoById()
getInfoByUid()
form_open()
permissionvaluecheck()
emailtemplate()
tz_list()
The JavaScript in app/Views/common_script/multifileuploader.php provides a client-side interface for uploading multiple files (typically images) with preview and removal capabilities. It enforces file count limits and uses AJAX to upload files to the server.
Uploaded files are stored in the uploads/ directory. The system expects file metadata (such as file path and ID) to be managed in the database and referenced in the UI.
The file assets/countries_states_cities.json provides a static dataset for populating country, state, and city dropdowns, used in forms for property setup and guest information.
The script in app/Views/common_script/formsubmit.php enables AJAX-based form submission with CSRF token handling and dynamic feedback using toastr notifications.
inc/themes/backend/Admin/Views/submitit.php provides a similar AJAX form submission handler for backend forms, with additional UI feedback and error handling.
CSRF tokens are managed via the form_open helper and are included in AJAX requests. The backend validates these tokens on each request.
The notification system uses Toastify.js, as configured in inc/themes/backend/Admin/Views/toster.php, to display success, error, warning, and info messages in a consistent style.
| Component/File | Purpose |
|---|---|
| formsubmit.php | AJAX form submission (frontend) |
| submitit.php | AJAX form submission (backend) |
| toster.php | Toast notification configuration |
| form_open (helper) | Form tag generation with CSRF |
"toster.php"
"Backend (PHP)"
"formsubmit.php/submitit.php"
"User"
"toster.php"
"Backend (PHP)"
"formsubmit.php/submitit.php"
"User"
alt
[Success]
[Error]
Fill and submit form
Prevent default, append CSRF
AJAX POST (with CSRF)
JSON response (status, message, new CSRF)
toastr.success(message)
Redirect or update UI
toastr.error(message)
Show error, reset button
The script in app/Views/common_script/allCountryStateCity.php dynamically populates country, state, and city dropdowns using the static JSON file. It supports:
The utilities described here are heavily used in the setup and configuration modules, such as in inc/setup/Basicsetup/Views/content.php, where forms for language, currency, and timezone selection are rendered and submitted using the above helpers and scripts.
The development and utilities layer in Hotelaro provides a robust foundation for rapid development and consistent user experience across modules. By centralizing helper functions, file management, and form handling, the system ensures maintainability and security.
Key Takeaways: