From 8f90da86bee5e68c4b13c75d169f327ecb50298a Mon Sep 17 00:00:00 2001 From: "alextselegidis@gmail.com" Date: Thu, 17 Oct 2013 15:31:43 +0000 Subject: [PATCH] * Completed the installation process. * Added tooltip texts on the common controls of backend. * GUI fixes on several pages. --- src/application/config/config.php | 1 + src/application/controllers/appointments.php | 46 +++++++-------- src/application/libraries/notifications.php | 34 +++++++++-- src/application/views/appointments/book.php | 2 +- src/application/views/backend/calendar.php | 10 ++-- src/application/views/backend/customers.php | 4 +- src/application/views/backend/footer.php | 8 ++- src/application/views/backend/header.php | 15 +++-- src/application/views/backend/services.php | 20 +++---- src/application/views/backend/settings.php | 2 +- src/application/views/backend/users.php | 14 +++-- .../views/general/installation.php | 27 +++++++++ src/assets/css/backend.css | 54 +++++++++++++++--- src/assets/js/backend_calendar.js | 56 +++++++++++-------- src/assets/js/backend_customers.js | 12 ++-- src/assets/js/backend_services.js | 4 +- src/assets/js/backend_settings.js | 4 ++ src/assets/js/backend_users_providers.js | 15 ++++- src/assets/js/frontend_book.js | 3 + src/assets/js/general_functions.js | 1 + src/assets/js/working_plan.js | 13 ++++- 21 files changed, 237 insertions(+), 108 deletions(-) diff --git a/src/application/config/config.php b/src/application/config/config.php index cf4496bc..e02350c7 100644 --- a/src/application/config/config.php +++ b/src/application/config/config.php @@ -19,6 +19,7 @@ include dirname(dirname(dirname(__FILE__))) . '/configuration.php'; */ require_once dirname(dirname(dirname(__FILE__))) . '/configuration.php'; $config['base_url'] = SystemConfiguration::$base_url; +$config['ea_version'] = '0.6'; // This must be changed manually. /* |-------------------------------------------------------------------------- diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php index 5b17f8de..879faca6 100644 --- a/src/application/controllers/appointments.php +++ b/src/application/controllers/appointments.php @@ -646,35 +646,31 @@ class Appointments extends CI_Controller { $this->db->query($query); } - //$this->db->reconnect(); - + // Insert admin + $this->load->model('admins_model'); $admin = json_decode($_POST['admin'], true); - $admin_role_id = $this->db->get_where('ea_roles', array('slug' => DB_SLUG_ADMIN))->row()->id; - $admin = json_decode($_POST['admin'], true); - $this->db->query('INSERT INTO `ea_users` (`first_name`, `last_name`, `email`, `phone_number`, `id_roles`) VALUES ' - . '("' . $admin['first_name'] . '", "' . $admin['last_name'] . '", "' . $admin['email'] . '", "' . $admin['phone_number'] . '", "' . $admin_role_id . '");'); - $this->db->query('INSERT INTO `ea_user_settings` (`id_users`, `username`, `password`) VALUES ' - . '("' . $this->db->insert_id() . '", "' . $admin['username'] . '", "' . $admin['password'] . '");'); - -// // Insert admin -// $this->load->model('admins_model'); -// $admin = json_decode($_POST['admin'], true); -// $admin['settings']['username'] = $admin['username']; -// $admin['settings']['password'] = $admin['password']; -// unset($admin['username'], $admin['password']); -// $this->admins_model->add($admin); + $admin['settings']['username'] = $admin['username']; + $admin['settings']['password'] = $admin['password']; + unset($admin['username'], $admin['password']); + $this->admins_model->add($admin); // Save company settings + $this->load->model('settings_model'); $company = json_decode($_POST['company'], true); - $this->db->query('INSERT INTO `ea_settings` (`name`, `value`) VALUES ' - . '("company_name", "' . $company['company_name'] . '"),' - . '("company_email", "' . $company['company_email'] . '"),' - . '("company_link", "' . $company['company_link'] . '");'); -// $this->load->model('settings_model'); -// $company = json_decode($_POST['company'], true); -// $this->settings_model->set_setting('company_name', $company['company_name']); -// $this->settings_model->set_setting('company_email', $company['company_email']); -// $this->settings_model->set_setting('company_link', $company['company_link']); + $this->settings_model->set_setting('company_name', $company['company_name']); + $this->settings_model->set_setting('company_email', $company['company_email']); + $this->settings_model->set_setting('company_link', $company['company_link']); + + // Try to send a notification email for the new installation. + // IMPORTANT: THIS WILL ONLY BE USED TO TRACK THE INSTALLATION NUMBER AND + // NO PERSONAL DATA WILL BE USED FOR OTHER CAUSE. + try { + $this->load->library('notifications'); + $this->notifications->send_new_installation($company['company_name'], + $company['company_email'], $company['company_link']); + } catch(Exception $exc) { + // Well, I guess we'll never know ... + } echo json_encode(AJAX_SUCCESS); diff --git a/src/application/libraries/notifications.php b/src/application/libraries/notifications.php index 26dfed65..38d30124 100644 --- a/src/application/libraries/notifications.php +++ b/src/application/libraries/notifications.php @@ -188,13 +188,13 @@ class Notifications { // :: SETUP EMAIL OBJECT AND SEND NOTIFICATION $mail = new PHPMailer(); - $mail->From = $company_settings['company_email']; - $mail->FromName = $company_settings['company_name']; + $mail->From = $company_settings['company_email']; + $mail->FromName = $company_settings['company_name']; $mail->AddAddress($email); // "Name" argument crushes the phpmailer class. $mail->IsHTML(true); - $mail->CharSet = 'UTF-8'; - $mail->Subject = 'New Account Password'; - $mail->Body = $email_html; + $mail->CharSet = 'UTF-8'; + $mail->Subject = 'New Account Password'; + $mail->Body = $email_html; if (!$mail->Send()) { throw new Exception('Email could not been sent. ' @@ -203,6 +203,30 @@ class Notifications { return TRUE; } + + /** + * Sends a simple email to notify for a new installation. + * + * This method will be only used for tracking the number of installations. No personal + * data will be retrieved for any other cause. + * + * @returns bool Returns the "send()" method result. + */ + public function send_new_installation($company_name, $company_email, $company_link) { + $mail = new PHPMailer(); + $mail->From = $company_email; + $mail->FromName = 'New Installation: ' . $company_name ; + $mail->AddAddress('info@easyappointments.org'); + $mail->IsHTML(true); + $mail->CharSet = 'UTF-8'; + $mail->Subject = 'New Easy!Appointments Installation'; + $mail->Body = 'Base URL: ' . $this->CI->config->item('base_url') . '
' + . 'E!A Version: ' . $this->CI->config->item('ea_version') . '
' + . 'Company Name: ' . $company_name . '
' + . 'Company Email: ' . $company_email . '
' + . 'Company Link: ' . $company_link . '
'; + return $mail->Send(); + } } /* End of file notifications.php */ diff --git a/src/application/views/appointments/book.php b/src/application/views/appointments/book.php index 81a1b769..b8c6c9b9 100644 --- a/src/application/views/appointments/book.php +++ b/src/application/views/appointments/book.php @@ -1,7 +1,7 @@ - Book Appointment | <?php echo $company_name; ?> + Book Appointment With <?php echo $company_name; ?>
- +
@@ -100,16 +100,16 @@
- +
- +
- +
- +
diff --git a/src/application/views/backend/customers.php b/src/application/views/backend/customers.php index 32da9076..418ab005 100644 --- a/src/application/views/backend/customers.php +++ b/src/application/views/backend/customers.php @@ -26,7 +26,7 @@
- +
-
+
diff --git a/src/application/views/backend/footer.php b/src/application/views/backend/footer.php index 82641920..4a7fb08f 100644 --- a/src/application/views/backend/footer.php +++ b/src/application/views/backend/footer.php @@ -1,8 +1,10 @@