__construct()
__construct()
index(string $appointment_hash = '')
Default callback method of the application.
This method creates the appointment book wizard. If an appointment hash is provided then it means that the customer followed the appointment manage link that was send with the book success email.
string | $appointment_hash | The db appointment hash of an existing record. |
cancel(string $appointment_hash)
Cancel an existing appointment.
This method removes an appointment from the company's schedule. In order for the appointment to be deleted, the hash string must be provided. The customer can only cancel the appointment if the edit time period is not over yet.
string | $appointment_hash | This is used to distinguish the appointment record. |
ajax_get_available_hours() : \Returns
[AJAX] Get the available appointment hours for the given date.
This method answers to an AJAX request. It calculates the available hours for thegiven service, provider and date.
a json object with the available hours.
ajax_check_datetime_availability() : boolean
Check whether the provider is still available in the selected appointment date.
It might be times where two or more customers select the same appointment date and time. This shouldn't be allowed to happen, so one of the two customers will eventually get the prefered date and the other one will have to choose for another date. Use this method just before the customer confirms the appointment details. If the selected date was taken in the mean time, the customer must be prompted to select another time for his appointment.
Returns whether the selected datetime is still available.
check_installation()
This method checks whether the application is installed.
This method resides in this controller because the "index()" function will be the first to be launched after the files are on the server. NOTE that the "configuration.php" file must be already set because we won't be able to connect to the database otherwise.
get_provider_available_time_periods(\numeric $provider_id, string $selected_date, array $exclude_appointments = array()) : array
Get an array containing the free time periods (start - end) of a selected date.
This method is very important because there are many cases where the system needs to know when a provider is avaible for an appointment. This method will return an array that belongs to the selected date and contains values that have the start and the end time of an available time period.
\numeric | $provider_id | The provider's record id. |
string | $selected_date | The date to be checked (MySQL formatted string). |
array | $exclude_appointments | This array contains the ids of the appointments that will not be taken into consideration when the available time periods are calculated. |
Returns an array with the available time periods of the provider.