Moved all the loader commands to the constructors
This commit is contained in:
parent
e31aec1ab5
commit
e084ee913f
10 changed files with 61 additions and 115 deletions
|
@ -26,7 +26,6 @@ class Appointments extends EA_Controller {
|
||||||
|
|
||||||
$this->load->helper('installation');
|
$this->load->helper('installation');
|
||||||
$this->load->helper('google_analytics');
|
$this->load->helper('google_analytics');
|
||||||
|
|
||||||
$this->load->model('appointments_model');
|
$this->load->model('appointments_model');
|
||||||
$this->load->model('providers_model');
|
$this->load->model('providers_model');
|
||||||
$this->load->model('admins_model');
|
$this->load->model('admins_model');
|
||||||
|
@ -34,12 +33,10 @@ class Appointments extends EA_Controller {
|
||||||
$this->load->model('services_model');
|
$this->load->model('services_model');
|
||||||
$this->load->model('customers_model');
|
$this->load->model('customers_model');
|
||||||
$this->load->model('settings_model');
|
$this->load->model('settings_model');
|
||||||
|
|
||||||
$this->load->library('timezones');
|
$this->load->library('timezones');
|
||||||
$this->load->library('synchronization');
|
$this->load->library('synchronization');
|
||||||
$this->load->library('notifications');
|
$this->load->library('notifications');
|
||||||
$this->load->library('availability');
|
$this->load->library('availability');
|
||||||
|
|
||||||
$this->load->driver('cache', ['adapter' => 'file']);
|
$this->load->driver('cache', ['adapter' => 'file']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ class Backend extends EA_Controller {
|
||||||
$this->load->model('user_model');
|
$this->load->model('user_model');
|
||||||
$this->load->model('secretaries_model');
|
$this->load->model('secretaries_model');
|
||||||
$this->load->model('admins_model');
|
$this->load->model('admins_model');
|
||||||
|
|
||||||
$this->load->library('timezones');
|
$this->load->library('timezones');
|
||||||
$this->load->library('migration');
|
$this->load->library('migration');
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,18 +36,21 @@ class Backend_api extends EA_Controller {
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->load->model('roles_model');
|
|
||||||
$this->load->model('appointments_model');
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
$this->load->model('admins_model');
|
$this->load->model('admins_model');
|
||||||
|
$this->load->model('appointments_model');
|
||||||
|
$this->load->model('consents_model');
|
||||||
|
$this->load->model('customers_model');
|
||||||
|
$this->load->model('providers_model');
|
||||||
|
$this->load->model('roles_model');
|
||||||
$this->load->model('secretaries_model');
|
$this->load->model('secretaries_model');
|
||||||
$this->load->model('services_model');
|
$this->load->model('services_model');
|
||||||
$this->load->model('customers_model');
|
|
||||||
$this->load->model('settings_model');
|
$this->load->model('settings_model');
|
||||||
$this->load->model('user_model');
|
$this->load->model('user_model');
|
||||||
$this->load->library('timezones');
|
$this->load->library('google_sync');
|
||||||
$this->load->library('synchronization');
|
$this->load->library('ics_file');
|
||||||
$this->load->library('notifications');
|
$this->load->library('notifications');
|
||||||
|
$this->load->library('synchronization');
|
||||||
|
$this->load->library('timezones');
|
||||||
|
|
||||||
if ($this->session->userdata('role_slug'))
|
if ($this->session->userdata('role_slug'))
|
||||||
{
|
{
|
||||||
|
@ -113,7 +116,6 @@ class Backend_api extends EA_Controller {
|
||||||
// If the current user is a secretary he must only see the appointments of his providers.
|
// If the current user is a secretary he must only see the appointments of his providers.
|
||||||
if ($role_slug === DB_SLUG_SECRETARY)
|
if ($role_slug === DB_SLUG_SECRETARY)
|
||||||
{
|
{
|
||||||
$this->load->model('secretaries_model');
|
|
||||||
$providers = $this->secretaries_model->get_row($user_id)['providers'];
|
$providers = $this->secretaries_model->get_row($user_id)['providers'];
|
||||||
foreach ($response['appointments'] as $index => $appointment)
|
foreach ($response['appointments'] as $index => $appointment)
|
||||||
{
|
{
|
||||||
|
@ -349,14 +351,6 @@ class Backend_api extends EA_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store appointment data for later use in this method.
|
// Store appointment data for later use in this method.
|
||||||
$this->load->model('appointments_model');
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
$this->load->model('admins_model');
|
|
||||||
$this->load->model('secretaries_model');
|
|
||||||
$this->load->model('customers_model');
|
|
||||||
$this->load->model('services_model');
|
|
||||||
$this->load->model('settings_model');
|
|
||||||
|
|
||||||
$appointment = $this->appointments_model->get_row($this->input->post('appointment_id'));
|
$appointment = $this->appointments_model->get_row($this->input->post('appointment_id'));
|
||||||
$provider = $this->providers_model->get_row($appointment['id_users_provider']);
|
$provider = $this->providers_model->get_row($appointment['id_users_provider']);
|
||||||
$customer = $this->customers_model->get_row($appointment['id_users_customer']);
|
$customer = $this->customers_model->get_row($appointment['id_users_customer']);
|
||||||
|
@ -384,7 +378,6 @@ class Backend_api extends EA_Controller {
|
||||||
{
|
{
|
||||||
$google_token = json_decode($this->providers_model
|
$google_token = json_decode($this->providers_model
|
||||||
->get_setting('google_token', $provider['id']));
|
->get_setting('google_token', $provider['id']));
|
||||||
$this->load->library('Google_sync');
|
|
||||||
$this->google_sync->refresh_token($google_token->refresh_token);
|
$this->google_sync->refresh_token($google_token->refresh_token);
|
||||||
$this->google_sync->delete_appointment($provider, $appointment['id_google_calendar']);
|
$this->google_sync->delete_appointment($provider, $appointment['id_google_calendar']);
|
||||||
}
|
}
|
||||||
|
@ -512,8 +505,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
$this->load->model('appointments_model');
|
|
||||||
$this->providers_model->set_setting('google_sync', FALSE, $this->input->post('provider_id'));
|
$this->providers_model->set_setting('google_sync', FALSE, $this->input->post('provider_id'));
|
||||||
$this->providers_model->set_setting('google_token', NULL, $this->input->post('provider_id'));
|
$this->providers_model->set_setting('google_token', NULL, $this->input->post('provider_id'));
|
||||||
$this->appointments_model->clear_google_sync_ids($this->input->post('provider_id'));
|
$this->appointments_model->clear_google_sync_ids($this->input->post('provider_id'));
|
||||||
|
@ -549,11 +540,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('appointments_model');
|
|
||||||
$this->load->model('services_model');
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
$this->load->model('customers_model');
|
|
||||||
|
|
||||||
$key = $this->db->escape_str($this->input->post('key'));
|
$key = $this->db->escape_str($this->input->post('key'));
|
||||||
$key = strtoupper($key);
|
$key = strtoupper($key);
|
||||||
|
|
||||||
|
@ -627,9 +613,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('appointments_model');
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
|
|
||||||
$provider = $this->providers_model->get_row($unavailable['id_users_provider']);
|
$provider = $this->providers_model->get_row($unavailable['id_users_provider']);
|
||||||
|
|
||||||
// Add appointment
|
// Add appointment
|
||||||
|
@ -647,7 +630,6 @@ class Backend_api extends EA_Controller {
|
||||||
$google_token = json_decode($this->providers_model->get_setting('google_token',
|
$google_token = json_decode($this->providers_model->get_setting('google_token',
|
||||||
$unavailable['id_users_provider']));
|
$unavailable['id_users_provider']));
|
||||||
|
|
||||||
$this->load->library('google_sync');
|
|
||||||
$this->google_sync->refresh_token($google_token->refresh_token);
|
$this->google_sync->refresh_token($google_token->refresh_token);
|
||||||
|
|
||||||
if ($unavailable['id_google_calendar'] == NULL)
|
if ($unavailable['id_google_calendar'] == NULL)
|
||||||
|
@ -709,9 +691,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('appointments_model');
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
|
|
||||||
$unavailable = $this->appointments_model->get_row($this->input->post('unavailable_id'));
|
$unavailable = $this->appointments_model->get_row($this->input->post('unavailable_id'));
|
||||||
$provider = $this->providers_model->get_row($unavailable['id_users_provider']);
|
$provider = $this->providers_model->get_row($unavailable['id_users_provider']);
|
||||||
|
|
||||||
|
@ -725,7 +704,6 @@ class Backend_api extends EA_Controller {
|
||||||
if ($google_sync == TRUE)
|
if ($google_sync == TRUE)
|
||||||
{
|
{
|
||||||
$google_token = json_decode($this->providers_model->get_setting('google_token', $provider['id']));
|
$google_token = json_decode($this->providers_model->get_setting('google_token', $provider['id']));
|
||||||
$this->load->library('google_sync');
|
|
||||||
$this->google_sync->refresh_token($google_token->refresh_token);
|
$this->google_sync->refresh_token($google_token->refresh_token);
|
||||||
$this->google_sync->delete_unavailable($provider, $unavailable['id_google_calendar']);
|
$this->google_sync->delete_unavailable($provider, $unavailable['id_google_calendar']);
|
||||||
}
|
}
|
||||||
|
@ -778,8 +756,6 @@ class Backend_api extends EA_Controller {
|
||||||
$working_plan_exception = $this->input->post('working_plan_exception');
|
$working_plan_exception = $this->input->post('working_plan_exception');
|
||||||
$provider_id = $this->input->post('provider_id');
|
$provider_id = $this->input->post('provider_id');
|
||||||
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
|
|
||||||
$success = $this->providers_model->save_working_plan_exception($date, $working_plan_exception, $provider_id);
|
$success = $this->providers_model->save_working_plan_exception($date, $working_plan_exception, $provider_id);
|
||||||
|
|
||||||
if ($success)
|
if ($success)
|
||||||
|
@ -824,8 +800,6 @@ class Backend_api extends EA_Controller {
|
||||||
$date = $this->input->post('date');
|
$date = $this->input->post('date');
|
||||||
$provider_id = $this->input->post('provider_id');
|
$provider_id = $this->input->post('provider_id');
|
||||||
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
|
|
||||||
$success = $this->providers_model->delete_working_plan_exception($date, $provider_id);
|
$success = $this->providers_model->delete_working_plan_exception($date, $provider_id);
|
||||||
|
|
||||||
if ($success)
|
if ($success)
|
||||||
|
@ -859,7 +833,6 @@ class Backend_api extends EA_Controller {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->load->model('customers_model');
|
|
||||||
$customer = json_decode($this->input->post('customer'), TRUE);
|
$customer = json_decode($this->input->post('customer'), TRUE);
|
||||||
|
|
||||||
$required_privileges = ( ! isset($customer['id']))
|
$required_privileges = ( ! isset($customer['id']))
|
||||||
|
@ -904,8 +877,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('customers_model');
|
|
||||||
|
|
||||||
$this->customers_model->delete($this->input->post('customer_id'));
|
$this->customers_model->delete($this->input->post('customer_id'));
|
||||||
|
|
||||||
$response = AJAX_SUCCESS;
|
$response = AJAX_SUCCESS;
|
||||||
|
@ -932,7 +903,6 @@ class Backend_api extends EA_Controller {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->load->model('services_model');
|
|
||||||
$service = json_decode($this->input->post('service'), TRUE);
|
$service = json_decode($this->input->post('service'), TRUE);
|
||||||
|
|
||||||
$required_privileges = ( ! isset($service['id']))
|
$required_privileges = ( ! isset($service['id']))
|
||||||
|
@ -976,8 +946,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('services_model');
|
|
||||||
|
|
||||||
$result = $this->services_model->delete($this->input->post('service_id'));
|
$result = $this->services_model->delete($this->input->post('service_id'));
|
||||||
|
|
||||||
$response = $result ? AJAX_SUCCESS : AJAX_FAILURE;
|
$response = $result ? AJAX_SUCCESS : AJAX_FAILURE;
|
||||||
|
@ -1009,8 +977,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('services_model');
|
|
||||||
|
|
||||||
$key = $this->db->escape_str($this->input->post('key'));
|
$key = $this->db->escape_str($this->input->post('key'));
|
||||||
|
|
||||||
$where =
|
$where =
|
||||||
|
@ -1042,7 +1008,6 @@ class Backend_api extends EA_Controller {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->load->model('services_model');
|
|
||||||
$category = json_decode($this->input->post('category'), TRUE);
|
$category = json_decode($this->input->post('category'), TRUE);
|
||||||
|
|
||||||
$required_privileges = ( ! isset($category['id']))
|
$required_privileges = ( ! isset($category['id']))
|
||||||
|
@ -1087,8 +1052,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('services_model');
|
|
||||||
|
|
||||||
$result = $this->services_model->delete_category($this->input->post('category_id'));
|
$result = $this->services_model->delete_category($this->input->post('category_id'));
|
||||||
|
|
||||||
$response = $result ? AJAX_SUCCESS : AJAX_FAILURE;
|
$response = $result ? AJAX_SUCCESS : AJAX_FAILURE;
|
||||||
|
@ -1120,8 +1083,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('services_model');
|
|
||||||
|
|
||||||
$key = $this->db->escape_str($this->input->post('key'));
|
$key = $this->db->escape_str($this->input->post('key'));
|
||||||
|
|
||||||
$where = '(name LIKE "%' . $key . '%" OR description LIKE "%' . $key . '%")';
|
$where = '(name LIKE "%' . $key . '%" OR description LIKE "%' . $key . '%")';
|
||||||
|
@ -1155,8 +1116,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('admins_model');
|
|
||||||
|
|
||||||
$key = $this->db->escape_str($this->input->post('key'));
|
$key = $this->db->escape_str($this->input->post('key'));
|
||||||
|
|
||||||
$where =
|
$where =
|
||||||
|
@ -1190,7 +1149,6 @@ class Backend_api extends EA_Controller {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->load->model('admins_model');
|
|
||||||
$admin = json_decode($this->input->post('admin'), TRUE);
|
$admin = json_decode($this->input->post('admin'), TRUE);
|
||||||
|
|
||||||
$required_privileges = ( ! isset($admin['id']))
|
$required_privileges = ( ! isset($admin['id']))
|
||||||
|
@ -1235,8 +1193,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('admins_model');
|
|
||||||
|
|
||||||
$result = $this->admins_model->delete($this->input->post('admin_id'));
|
$result = $this->admins_model->delete($this->input->post('admin_id'));
|
||||||
|
|
||||||
$response = $result ? AJAX_SUCCESS : AJAX_FAILURE;
|
$response = $result ? AJAX_SUCCESS : AJAX_FAILURE;
|
||||||
|
@ -1268,8 +1224,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
|
|
||||||
$key = $this->db->escape_str($this->input->post('key'));
|
$key = $this->db->escape_str($this->input->post('key'));
|
||||||
|
|
||||||
$where =
|
$where =
|
||||||
|
@ -1303,7 +1257,6 @@ class Backend_api extends EA_Controller {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->load->model('providers_model');
|
|
||||||
$provider = json_decode($this->input->post('provider'), TRUE);
|
$provider = json_decode($this->input->post('provider'), TRUE);
|
||||||
|
|
||||||
$required_privileges = ( ! isset($provider['id']))
|
$required_privileges = ( ! isset($provider['id']))
|
||||||
|
@ -1316,7 +1269,6 @@ class Backend_api extends EA_Controller {
|
||||||
|
|
||||||
if ( ! isset($provider['settings']['working_plan']))
|
if ( ! isset($provider['settings']['working_plan']))
|
||||||
{
|
{
|
||||||
$this->load->model('settings_model');
|
|
||||||
$provider['settings']['working_plan'] = $this->settings_model
|
$provider['settings']['working_plan'] = $this->settings_model
|
||||||
->get_setting('company_working_plan');
|
->get_setting('company_working_plan');
|
||||||
}
|
}
|
||||||
|
@ -1355,8 +1307,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
|
|
||||||
$result = $this->providers_model->delete($this->input->post('provider_id'));
|
$result = $this->providers_model->delete($this->input->post('provider_id'));
|
||||||
|
|
||||||
$response =$result ? AJAX_SUCCESS : AJAX_FAILURE;
|
$response =$result ? AJAX_SUCCESS : AJAX_FAILURE;
|
||||||
|
@ -1388,8 +1338,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('secretaries_model');
|
|
||||||
|
|
||||||
$key = $this->db->escape_str($this->input->post('key'));
|
$key = $this->db->escape_str($this->input->post('key'));
|
||||||
|
|
||||||
$where =
|
$where =
|
||||||
|
@ -1423,7 +1371,6 @@ class Backend_api extends EA_Controller {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->load->model('secretaries_model');
|
|
||||||
$secretary = json_decode($this->input->post('secretary'), TRUE);
|
$secretary = json_decode($this->input->post('secretary'), TRUE);
|
||||||
|
|
||||||
$required_privileges = ( ! isset($secretary['id']))
|
$required_privileges = ( ! isset($secretary['id']))
|
||||||
|
@ -1468,8 +1415,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('secretaries_model');
|
|
||||||
|
|
||||||
$result = $this->secretaries_model->delete($this->input->post('secretary_id'));
|
$result = $this->secretaries_model->delete($this->input->post('secretary_id'));
|
||||||
|
|
||||||
$response =$result ? AJAX_SUCCESS : AJAX_FAILURE;
|
$response =$result ? AJAX_SUCCESS : AJAX_FAILURE;
|
||||||
|
@ -1503,8 +1448,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('settings_model');
|
|
||||||
|
|
||||||
$settings = json_decode($this->input->post('settings', FALSE), TRUE);
|
$settings = json_decode($this->input->post('settings', FALSE), TRUE);
|
||||||
|
|
||||||
$this->settings_model->save_settings($settings);
|
$this->settings_model->save_settings($settings);
|
||||||
|
@ -1518,8 +1461,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('user_model');
|
|
||||||
|
|
||||||
$settings = json_decode($this->input->post('settings'), TRUE);
|
$settings = json_decode($this->input->post('settings'), TRUE);
|
||||||
|
|
||||||
$this->user_model->save_user($settings);
|
$this->user_model->save_user($settings);
|
||||||
|
@ -1558,9 +1499,6 @@ class Backend_api extends EA_Controller {
|
||||||
{
|
{
|
||||||
// We will only use the function in the admins_model because it is sufficient for the rest user types for
|
// We will only use the function in the admins_model because it is sufficient for the rest user types for
|
||||||
// now (providers, secretaries).
|
// now (providers, secretaries).
|
||||||
|
|
||||||
$this->load->model('admins_model');
|
|
||||||
|
|
||||||
$is_valid = $this->admins_model->validate_username($this->input->post('username'),
|
$is_valid = $this->admins_model->validate_username($this->input->post('username'),
|
||||||
$this->input->post('user_id'));
|
$this->input->post('user_id'));
|
||||||
|
|
||||||
|
@ -1637,9 +1575,6 @@ class Backend_api extends EA_Controller {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->load->library('google_sync');
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
|
|
||||||
if ( ! $this->input->post('provider_id'))
|
if ( ! $this->input->post('provider_id'))
|
||||||
{
|
{
|
||||||
throw new Exception('Provider id is required in order to fetch the google calendars.');
|
throw new Exception('Provider id is required in order to fetch the google calendars.');
|
||||||
|
@ -1693,8 +1628,6 @@ class Backend_api extends EA_Controller {
|
||||||
throw new Exception('You do not have the required privileges for this task.');
|
throw new Exception('You do not have the required privileges for this task.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
|
|
||||||
$result = $this->providers_model->set_setting('google_calendar', $this->input->post('calendar_id'),
|
$result = $this->providers_model->set_setting('google_calendar', $this->input->post('calendar_id'),
|
||||||
$this->input->post('provider_id'));
|
$this->input->post('provider_id'));
|
||||||
|
|
||||||
|
@ -1729,8 +1662,6 @@ class Backend_api extends EA_Controller {
|
||||||
|
|
||||||
$working_plan = $this->input->post('working_plan');
|
$working_plan = $this->input->post('working_plan');
|
||||||
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
|
|
||||||
$providers = $this->providers_model->get_batch();
|
$providers = $this->providers_model->get_batch();
|
||||||
|
|
||||||
foreach ($providers as $provider)
|
foreach ($providers as $provider)
|
||||||
|
|
|
@ -19,6 +19,15 @@
|
||||||
* @package Controllers
|
* @package Controllers
|
||||||
*/
|
*/
|
||||||
class Consents extends EA_Controller {
|
class Consents extends EA_Controller {
|
||||||
|
/**
|
||||||
|
* Consents constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->model('consents_model');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the user's consent.
|
* Save the user's consent.
|
||||||
*/
|
*/
|
||||||
|
@ -26,8 +35,6 @@ class Consents extends EA_Controller {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->load->model('consents_model');
|
|
||||||
|
|
||||||
$consent = $this->input->post('consent');
|
$consent = $this->input->post('consent');
|
||||||
|
|
||||||
$consent['ip'] = $this->input->ip_address();
|
$consent['ip'] = $this->input->ip_address();
|
||||||
|
|
|
@ -31,8 +31,8 @@ class Console extends EA_Controller {
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->load->helper('file');
|
|
||||||
$this->load->dbutil();
|
$this->load->dbutil();
|
||||||
|
$this->load->helper('file');
|
||||||
$this->load->library('migration');
|
$this->load->library('migration');
|
||||||
$this->load->model('admins_model');
|
$this->load->model('admins_model');
|
||||||
$this->load->model('customers_model');
|
$this->load->model('customers_model');
|
||||||
|
|
|
@ -17,6 +17,13 @@
|
||||||
* @package Controllers
|
* @package Controllers
|
||||||
*/
|
*/
|
||||||
class Errors extends EA_Controller {
|
class Errors extends EA_Controller {
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->helper('google_analytics');
|
||||||
|
$this->load->model('settings_model');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the 404 error page.
|
* Display the 404 error page.
|
||||||
*/
|
*/
|
||||||
|
@ -30,9 +37,6 @@ class Errors extends EA_Controller {
|
||||||
*/
|
*/
|
||||||
public function error404()
|
public function error404()
|
||||||
{
|
{
|
||||||
$this->load->helper('google_analytics');
|
|
||||||
$this->load->model('settings_model');
|
|
||||||
|
|
||||||
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
||||||
|
|
||||||
$this->load->view('general/error404', $view);
|
$this->load->view('general/error404', $view);
|
||||||
|
|
|
@ -19,6 +19,16 @@
|
||||||
* @package Controllers
|
* @package Controllers
|
||||||
*/
|
*/
|
||||||
class Google extends EA_Controller {
|
class Google extends EA_Controller {
|
||||||
|
/**
|
||||||
|
* Google constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->library('google_sync');
|
||||||
|
$this->load->model('providers_model');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authorize Google Calendar API usage for a specific provider.
|
* Authorize Google Calendar API usage for a specific provider.
|
||||||
*
|
*
|
||||||
|
@ -33,7 +43,6 @@ class Google extends EA_Controller {
|
||||||
$this->session->set_userdata('oauth_provider_id', $provider_id);
|
$this->session->set_userdata('oauth_provider_id', $provider_id);
|
||||||
|
|
||||||
// Redirect browser to google user content page.
|
// Redirect browser to google user content page.
|
||||||
$this->load->library('google_sync');
|
|
||||||
header('Location: ' . $this->google_sync->get_auth_url());
|
header('Location: ' . $this->google_sync->get_auth_url());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +67,6 @@ class Google extends EA_Controller {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->library('Google_sync');
|
|
||||||
|
|
||||||
$token = $this->google_sync->authenticate($code);
|
$token = $this->google_sync->authenticate($code);
|
||||||
|
|
||||||
if (empty($token))
|
if (empty($token))
|
||||||
|
@ -73,7 +80,6 @@ class Google extends EA_Controller {
|
||||||
|
|
||||||
if ($oauth_provider_id)
|
if ($oauth_provider_id)
|
||||||
{
|
{
|
||||||
$this->load->model('providers_model');
|
|
||||||
$this->providers_model->set_setting('google_sync', TRUE, $oauth_provider_id);
|
$this->providers_model->set_setting('google_sync', TRUE, $oauth_provider_id);
|
||||||
$this->providers_model->set_setting('google_token', json_encode($token), $oauth_provider_id);
|
$this->providers_model->set_setting('google_token', json_encode($token), $oauth_provider_id);
|
||||||
$this->providers_model->set_setting('google_calendar', 'primary', $oauth_provider_id);
|
$this->providers_model->set_setting('google_calendar', 'primary', $oauth_provider_id);
|
||||||
|
|
|
@ -25,8 +25,13 @@ class Installation extends EA_Controller {
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
$this->load->model('admins_model');
|
||||||
|
$this->load->model('settings_model');
|
||||||
|
$this->load->model('services_model');
|
||||||
|
$this->load->model('providers_model');
|
||||||
|
$this->load->library('migration');
|
||||||
$this->load->helper('installation');
|
$this->load->helper('installation');
|
||||||
|
$this->load->helper('string');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,13 +62,6 @@ class Installation extends EA_Controller {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('admins_model');
|
|
||||||
$this->load->model('settings_model');
|
|
||||||
$this->load->model('services_model');
|
|
||||||
$this->load->model('providers_model');
|
|
||||||
$this->load->library('migration');
|
|
||||||
$this->load->helper('string');
|
|
||||||
|
|
||||||
$admin = $this->input->post('admin');
|
$admin = $this->input->post('admin');
|
||||||
$company = $this->input->post('company');
|
$company = $this->input->post('company');
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,15 @@
|
||||||
* @package Controllers
|
* @package Controllers
|
||||||
*/
|
*/
|
||||||
class Privacy extends EA_Controller {
|
class Privacy extends EA_Controller {
|
||||||
|
/**
|
||||||
|
* Privacy constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->load->driver('cache', ['adapter' => 'file']);
|
||||||
|
$this->load->model('customers_model');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all customer data (including appointments from the system).
|
* Remove all customer data (including appointments from the system).
|
||||||
*/
|
*/
|
||||||
|
@ -31,8 +40,6 @@ class Privacy extends EA_Controller {
|
||||||
throw new InvalidArgumentException('Invalid customer token value provided.');
|
throw new InvalidArgumentException('Invalid customer token value provided.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->driver('cache', ['adapter' => 'file']);
|
|
||||||
|
|
||||||
$customer_id = $this->cache->get('customer-token-' . $customer_token);
|
$customer_id = $this->cache->get('customer-token-' . $customer_token);
|
||||||
|
|
||||||
if (empty($customer_id))
|
if (empty($customer_id))
|
||||||
|
@ -41,8 +48,6 @@ class Privacy extends EA_Controller {
|
||||||
. 'and try again.');
|
. 'and try again.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('customers_model');
|
|
||||||
|
|
||||||
$this->customers_model->delete($customer_id);
|
$this->customers_model->delete($customer_id);
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
|
|
|
@ -21,6 +21,16 @@ use EA\Engine\Types\NonEmptyText;
|
||||||
* @package Controllers
|
* @package Controllers
|
||||||
*/
|
*/
|
||||||
class User extends EA_Controller {
|
class User extends EA_Controller {
|
||||||
|
/**
|
||||||
|
* User constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->model('settings_model');
|
||||||
|
$this->load->model('user_model');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Method
|
* Default Method
|
||||||
*
|
*
|
||||||
|
@ -38,8 +48,6 @@ class User extends EA_Controller {
|
||||||
*/
|
*/
|
||||||
public function login()
|
public function login()
|
||||||
{
|
{
|
||||||
$this->load->model('settings_model');
|
|
||||||
|
|
||||||
$view['base_url'] = config('base_url');
|
$view['base_url'] = config('base_url');
|
||||||
$view['dest_url'] = $this->session->userdata('dest_url');
|
$view['dest_url'] = $this->session->userdata('dest_url');
|
||||||
|
|
||||||
|
@ -58,8 +66,6 @@ class User extends EA_Controller {
|
||||||
*/
|
*/
|
||||||
public function logout()
|
public function logout()
|
||||||
{
|
{
|
||||||
$this->load->model('settings_model');
|
|
||||||
|
|
||||||
$this->session->unset_userdata('user_id');
|
$this->session->unset_userdata('user_id');
|
||||||
$this->session->unset_userdata('user_email');
|
$this->session->unset_userdata('user_email');
|
||||||
$this->session->unset_userdata('role_slug');
|
$this->session->unset_userdata('role_slug');
|
||||||
|
@ -77,7 +83,6 @@ class User extends EA_Controller {
|
||||||
*/
|
*/
|
||||||
public function forgot_password()
|
public function forgot_password()
|
||||||
{
|
{
|
||||||
$this->load->model('settings_model');
|
|
||||||
$view['base_url'] = config('base_url');
|
$view['base_url'] = config('base_url');
|
||||||
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
||||||
$this->load->view('user/forgot_password', $view);
|
$this->load->view('user/forgot_password', $view);
|
||||||
|
@ -89,7 +94,6 @@ class User extends EA_Controller {
|
||||||
*/
|
*/
|
||||||
public function no_privileges()
|
public function no_privileges()
|
||||||
{
|
{
|
||||||
$this->load->model('settings_model');
|
|
||||||
$view['base_url'] = config('base_url');
|
$view['base_url'] = config('base_url');
|
||||||
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
||||||
$this->load->view('user/no_privileges', $view);
|
$this->load->view('user/no_privileges', $view);
|
||||||
|
@ -113,8 +117,6 @@ class User extends EA_Controller {
|
||||||
throw new Exception('Invalid credentials given!');
|
throw new Exception('Invalid credentials given!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('user_model');
|
|
||||||
|
|
||||||
$user_data = $this->user_model->check_login($this->input->post('username'), $this->input->post('password'));
|
$user_data = $this->user_model->check_login($this->input->post('username'), $this->input->post('password'));
|
||||||
|
|
||||||
if ($user_data)
|
if ($user_data)
|
||||||
|
@ -162,9 +164,6 @@ class User extends EA_Controller {
|
||||||
. 'order to get a new password!');
|
. 'order to get a new password!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->model('user_model');
|
|
||||||
$this->load->model('settings_model');
|
|
||||||
|
|
||||||
$new_password = $this->user_model->regenerate_password(
|
$new_password = $this->user_model->regenerate_password(
|
||||||
$this->input->post('username'),
|
$this->input->post('username'),
|
||||||
$this->input->post('email')
|
$this->input->post('email')
|
||||||
|
|
Loading…
Reference in a new issue