All the backend pages have the timezone information.

This commit is contained in:
Alex Tselegidis 2020-03-29 14:43:53 +02:00
parent 26442a1e17
commit b639318dac
7 changed files with 36 additions and 22 deletions

View file

@ -63,6 +63,7 @@ class Backend extends CI_Controller {
$this->load->model('roles_model');
$this->load->model('user_model');
$this->load->model('secretaries_model');
$this->load->model('timezones_model');
$view['base_url'] = $this->config->item('base_url');
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
@ -77,6 +78,7 @@ class Backend extends CI_Controller {
$view['customers'] = $this->customers_model->get_batch();
$user = $this->user_model->get_settings($this->session->userdata('user_id'));
$view['calendar_view'] = $user['settings']['calendar_view'];
$view['timezones'] = $this->timezones_model->to_array();
$this->set_user_data($view);
if ($this->session->userdata('role_slug') === DB_SLUG_SECRETARY)
@ -127,6 +129,7 @@ class Backend extends CI_Controller {
$this->load->model('services_model');
$this->load->model('settings_model');
$this->load->model('user_model');
$this->load->model('timezones_model');
$view['base_url'] = $this->config->item('base_url');
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
@ -139,6 +142,7 @@ class Backend extends CI_Controller {
$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();
$view['timezones'] = $this->timezones_model->to_array();
if ($this->session->userdata('role_slug') === DB_SLUG_SECRETARY)
{
@ -178,6 +182,7 @@ class Backend extends CI_Controller {
$this->load->model('services_model');
$this->load->model('settings_model');
$this->load->model('user_model');
$this->load->model('timezones_model');
$view['base_url'] = $this->config->item('base_url');
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
@ -188,6 +193,7 @@ class Backend extends CI_Controller {
$view['first_weekday'] = $this->settings_model->get_setting('first_weekday');
$view['services'] = $this->services_model->get_batch();
$view['categories'] = $this->services_model->get_all_categories();
$view['timezones'] = $this->timezones_model->to_array();
$this->set_user_data($view);
$this->load->view('backend/header', $view);
@ -216,6 +222,7 @@ class Backend extends CI_Controller {
$this->load->model('services_model');
$this->load->model('settings_model');
$this->load->model('user_model');
$this->load->model('timezones_model');
$view['base_url'] = $this->config->item('base_url');
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
@ -229,7 +236,8 @@ class Backend extends CI_Controller {
$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');
$view['extra_working_plan'] = "{}";
$view['timezones'] = $this->timezones_model->to_array();
$view['extra_working_plan'] = '{}';
$this->set_user_data($view);
$this->load->view('backend/header', $view);
@ -255,6 +263,7 @@ class Backend extends CI_Controller {
$this->load->model('settings_model');
$this->load->model('user_model');
$this->load->model('timezones_model');
$this->load->library('session');
$user_id = $this->session->userdata('user_id');
@ -269,6 +278,7 @@ class Backend extends CI_Controller {
$view['role_slug'] = $this->session->userdata('role_slug');
$view['system_settings'] = $this->settings_model->get_settings();
$view['user_settings'] = $this->user_model->get_settings($user_id);
$view['timezones'] = $this->timezones_model->to_array();
$this->set_user_data($view);
$this->load->view('backend/header', $view);
@ -369,6 +379,7 @@ class Backend extends CI_Controller {
// Get privileges
$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'));
}

View file

@ -461,14 +461,7 @@ class Timezones_Model extends CI_Model {
*/
public function to_array()
{
$continents = [];
foreach ($this->timezones as $continent => $timezones)
{
$continents[] = $timezones;
}
return array_merge($continents);
return array_merge(...array_values($this->timezones));
}
/**

View file

@ -26,11 +26,13 @@
'customers' : <?= json_encode($customers) ?>,
'secretaryProviders' : <?= json_encode($secretary_providers) ?>,
'calendarView' : <?= json_encode($calendar_view) ?>,
'timezones' : <?= json_encode($timezones) ?>,
'user' : {
'id' : <?= $user_id ?>,
'email' : <?= json_encode($user_email) ?>,
'timezone' : <?= json_encode($timezone) ?>,
'role_slug' : <?= json_encode($role_slug) ?>,
'privileges': <?= json_encode($privileges) ?>
'privileges': <?= json_encode($privileges) ?>,
}
};

View file

@ -1,4 +1,4 @@
<script src="<?= asset_url('assets/ext/jquery-ui/jquery-ui-timepicker-addon.js') ?>"></script>
<script src="<?= asset_url('assets/ext/jquery-ui/jquery-ui-timepicker-addon.min.js') ?>"></script>
<script src="<?= asset_url('assets/js/backend_customers_helper.js') ?>"></script>
<script src="<?= asset_url('assets/js/backend_customers.js') ?>"></script>
<script>
@ -11,9 +11,11 @@
timeFormat : <?= json_encode($time_format) ?>,
baseUrl : <?= json_encode($base_url) ?>,
customers : <?= json_encode($customers) ?>,
timezones : <?= json_encode($timezones) ?>,
user : {
id : <?= $user_id ?>,
email : <?= json_encode($user_email) ?>,
timezone : <?= json_encode($timezone) ?>,
role_slug : <?= json_encode($role_slug) ?>,
privileges : <?= json_encode($privileges) ?>
}

View file

@ -9,9 +9,11 @@
timeFormat : <?= json_encode($time_format) ?>,
services : <?= json_encode($services) ?>,
categories : <?= json_encode($categories) ?>,
timezones : <?= json_encode($timezones) ?>,
user : {
id : <?= $user_id ?>,
email : <?= json_encode($user_email) ?>,
timezone : <?= json_encode($timezone) ?>,
role_slug : <?= json_encode($role_slug) ?>,
privileges: <?= json_encode($privileges) ?>
}

View file

@ -12,6 +12,7 @@
'firstWeekday' : <?= json_encode($first_weekday); ?>,
'timeFormat' : <?= json_encode($time_format) ?>,
'userSlug' : <?= json_encode($role_slug) ?>,
'timezones' : <?= json_encode($timezones) ?>,
'settings' : {
'system' : <?= json_encode($system_settings) ?>,
'user' : <?= json_encode($user_settings) ?>
@ -19,6 +20,7 @@
'user' : {
'id' : <?= $user_id ?>,
'email' : <?= json_encode($user_email) ?>,
'timezone' : <?= json_encode($timezone) ?>,
'role_slug' : <?= json_encode($role_slug) ?>,
'privileges': <?= json_encode($privileges) ?>
}

View file

@ -7,20 +7,22 @@
<script src="<?= asset_url('assets/ext/jquery-jeditable/jquery.jeditable.min.js') ?>"></script>
<script>
var GlobalVariables = {
csrfToken : <?= json_encode($this->security->get_csrf_hash()) ?>,
baseUrl : <?= json_encode($base_url) ?>,
dateFormat : <?= json_encode($date_format) ?>,
firstWeekday : <?= json_encode($first_weekday); ?>,
timeFormat : <?= json_encode($time_format) ?>,
admins : <?= json_encode($admins) ?>,
providers : <?= json_encode($providers) ?>,
secretaries : <?= json_encode($secretaries) ?>,
services : <?= json_encode($services) ?>,
workingPlan : <?= json_encode(json_decode($working_plan)) ?>,
extraWorkingPlan : <?= json_encode(json_decode($extra_working_plan)) ?>,
csrfToken : <?= json_encode($this->security->get_csrf_hash()) ?>,
baseUrl : <?= json_encode($base_url) ?>,
dateFormat : <?= json_encode($date_format) ?>,
firstWeekday : <?= json_encode($first_weekday); ?>,
timeFormat : <?= json_encode($time_format) ?>,
admins : <?= json_encode($admins) ?>,
providers : <?= json_encode($providers) ?>,
secretaries : <?= json_encode($secretaries) ?>,
services : <?= json_encode($services) ?>,
timezones : <?= json_encode($timezones) ?>,
workingPlan : <?= json_encode(json_decode($working_plan)) ?>,
extraWorkingPlan : <?= json_encode(json_decode($extra_working_plan)) ?>,
user : {
id : <?= $user_id ?>,
email : <?= json_encode($user_email) ?>,
timezone : <?= json_encode($timezone) ?>,
role_slug : <?= json_encode($role_slug) ?>,
privileges : <?= json_encode($privileges) ?>
}