* @copyright Copyright (c) Alex Tselegidis * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 * @link https://easyappointments.org * @since v1.5.0 * ---------------------------------------------------------------------------- */ /** * Booking confirmation controller. * * Handles the booking confirmation related operations. * * @package Controllers */ class Booking_confirmation extends EA_Controller { /** * Booking constructor. */ public function __construct() { parent::__construct(); $this->load->model('appointments_model'); $this->load->model('providers_model'); $this->load->model('services_model'); $this->load->model('customers_model'); $this->load->library('google_sync'); } /** * Display the appointment registration success page. */ public function of() { $appointment_hash = $this->uri->segment(3); $occurrences = $this->appointments_model->get(['hash' => $appointment_hash]); if (empty($occurrences)) { redirect('appointments'); // The appointment does not exist. return; } $appointment = $occurrences[0]; $add_to_google_url = $this->google_sync->get_add_to_google_url($appointment['id']); html_vars([ 'page_title' => lang('success'), 'google_analytics_code' => setting('google_analytics_code'), 'matomo_analytics_url' => setting('matomo_analytics_url'), 'add_to_google_url' => $add_to_google_url, ]); $this->load->view('pages/booking_confirmation'); } }