2020-04-22 22:48:56 +03:00
|
|
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
2015-12-02 00:39:31 +02:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Easy!Appointments - Open Source Web Scheduler
|
|
|
|
*
|
|
|
|
* @package EasyAppointments
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
2020-03-11 12:10:59 +03:00
|
|
|
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
2020-11-14 22:36:25 +03:00
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
|
|
* @link https://easyappointments.org
|
2015-12-02 00:39:31 +02:00
|
|
|
* @since v1.0.0
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Backend Controller
|
|
|
|
*
|
2020-09-23 12:47:18 +03:00
|
|
|
* @property CI_Session $session
|
2020-04-22 22:48:56 +03:00
|
|
|
*
|
2015-12-02 00:39:31 +02:00
|
|
|
* @package Controllers
|
|
|
|
*/
|
2020-11-16 11:29:36 +03:00
|
|
|
class Backend extends EA_Controller {
|
2016-04-27 09:21:40 +03:00
|
|
|
/**
|
|
|
|
* Class Constructor
|
|
|
|
*/
|
2017-09-15 14:36:37 +03:00
|
|
|
public function __construct()
|
|
|
|
{
|
2015-12-02 00:39:31 +02:00
|
|
|
parent::__construct();
|
2020-11-14 22:36:25 +03:00
|
|
|
|
|
|
|
$this->load->model('appointments_model');
|
|
|
|
$this->load->model('providers_model');
|
|
|
|
$this->load->model('services_model');
|
|
|
|
$this->load->model('customers_model');
|
|
|
|
$this->load->model('settings_model');
|
|
|
|
$this->load->model('roles_model');
|
|
|
|
$this->load->model('user_model');
|
|
|
|
$this->load->model('secretaries_model');
|
|
|
|
$this->load->model('admins_model');
|
|
|
|
$this->load->library('timezones');
|
|
|
|
$this->load->library('migration');
|
2015-12-02 00:39:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the main backend page.
|
|
|
|
*
|
2017-09-06 16:22:11 +03:00
|
|
|
* This method displays the main backend page. All users login permission can view this page which displays a
|
|
|
|
* calendar with the events of the selected provider or service. If a user has more privileges he will see more
|
|
|
|
* menus at the top of the page.
|
2015-12-02 00:39:31 +02:00
|
|
|
*
|
2017-09-06 16:22:11 +03:00
|
|
|
* @param string $appointment_hash Appointment edit dialog will appear when the page loads (default '').
|
2020-04-22 22:48:56 +03:00
|
|
|
*
|
|
|
|
* @throws Exception
|
2015-12-02 00:39:31 +02:00
|
|
|
*/
|
2017-09-15 14:36:37 +03:00
|
|
|
public function index($appointment_hash = '')
|
|
|
|
{
|
2020-12-09 15:17:45 +03:00
|
|
|
$this->session->set_userdata('dest_url', site_url('backend/index' . (! empty($appointment_hash) ? '/' . $appointment_hash : '')));
|
2017-09-06 16:22:11 +03:00
|
|
|
|
2020-04-22 22:48:56 +03:00
|
|
|
if ( ! $this->has_privileges(PRIV_APPOINTMENTS))
|
2017-09-15 14:36:37 +03:00
|
|
|
{
|
2017-09-06 16:22:11 +03:00
|
|
|
return;
|
|
|
|
}
|
2015-12-02 00:39:31 +02:00
|
|
|
|
2020-05-04 14:38:28 +03:00
|
|
|
$calendar_view_query_param = $this->input->get('view');
|
|
|
|
|
|
|
|
$user_id = $this->session->userdata('user_id');
|
|
|
|
|
|
|
|
$user = $this->user_model->get_user($user_id);
|
|
|
|
|
2020-12-02 23:12:54 +03:00
|
|
|
$view['base_url'] = config('base_url');
|
2020-10-20 16:03:48 +03:00
|
|
|
$view['page_title'] = lang('calendar');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
|
|
|
|
$view['active_menu'] = PRIV_APPOINTMENTS;
|
|
|
|
$view['date_format'] = $this->settings_model->get_setting('date_format');
|
2018-03-06 14:20:47 +03:00
|
|
|
$view['time_format'] = $this->settings_model->get_setting('time_format');
|
2018-06-29 01:41:17 +03:00
|
|
|
$view['first_weekday'] = $this->settings_model->get_setting('first_weekday');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
2020-09-28 15:17:47 +03:00
|
|
|
$view['require_phone_number'] = $this->settings_model->get_setting('require_phone_number');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['available_providers'] = $this->providers_model->get_available_providers();
|
|
|
|
$view['available_services'] = $this->services_model->get_available_services();
|
|
|
|
$view['customers'] = $this->customers_model->get_batch();
|
2020-12-09 15:17:45 +03:00
|
|
|
$view['calendar_view'] = ! empty($calendar_view_query_param) ? $calendar_view_query_param : $user['settings']['calendar_view'];
|
2020-05-12 21:50:55 +03:00
|
|
|
$view['timezones'] = $this->timezones->to_array();
|
2015-12-02 00:39:31 +02:00
|
|
|
$this->set_user_data($view);
|
|
|
|
|
2017-09-15 14:36:37 +03:00
|
|
|
if ($this->session->userdata('role_slug') === DB_SLUG_SECRETARY)
|
|
|
|
{
|
2015-12-02 00:39:31 +02:00
|
|
|
$secretary = $this->secretaries_model->get_row($this->session->userdata('user_id'));
|
|
|
|
$view['secretary_providers'] = $secretary['providers'];
|
2022-02-23 14:00:39 +03:00
|
|
|
$view['available_providers'] = array_values(array_filter($view['available_providers'], function ($available_provider) use ($secretary) {
|
|
|
|
return in_array($available_provider['id'], $secretary['providers']);
|
|
|
|
}));
|
2018-01-23 12:08:37 +03:00
|
|
|
}
|
|
|
|
else
|
2017-09-15 14:36:37 +03:00
|
|
|
{
|
|
|
|
$view['secretary_providers'] = [];
|
2015-12-02 00:39:31 +02:00
|
|
|
}
|
|
|
|
|
2022-02-23 14:00:39 +03:00
|
|
|
if ($this->session->userdata('role_slug') === DB_SLUG_PROVIDER)
|
|
|
|
{
|
|
|
|
$view['available_providers'] = array_values(array_filter($view['available_providers'], function ($available_provider) use ($user_id) {
|
|
|
|
return $available_provider['id'] === $user_id;
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2017-09-15 14:36:37 +03:00
|
|
|
$results = $this->appointments_model->get_batch(['hash' => $appointment_hash]);
|
2017-09-06 16:22:11 +03:00
|
|
|
|
2017-09-15 14:36:37 +03:00
|
|
|
if ($appointment_hash !== '' && count($results) > 0)
|
|
|
|
{
|
2015-12-02 00:39:31 +02:00
|
|
|
$appointment = $results[0];
|
|
|
|
$appointment['customer'] = $this->customers_model->get_row($appointment['id_users_customer']);
|
|
|
|
$view['edit_appointment'] = $appointment; // This will display the appointment edit dialog on page load.
|
2018-01-23 12:08:37 +03:00
|
|
|
}
|
|
|
|
else
|
2017-09-15 14:36:37 +03:00
|
|
|
{
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['edit_appointment'] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->load->view('backend/header', $view);
|
|
|
|
$this->load->view('backend/calendar', $view);
|
|
|
|
$this->load->view('backend/footer', $view);
|
|
|
|
}
|
|
|
|
|
2020-04-22 22:48:56 +03:00
|
|
|
/**
|
|
|
|
* Check whether current user is logged in and has the required privileges to view a page.
|
|
|
|
*
|
|
|
|
* The backend page requires different privileges from the users to display pages. Not all pages are available to
|
|
|
|
* all users. For example secretaries should not be able to edit the system users.
|
|
|
|
*
|
|
|
|
* @param string $page This argument must match the roles field names of each section (eg "appointments", "users"
|
|
|
|
* ...).
|
|
|
|
* @param bool $redirect If the user has not the required privileges (either not logged in or insufficient role
|
|
|
|
* privileges) then the user will be redirected to another page. Set this argument to FALSE when using ajax (default
|
|
|
|
* true).
|
|
|
|
*
|
|
|
|
* @return bool Returns whether the user has the required privileges to view the page or not. If the user is not
|
|
|
|
* logged in then he will be prompted to log in. If he hasn't the required privileges then an info message will be
|
|
|
|
* displayed.
|
|
|
|
*/
|
|
|
|
protected function has_privileges($page, $redirect = TRUE)
|
|
|
|
{
|
|
|
|
// Check if user is logged in.
|
|
|
|
$user_id = $this->session->userdata('user_id');
|
|
|
|
|
|
|
|
if ($user_id == FALSE)
|
|
|
|
{
|
|
|
|
// User not logged in, display the login view.
|
|
|
|
if ($redirect)
|
|
|
|
{
|
|
|
|
header('Location: ' . site_url('user/login'));
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if the user has the required privileges for viewing the selected page.
|
|
|
|
$role_slug = $this->session->userdata('role_slug');
|
|
|
|
|
2020-04-23 21:48:20 +03:00
|
|
|
$role_privileges = $this->db->get_where('roles', ['slug' => $role_slug])->row_array();
|
2020-04-22 22:48:56 +03:00
|
|
|
|
|
|
|
if ($role_privileges[$page] < PRIV_VIEW)
|
|
|
|
{
|
|
|
|
// User does not have the permission to view the page.
|
|
|
|
if ($redirect)
|
|
|
|
{
|
|
|
|
header('Location: ' . site_url('user/no_privileges'));
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the user data in order to be available at the view and js code.
|
|
|
|
*
|
|
|
|
* @param array $view Contains the view data.
|
|
|
|
*/
|
|
|
|
protected function set_user_data(&$view)
|
|
|
|
{
|
|
|
|
$view['user_id'] = $this->session->userdata('user_id');
|
|
|
|
$view['user_email'] = $this->session->userdata('user_email');
|
|
|
|
$view['timezone'] = $this->session->userdata('timezone');
|
|
|
|
$view['role_slug'] = $this->session->userdata('role_slug');
|
|
|
|
$view['privileges'] = $this->roles_model->get_privileges($this->session->userdata('role_slug'));
|
|
|
|
}
|
|
|
|
|
2015-12-02 00:39:31 +02:00
|
|
|
/**
|
|
|
|
* Display the backend customers page.
|
|
|
|
*
|
|
|
|
* In this page the user can manage all the customer records of the system.
|
|
|
|
*/
|
2017-09-15 14:36:37 +03:00
|
|
|
public function customers()
|
|
|
|
{
|
2016-03-07 21:59:04 +02:00
|
|
|
$this->session->set_userdata('dest_url', site_url('backend/customers'));
|
2017-09-06 16:22:11 +03:00
|
|
|
|
2020-04-22 22:48:56 +03:00
|
|
|
if ( ! $this->has_privileges(PRIV_CUSTOMERS))
|
2017-09-15 14:36:37 +03:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2015-12-02 00:39:31 +02:00
|
|
|
|
2020-12-02 23:12:54 +03:00
|
|
|
$view['base_url'] = config('base_url');
|
2020-10-20 16:03:48 +03:00
|
|
|
$view['page_title'] = lang('customers');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
|
|
|
|
$view['active_menu'] = PRIV_CUSTOMERS;
|
|
|
|
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
|
|
|
$view['date_format'] = $this->settings_model->get_setting('date_format');
|
2018-03-06 14:20:47 +03:00
|
|
|
$view['time_format'] = $this->settings_model->get_setting('time_format');
|
2018-06-29 01:41:17 +03:00
|
|
|
$view['first_weekday'] = $this->settings_model->get_setting('first_weekday');
|
2019-10-18 05:37:52 +03:00
|
|
|
$view['require_phone_number'] = $this->settings_model->get_setting('require_phone_number');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['customers'] = $this->customers_model->get_batch();
|
|
|
|
$view['available_providers'] = $this->providers_model->get_available_providers();
|
|
|
|
$view['available_services'] = $this->services_model->get_available_services();
|
2020-05-12 21:50:55 +03:00
|
|
|
$view['timezones'] = $this->timezones->to_array();
|
2018-07-29 16:59:18 +03:00
|
|
|
|
|
|
|
if ($this->session->userdata('role_slug') === DB_SLUG_SECRETARY)
|
|
|
|
{
|
|
|
|
$secretary = $this->secretaries_model->get_row($this->session->userdata('user_id'));
|
|
|
|
$view['secretary_providers'] = $secretary['providers'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$view['secretary_providers'] = [];
|
|
|
|
}
|
|
|
|
|
2015-12-02 00:39:31 +02:00
|
|
|
$this->set_user_data($view);
|
|
|
|
|
|
|
|
$this->load->view('backend/header', $view);
|
|
|
|
$this->load->view('backend/customers', $view);
|
|
|
|
$this->load->view('backend/footer', $view);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays the backend services page.
|
|
|
|
*
|
2017-09-06 16:22:11 +03:00
|
|
|
* Here the admin user will be able to organize and create the services that the user will be able to book
|
|
|
|
* appointments in frontend.
|
2015-12-02 00:39:31 +02:00
|
|
|
*
|
2017-09-06 16:22:11 +03:00
|
|
|
* NOTICE: The services that each provider is able to service is managed from the backend services page.
|
2015-12-02 00:39:31 +02:00
|
|
|
*/
|
2017-09-15 14:36:37 +03:00
|
|
|
public function services()
|
|
|
|
{
|
2016-03-07 21:59:04 +02:00
|
|
|
$this->session->set_userdata('dest_url', site_url('backend/services'));
|
2017-09-06 16:22:11 +03:00
|
|
|
|
2020-04-22 22:48:56 +03:00
|
|
|
if ( ! $this->has_privileges(PRIV_SERVICES))
|
2017-09-15 14:36:37 +03:00
|
|
|
{
|
2017-09-06 16:22:11 +03:00
|
|
|
return;
|
|
|
|
}
|
2015-12-02 00:39:31 +02:00
|
|
|
|
2020-12-02 23:12:54 +03:00
|
|
|
$view['base_url'] = config('base_url');
|
2020-10-20 16:03:48 +03:00
|
|
|
$view['page_title'] = lang('services');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
|
|
|
|
$view['active_menu'] = PRIV_SERVICES;
|
|
|
|
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
|
|
|
$view['date_format'] = $this->settings_model->get_setting('date_format');
|
2018-03-06 14:20:47 +03:00
|
|
|
$view['time_format'] = $this->settings_model->get_setting('time_format');
|
2018-06-29 01:41:17 +03:00
|
|
|
$view['first_weekday'] = $this->settings_model->get_setting('first_weekday');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['services'] = $this->services_model->get_batch();
|
|
|
|
$view['categories'] = $this->services_model->get_all_categories();
|
2020-05-12 21:50:55 +03:00
|
|
|
$view['timezones'] = $this->timezones->to_array();
|
2015-12-02 00:39:31 +02:00
|
|
|
$this->set_user_data($view);
|
|
|
|
|
|
|
|
$this->load->view('backend/header', $view);
|
|
|
|
$this->load->view('backend/services', $view);
|
|
|
|
$this->load->view('backend/footer', $view);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the backend users page.
|
|
|
|
*
|
2017-09-06 16:22:11 +03:00
|
|
|
* In this page the admin user will be able to manage the system users. By this, we mean the provider, secretary and
|
|
|
|
* admin users. This is also the page where the admin defines which service can each provider provide.
|
2015-12-02 00:39:31 +02:00
|
|
|
*/
|
2017-09-15 14:36:37 +03:00
|
|
|
public function users()
|
|
|
|
{
|
2016-03-07 21:59:04 +02:00
|
|
|
$this->session->set_userdata('dest_url', site_url('backend/users'));
|
2017-09-06 16:22:11 +03:00
|
|
|
|
2020-04-22 22:48:56 +03:00
|
|
|
if ( ! $this->has_privileges(PRIV_USERS))
|
2017-09-15 14:36:37 +03:00
|
|
|
{
|
2017-09-06 16:22:11 +03:00
|
|
|
return;
|
|
|
|
}
|
2015-12-02 00:39:31 +02:00
|
|
|
|
2020-12-02 23:12:54 +03:00
|
|
|
$view['base_url'] = config('base_url');
|
2020-10-20 16:03:48 +03:00
|
|
|
$view['page_title'] = lang('users');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
|
|
|
|
$view['active_menu'] = PRIV_USERS;
|
|
|
|
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
|
|
|
$view['date_format'] = $this->settings_model->get_setting('date_format');
|
2018-03-06 14:20:47 +03:00
|
|
|
$view['time_format'] = $this->settings_model->get_setting('time_format');
|
2018-06-29 01:41:17 +03:00
|
|
|
$view['first_weekday'] = $this->settings_model->get_setting('first_weekday');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['admins'] = $this->admins_model->get_batch();
|
|
|
|
$view['providers'] = $this->providers_model->get_batch();
|
|
|
|
$view['secretaries'] = $this->secretaries_model->get_batch();
|
|
|
|
$view['services'] = $this->services_model->get_batch();
|
|
|
|
$view['working_plan'] = $this->settings_model->get_setting('company_working_plan');
|
2020-05-12 21:50:55 +03:00
|
|
|
$view['timezones'] = $this->timezones->to_array();
|
2020-10-20 16:03:48 +03:00
|
|
|
$view['working_plan_exceptions'] = '{}';
|
2015-12-02 00:39:31 +02:00
|
|
|
$this->set_user_data($view);
|
|
|
|
|
|
|
|
$this->load->view('backend/header', $view);
|
|
|
|
$this->load->view('backend/users', $view);
|
|
|
|
$this->load->view('backend/footer', $view);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the user/system settings.
|
|
|
|
*
|
2017-09-06 16:22:11 +03:00
|
|
|
* This page will display the user settings (name, password etc). If current user is an administrator, then he will
|
|
|
|
* be able to make change to the current Easy!Appointment installation (core settings like company name, book
|
|
|
|
* timeout etc).
|
2015-12-02 00:39:31 +02:00
|
|
|
*/
|
2017-09-15 14:36:37 +03:00
|
|
|
public function settings()
|
|
|
|
{
|
2016-03-07 21:59:04 +02:00
|
|
|
$this->session->set_userdata('dest_url', site_url('backend/settings'));
|
2020-04-22 22:48:56 +03:00
|
|
|
if ( ! $this->has_privileges(PRIV_SYSTEM_SETTINGS, FALSE)
|
|
|
|
&& ! $this->has_privileges(PRIV_USER_SETTINGS))
|
2017-09-15 14:36:37 +03:00
|
|
|
{
|
2017-09-06 16:22:11 +03:00
|
|
|
return;
|
|
|
|
}
|
2015-12-02 00:39:31 +02:00
|
|
|
|
|
|
|
$user_id = $this->session->userdata('user_id');
|
|
|
|
|
2020-12-02 23:12:54 +03:00
|
|
|
$view['base_url'] = config('base_url');
|
2020-10-20 16:03:48 +03:00
|
|
|
$view['page_title'] = lang('settings');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['user_display_name'] = $this->user_model->get_user_display_name($user_id);
|
|
|
|
$view['active_menu'] = PRIV_SYSTEM_SETTINGS;
|
|
|
|
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
|
|
|
$view['date_format'] = $this->settings_model->get_setting('date_format');
|
2018-07-06 02:21:24 +03:00
|
|
|
$view['first_weekday'] = $this->settings_model->get_setting('first_weekday');
|
2018-03-06 14:20:47 +03:00
|
|
|
$view['time_format'] = $this->settings_model->get_setting('time_format');
|
2015-12-02 00:39:31 +02:00
|
|
|
$view['role_slug'] = $this->session->userdata('role_slug');
|
|
|
|
$view['system_settings'] = $this->settings_model->get_settings();
|
2020-04-22 22:48:56 +03:00
|
|
|
$view['user_settings'] = $this->user_model->get_user($user_id);
|
2020-05-12 21:50:55 +03:00
|
|
|
$view['timezones'] = $this->timezones->to_array();
|
2020-06-05 21:36:40 +03:00
|
|
|
|
|
|
|
// book_advance_timeout preview
|
|
|
|
$book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout');
|
|
|
|
$hours = floor($book_advance_timeout / 60);
|
|
|
|
$minutes = $book_advance_timeout % 60;
|
|
|
|
$view['book_advance_timeout_preview'] = sprintf('%02d:%02d', $hours, $minutes);
|
|
|
|
|
2015-12-02 00:39:31 +02:00
|
|
|
$this->set_user_data($view);
|
|
|
|
|
|
|
|
$this->load->view('backend/header', $view);
|
|
|
|
$this->load->view('backend/settings', $view);
|
|
|
|
$this->load->view('backend/footer', $view);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-09-06 16:22:11 +03:00
|
|
|
* This method will update the installation to the latest available version in the server.
|
|
|
|
*
|
|
|
|
* IMPORTANT: The code files must exist in the server, this method will not fetch any new files but will update
|
2015-12-02 00:39:31 +02:00
|
|
|
* the database schema.
|
|
|
|
*
|
2017-09-06 16:22:11 +03:00
|
|
|
* This method can be used either by loading the page in the browser or by an ajax request. But it will answer with
|
|
|
|
* JSON encoded data.
|
2015-12-02 00:39:31 +02:00
|
|
|
*/
|
2017-09-15 14:36:37 +03:00
|
|
|
public function update()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2020-04-22 22:48:56 +03:00
|
|
|
if ( ! $this->has_privileges(PRIV_SYSTEM_SETTINGS, TRUE))
|
2017-09-15 14:36:37 +03:00
|
|
|
{
|
2015-12-02 00:39:31 +02:00
|
|
|
throw new Exception('You do not have the required privileges for this task!');
|
2017-09-15 14:36:37 +03:00
|
|
|
}
|
2015-12-02 00:39:31 +02:00
|
|
|
|
2022-02-23 13:29:45 +03:00
|
|
|
if ( ! $this->migration->latest())
|
2017-09-15 14:36:37 +03:00
|
|
|
{
|
2015-12-02 00:39:31 +02:00
|
|
|
throw new Exception($this->migration->error_string());
|
2017-09-15 14:36:37 +03:00
|
|
|
}
|
2015-12-02 00:39:31 +02:00
|
|
|
|
2018-01-23 12:08:37 +03:00
|
|
|
$view = ['success' => TRUE];
|
2017-09-23 02:30:22 +03:00
|
|
|
}
|
2020-04-22 22:48:56 +03:00
|
|
|
catch (Exception $exception)
|
2017-09-15 14:36:37 +03:00
|
|
|
{
|
2020-04-22 22:48:56 +03:00
|
|
|
$view = ['success' => FALSE, 'exception' => $exception->getMessage()];
|
2015-12-02 00:39:31 +02:00
|
|
|
}
|
2017-11-16 00:51:46 +03:00
|
|
|
|
|
|
|
$this->load->view('general/update', $view);
|
2015-12-02 00:39:31 +02:00
|
|
|
}
|
|
|
|
}
|