load->model('Providers_Model'); $CI->load->model('Services_Model'); $html = ' Appointment Book Success!

Your appointment has been successfully booked!

Appointment Details
Service : ' . $CI->Services_Model->get_value('name', $appointment_data['id_services']) . '
Provider : ' . $CI->Providers_Model->get_value('last_name', $appointment_data['id_users_provider']) . ' ' . $CI->Providers_Model->get_value('first_name', $appointment_data['id_users_provider']) . '
Start Date : ' . date('d/m/Y H:i', strtotime($appointment_data['start_datetime'])) . '
Duration : ' . $CI->Services_Model->get_value('duration', $appointment_data['id_services']) . ' minutes


Customer Details
Name : ' . $customer_data['last_name'] . ' ' . $customer_data['first_name'] . '
Email : ' . $customer_data['email'] . '
Phone : ' . $customer_data['phone_number'] . '
Address : ' . $customer_data['address'] . ', ' . $customer_data['city'] . ', ' . $customer_data['zip_code'] . '
'; // Send email to the customer $to = $customer_data['email']; $CI->load->model('Settings_Model'); $from_email = $CI->Settings_Model->get_setting('business_email'); $from_name = $CI->Settings_Model->get_setting('business_name'); $subject = 'Appointment Book Success!'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'To: ' . $customer_data['last_name'] . ' ' . $customer_data['first_name'] . ' <' . $customer_data['email'] . '>' . "\r\n"; $headers .= 'From: ' . $from_name . ' <' . $from_email . '>' . "\r\n"; return mail($to, $subject, $html, $headers); } /** * Send an email notification to a provider that * a new appointment has been added to his plan. * * @param array $customer_data Associative array with the customer's * data. Each key has the same name as the corresponding field in db. * @param array $appointment_data Associative array with the appointment's * data. Each key has the same name as the corresponding field in db. * @return bool Returns the operation result. */ public function send_new_appointment($customer_data, $appointment_data) { $CI =& get_instance(); $CI->load->model('Providers_Model'); $CI->load->model('Services_Model'); $html = ' A new appointment has been added to your plan.

A new appointment has been added to your plan.

Appointment Details
Service : ' . $CI->Services_Model->get_value('name', $appointment_data['id_services']) . '
Provider : ' . $CI->Providers_Model->get_value('last_name', $appointment_data['id_users_provider']) . ' ' . $CI->Providers_Model->get_value('first_name', $appointment_data['id_users_provider']) . '
Start Date : ' . date('d/m/Y H:i', strtotime($appointment_data['start_datetime'])) . '
Duration : ' . $CI->Services_Model->get_value('duration', $appointment_data['id_services']) . ' minutes


Customer Details
Name : ' . $customer_data['last_name'] . ' ' . $customer_data['first_name'] . '
Email : ' . $customer_data['email'] . '
Phone : ' . $customer_data['phone_number'] . '
Address : ' . $customer_data['address'] . ', ' . $customer_data['city'] . ', ' . $customer_data['zip_code'] . '
'; // Send email to the customer $to = $CI->Providers_Model->get_value('email', $appointment_data['id_users_provider']); $providerNicename = $CI->Providers_Model->get_value('last_name', $appointment_data['id_users_provider']) . ' ' . $CI->Providers_Model->get_value('first_name', $appointment_data['id_users_provider']); $CI->load->model('Settings_Model'); $fromEmail = $CI->Settings_Model->get_setting('business_email'); $fromName = $CI->Settings_Model->get_setting('business_name'); $subject = 'A new appointment has been added to your plan.'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'To: ' . $providerNicename . '<' . $to . '>' . "\r\n"; $headers .= 'From: ' . $fromName . ' <' . $fromEmail . '>' . "\r\n"; return mail($to, $subject, $html, $headers); } } /* End of file notifications.php */ /* Location: ./application/libraries/notifications.php */