diff --git a/Release Notes.txt b/Release Notes.txt
index 5e65810e..0e5a5904 100644
--- a/Release Notes.txt
+++ b/Release Notes.txt
@@ -1,5 +1,8 @@
-Vesrion 0.1
+VERSION 0.2
===========
-Includes an implementation of the basic flow for
-the appointment reservation use case and unit testing
-for the model classes of the system.
\ No newline at end of file
+- Use the PHPMailer class for sending HTML emails.
+- Includes complete Google Sync protocol.
+- Customers can book appointments only for the available hours.
+- Generation of code documentation.
+- Unit test the controller classes.
+- Minor Fixes
diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php
index 5882f11a..7a8683f0 100644
--- a/src/application/controllers/appointments.php
+++ b/src/application/controllers/appointments.php
@@ -10,14 +10,14 @@ class Appointments extends CI_Controller {
// Display the appointment booking page to the customer.
// Get business name.
$this->load->model('Settings_Model');
- $view_data['business_name'] = $this->Settings_Model->get_setting('business_name');
+ $view_data['company_name'] = $this->Settings_Model->get_setting('company_name');
// Get the available services and providers.
$this->load->model('Services_Model');
$view_data['available_services'] = $this->Services_Model->get_available_services();
$this->load->model('Providers_Model');
- $view_data['available_providers'] = $this->Providers_Model->get_available_providers(); // Provider rows contain an array of which services they can provide.
+ $view_data['available_providers'] = $this->Providers_Model->get_available_providers();
// Load the book appointment view.
$this->load->view('appointments/book', $view_data);
@@ -35,8 +35,15 @@ class Appointments extends CI_Controller {
// Send an email to the customer with the appointment info.
$this->load->library('Notifications');
- $this->notifications->send_book_success($post_data['customer'], $post_data['appointment']);
- $this->notifications->send_new_appointment($post_data['customer'], $post_data['appointment']);
+ try {
+ $this->notifications->send_book_success($post_data['customer'], $post_data['appointment']);
+ $this->notifications->send_new_appointment($post_data['customer'], $post_data['appointment']);
+ } catch (NotificationException $not_exc) {
+ $view_data['notification_error'] = '
An unexpected error occured while sending '
+ . 'you an email. Please backup the appointment details so that you can restore them '
+ . 'later.
Error: ' . $not_exc->getMessage() . '
';
+ }
+
// Load the book appointment view.
$this->load->view('appointments/book_success', $view_data);
@@ -100,8 +107,9 @@ class Appointments extends CI_Controller {
$view_data['message'] = 'Your appointment has been successfully added to Google Calendar!';
$view_data['image'] = 'success.png';
} catch (Exception $exc) {
- $view_data['message'] = 'An unexpected error occured during the sync operation:
';
$view_data['image'] = 'error.png';
}
diff --git a/src/application/controllers/google.php b/src/application/controllers/google.php
index 8fd7058a..6c9d8fe9 100644
--- a/src/application/controllers/google.php
+++ b/src/application/controllers/google.php
@@ -22,7 +22,8 @@ class Google extends CI_Controller {
session_start();
if (isset($_SESSION['sync_appointment_id'])) {
- header('Location: ' . $this->config->base_url() . 'appointments/google_sync/' . $_SESSION['sync_appointment_id'] . '?code=' . $_GET['code']);
+ header('Location: ' . $this->config->base_url() . 'appointments/google_sync/'
+ . $_SESSION['sync_appointment_id'] . '?code=' . $_GET['code']);
} else {
echo 'An error occured during the Google Calendar API authorization process.';
}
diff --git a/src/application/helpers/custom_exceptions_helper.php b/src/application/helpers/custom_exceptions_helper.php
index 482f13a2..d0de816d 100644
--- a/src/application/helpers/custom_exceptions_helper.php
+++ b/src/application/helpers/custom_exceptions_helper.php
@@ -10,5 +10,10 @@ class DatabaseException extends Exception {}
*/
class ValidationException extends Exception {}
+/**
+ * Notification Exception Class
+ */
+class NotificationException extends Exception {}
+
/* End of file exception_types_helper.php */
/* Location: ./application/helpers/exception_types_helper.php */
\ No newline at end of file
diff --git a/src/application/libraries/google-api-php-client/Google_Client.php b/src/application/libraries/external/google-api-php-client/Google_Client.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/Google_Client.php
rename to src/application/libraries/external/google-api-php-client/Google_Client.php
diff --git a/src/application/libraries/google-api-php-client/auth/Google_AssertionCredentials.php b/src/application/libraries/external/google-api-php-client/auth/Google_AssertionCredentials.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/auth/Google_AssertionCredentials.php
rename to src/application/libraries/external/google-api-php-client/auth/Google_AssertionCredentials.php
diff --git a/src/application/libraries/google-api-php-client/auth/Google_Auth.php b/src/application/libraries/external/google-api-php-client/auth/Google_Auth.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/auth/Google_Auth.php
rename to src/application/libraries/external/google-api-php-client/auth/Google_Auth.php
diff --git a/src/application/libraries/google-api-php-client/auth/Google_AuthNone.php b/src/application/libraries/external/google-api-php-client/auth/Google_AuthNone.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/auth/Google_AuthNone.php
rename to src/application/libraries/external/google-api-php-client/auth/Google_AuthNone.php
diff --git a/src/application/libraries/google-api-php-client/auth/Google_LoginTicket.php b/src/application/libraries/external/google-api-php-client/auth/Google_LoginTicket.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/auth/Google_LoginTicket.php
rename to src/application/libraries/external/google-api-php-client/auth/Google_LoginTicket.php
diff --git a/src/application/libraries/google-api-php-client/auth/Google_OAuth2.php b/src/application/libraries/external/google-api-php-client/auth/Google_OAuth2.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/auth/Google_OAuth2.php
rename to src/application/libraries/external/google-api-php-client/auth/Google_OAuth2.php
diff --git a/src/application/libraries/google-api-php-client/auth/Google_P12Signer.php b/src/application/libraries/external/google-api-php-client/auth/Google_P12Signer.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/auth/Google_P12Signer.php
rename to src/application/libraries/external/google-api-php-client/auth/Google_P12Signer.php
diff --git a/src/application/libraries/google-api-php-client/auth/Google_PemVerifier.php b/src/application/libraries/external/google-api-php-client/auth/Google_PemVerifier.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/auth/Google_PemVerifier.php
rename to src/application/libraries/external/google-api-php-client/auth/Google_PemVerifier.php
diff --git a/src/application/libraries/google-api-php-client/auth/Google_Signer.php b/src/application/libraries/external/google-api-php-client/auth/Google_Signer.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/auth/Google_Signer.php
rename to src/application/libraries/external/google-api-php-client/auth/Google_Signer.php
diff --git a/src/application/libraries/google-api-php-client/auth/Google_Verifier.php b/src/application/libraries/external/google-api-php-client/auth/Google_Verifier.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/auth/Google_Verifier.php
rename to src/application/libraries/external/google-api-php-client/auth/Google_Verifier.php
diff --git a/src/application/libraries/google-api-php-client/cache/Google_ApcCache.php b/src/application/libraries/external/google-api-php-client/cache/Google_ApcCache.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/cache/Google_ApcCache.php
rename to src/application/libraries/external/google-api-php-client/cache/Google_ApcCache.php
diff --git a/src/application/libraries/google-api-php-client/cache/Google_Cache.php b/src/application/libraries/external/google-api-php-client/cache/Google_Cache.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/cache/Google_Cache.php
rename to src/application/libraries/external/google-api-php-client/cache/Google_Cache.php
diff --git a/src/application/libraries/google-api-php-client/cache/Google_FileCache.php b/src/application/libraries/external/google-api-php-client/cache/Google_FileCache.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/cache/Google_FileCache.php
rename to src/application/libraries/external/google-api-php-client/cache/Google_FileCache.php
diff --git a/src/application/libraries/google-api-php-client/cache/Google_MemcacheCache.php b/src/application/libraries/external/google-api-php-client/cache/Google_MemcacheCache.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/cache/Google_MemcacheCache.php
rename to src/application/libraries/external/google-api-php-client/cache/Google_MemcacheCache.php
diff --git a/src/application/libraries/google-api-php-client/config.php b/src/application/libraries/external/google-api-php-client/config.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/config.php
rename to src/application/libraries/external/google-api-php-client/config.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_AdExchangeSellerService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_AdExchangeSellerService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_AdExchangeSellerService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_AdExchangeSellerService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_AdexchangebuyerService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_AdexchangebuyerService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_AdexchangebuyerService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_AdexchangebuyerService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_AdsenseService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_AdsenseService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_AdsenseService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_AdsenseService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_AdsensehostService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_AdsensehostService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_AdsensehostService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_AdsensehostService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_AnalyticsService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_AnalyticsService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_AnalyticsService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_AnalyticsService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_AndroidpublisherService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_AndroidpublisherService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_AndroidpublisherService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_AndroidpublisherService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_AuditService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_AuditService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_AuditService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_AuditService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_BigqueryService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_BigqueryService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_BigqueryService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_BigqueryService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_BloggerService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_BloggerService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_BloggerService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_BloggerService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_BooksService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_BooksService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_BooksService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_BooksService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_CalendarService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_CalendarService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_CalendarService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_CalendarService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_ComputeService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_ComputeService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_ComputeService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_ComputeService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_CustomsearchService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_CustomsearchService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_CustomsearchService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_CustomsearchService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_DfareportingService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_DfareportingService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_DfareportingService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_DfareportingService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_DriveService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_DriveService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_DriveService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_DriveService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_FreebaseService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_FreebaseService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_FreebaseService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_FreebaseService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_FusiontablesService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_FusiontablesService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_FusiontablesService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_FusiontablesService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_GanService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_GanService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_GanService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_GanService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_GroupssettingsService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_GroupssettingsService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_GroupssettingsService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_GroupssettingsService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_LatitudeService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_LatitudeService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_LatitudeService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_LatitudeService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_LicensingService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_LicensingService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_LicensingService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_LicensingService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_ModeratorService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_ModeratorService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_ModeratorService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_ModeratorService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_Oauth2Service.php b/src/application/libraries/external/google-api-php-client/contrib/Google_Oauth2Service.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_Oauth2Service.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_Oauth2Service.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_OrkutService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_OrkutService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_OrkutService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_OrkutService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_PagespeedonlineService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_PagespeedonlineService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_PagespeedonlineService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_PagespeedonlineService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_PlusService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_PlusService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_PlusService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_PlusService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_PredictionService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_PredictionService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_PredictionService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_PredictionService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_ResellerService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_ResellerService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_ResellerService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_ResellerService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_ShoppingService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_ShoppingService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_ShoppingService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_ShoppingService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_SiteVerificationService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_SiteVerificationService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_SiteVerificationService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_SiteVerificationService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_StorageService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_StorageService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_StorageService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_StorageService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_TaskqueueService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_TaskqueueService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_TaskqueueService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_TaskqueueService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_TasksService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_TasksService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_TasksService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_TasksService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_TranslateService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_TranslateService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_TranslateService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_TranslateService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_UrlshortenerService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_UrlshortenerService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_UrlshortenerService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_UrlshortenerService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_WebfontsService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_WebfontsService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_WebfontsService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_WebfontsService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_YouTubeAnalyticsService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_YouTubeAnalyticsService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_YouTubeAnalyticsService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_YouTubeAnalyticsService.php
diff --git a/src/application/libraries/google-api-php-client/contrib/Google_YouTubeService.php b/src/application/libraries/external/google-api-php-client/contrib/Google_YouTubeService.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/contrib/Google_YouTubeService.php
rename to src/application/libraries/external/google-api-php-client/contrib/Google_YouTubeService.php
diff --git a/src/application/libraries/google-api-php-client/external/URITemplateParser.php b/src/application/libraries/external/google-api-php-client/external/URITemplateParser.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/external/URITemplateParser.php
rename to src/application/libraries/external/google-api-php-client/external/URITemplateParser.php
diff --git a/src/application/libraries/google-api-php-client/io/Google_CacheParser.php b/src/application/libraries/external/google-api-php-client/io/Google_CacheParser.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/io/Google_CacheParser.php
rename to src/application/libraries/external/google-api-php-client/io/Google_CacheParser.php
diff --git a/src/application/libraries/google-api-php-client/io/Google_CurlIO.php b/src/application/libraries/external/google-api-php-client/io/Google_CurlIO.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/io/Google_CurlIO.php
rename to src/application/libraries/external/google-api-php-client/io/Google_CurlIO.php
diff --git a/src/application/libraries/google-api-php-client/io/Google_HttpRequest.php b/src/application/libraries/external/google-api-php-client/io/Google_HttpRequest.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/io/Google_HttpRequest.php
rename to src/application/libraries/external/google-api-php-client/io/Google_HttpRequest.php
diff --git a/src/application/libraries/google-api-php-client/io/Google_IO.php b/src/application/libraries/external/google-api-php-client/io/Google_IO.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/io/Google_IO.php
rename to src/application/libraries/external/google-api-php-client/io/Google_IO.php
diff --git a/src/application/libraries/google-api-php-client/io/Google_REST.php b/src/application/libraries/external/google-api-php-client/io/Google_REST.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/io/Google_REST.php
rename to src/application/libraries/external/google-api-php-client/io/Google_REST.php
diff --git a/src/application/libraries/google-api-php-client/io/cacerts.pem b/src/application/libraries/external/google-api-php-client/io/cacerts.pem
similarity index 100%
rename from src/application/libraries/google-api-php-client/io/cacerts.pem
rename to src/application/libraries/external/google-api-php-client/io/cacerts.pem
diff --git a/src/application/libraries/google-api-php-client/service/Google_BatchRequest.php b/src/application/libraries/external/google-api-php-client/service/Google_BatchRequest.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/service/Google_BatchRequest.php
rename to src/application/libraries/external/google-api-php-client/service/Google_BatchRequest.php
diff --git a/src/application/libraries/google-api-php-client/service/Google_MediaFileUpload.php b/src/application/libraries/external/google-api-php-client/service/Google_MediaFileUpload.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/service/Google_MediaFileUpload.php
rename to src/application/libraries/external/google-api-php-client/service/Google_MediaFileUpload.php
diff --git a/src/application/libraries/google-api-php-client/service/Google_Model.php b/src/application/libraries/external/google-api-php-client/service/Google_Model.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/service/Google_Model.php
rename to src/application/libraries/external/google-api-php-client/service/Google_Model.php
diff --git a/src/application/libraries/google-api-php-client/service/Google_Service.php b/src/application/libraries/external/google-api-php-client/service/Google_Service.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/service/Google_Service.php
rename to src/application/libraries/external/google-api-php-client/service/Google_Service.php
diff --git a/src/application/libraries/google-api-php-client/service/Google_ServiceResource.php b/src/application/libraries/external/google-api-php-client/service/Google_ServiceResource.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/service/Google_ServiceResource.php
rename to src/application/libraries/external/google-api-php-client/service/Google_ServiceResource.php
diff --git a/src/application/libraries/google-api-php-client/service/Google_Utils.php b/src/application/libraries/external/google-api-php-client/service/Google_Utils.php
similarity index 100%
rename from src/application/libraries/google-api-php-client/service/Google_Utils.php
rename to src/application/libraries/external/google-api-php-client/service/Google_Utils.php
diff --git a/src/application/libraries/google_sync.php b/src/application/libraries/google_sync.php
index c0c7a9ba..e725a89c 100644
--- a/src/application/libraries/google_sync.php
+++ b/src/application/libraries/google_sync.php
@@ -1,8 +1,8 @@
client->authenticate($_GET['code']);
$_SESSION['google_api_token'] = $this->client->getAccessToken();
- header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); // refreshes current url
+ header('Location: http://' . $_SERVER['HTTP_HOST']
+ . $_SERVER['PHP_SELF']); // refreshes current url
}
// If there is an active token then assign it to the client object.
@@ -109,7 +110,7 @@ class Google_Sync {
$event = new Google_Event();
$event->setSummary($service['name']);
- $event->setLocation($CI->Settings_Model->get_setting('business_name'));
+ $event->setLocation($CI->Settings_Model->get_setting('company_name'));
$start = new Google_EventDateTime();
$start->setDateTime(date3339(strtotime($appointment['start_datetime'])));
diff --git a/src/application/libraries/notifications.php b/src/application/libraries/notifications.php
index 945b64df..d25ca468 100644
--- a/src/application/libraries/notifications.php
+++ b/src/application/libraries/notifications.php
@@ -1,7 +1,6 @@
CI =& get_instance();
+ }
+
+ /**
+ * Replace the email template variables.
+ *
+ * This method finds and replaces the html variables of an email
+ * template. It is used to generate dynamic HTML emails that are
+ * send as notifications to the system users.
+ *
+ * @param array $replace_array Array that contains the variables
+ * to be replaced.
+ * @param string $email_html The email template hmtl.
+ * @return string Returns the new email html that contain the variables
+ * of the $replace_array.
+ */
+ private function replace_template_variables($replace_array, $email_html) {
+ foreach($replace_array as $var=>$value) {
+ $email_html = str_replace($var, $value, $email_html);
+ }
+
+ return $email_html;
}
/**
* Send a success email to the customer that booked
* a new appointment.
*
+ * @expectedException NotificationException Raises when an unexpected
+ * error has occured when the email is send.
+ *
* @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
@@ -29,96 +54,50 @@ class Notifications {
* @return bool Returns the operation result.
*/
public function send_book_success($customer_data, $appointment_data) {
- $CI =& get_instance();
- $CI->load->model('Providers_Model');
- $CI->load->model('Services_Model');
+ $this->CI->load->model('Providers_Model');
+ $this->CI->load->model('Services_Model');
+ $this->CI->load->model('Settings_Model');
- $html = '
-
-
- Appointment Book Success!
-
-
-