Added the dateFormat value to the GlobalVariables of every backend page.

This commit is contained in:
Alex Tselegidis 2015-12-01 23:39:31 +01:00
parent 284abdfd54
commit c60a0feeaf
7 changed files with 362 additions and 331 deletions

View file

@ -58,6 +58,7 @@ class Backend extends CI_Controller {
$view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id'));
$view['active_menu'] = PRIV_APPOINTMENTS;
$view['book_advance_timeout'] = $this->settings_model->get_setting('book_advance_timeout');
$view['date_format'] = $this->settings_model->get_setting('date_format');
$view['company_name'] = $this->settings_model->get_setting('company_name');
$view['available_providers'] = $this->providers_model->get_available_providers();
$view['available_services'] = $this->services_model->get_available_services();
@ -105,6 +106,7 @@ class Backend extends CI_Controller {
$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');
$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();
@ -137,6 +139,7 @@ class Backend extends CI_Controller {
$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');
$view['services'] = $this->services_model->get_batch();
$view['categories'] = $this->services_model->get_all_categories();
$this->set_user_data($view);
@ -168,6 +171,7 @@ class Backend extends CI_Controller {
$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');
$view['admins'] = $this->admins_model->get_batch();
$view['providers'] = $this->providers_model->get_batch();
$view['secretaries'] = $this->secretaries_model->get_batch();
@ -202,6 +206,7 @@ class Backend extends CI_Controller {
$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');
$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 file

@ -17,6 +17,7 @@
'availableServices' : <?php echo json_encode($available_services); ?>,
'baseUrl' : <?php echo '"' . $base_url . '"'; ?>,
'bookAdvanceTimeout' : <?php echo $book_advance_timeout; ?>,
'dateFormat' : <?php echo json_encode($date_format); ?>,
'editAppointment' : <?php echo json_encode($edit_appointment); ?>,
'customers' : <?php echo json_encode($customers); ?>,
'secretaryProviders' : <?php echo json_encode($secretary_providers); ?>,

View file

@ -8,9 +8,10 @@
var GlobalVariables = {
'csrfToken': <?php echo json_encode($this->security->get_csrf_hash()); ?>,
'availableProviders': <?php echo json_encode($available_providers); ?>,
'availableServices': <?php echo json_encode($available_services); ?>,
'baseUrl': <?php echo '"' . $base_url . '"'; ?>,
'customers': <?php echo json_encode($customers); ?>,
'availableServices' : <?php echo json_encode($available_services); ?>,
'dateFormat' : <?php echo json_encode($date_format); ?>,
'baseUrl' : <?php echo '"' . $base_url . '"'; ?>,
'customers' : <?php echo json_encode($customers); ?>,
'user' : {
'id' : <?php echo $user_id; ?>,
'email' : <?php echo '"' . $user_email . '"'; ?>,

View file

@ -3,10 +3,11 @@
<script type="text/javascript">
var GlobalVariables = {
'csrfToken': <?php echo json_encode($this->security->get_csrf_hash()); ?>,
'baseUrl': <?php echo '"' . $base_url . '"'; ?>,
'services': <?php echo json_encode($services); ?>,
'categories': <?php echo json_encode($categories); ?>,
'csrfToken' : <?php echo json_encode($this->security->get_csrf_hash()); ?>,
'baseUrl' : <?php echo '"' . $base_url . '"'; ?>,
'dateFormat' : <?php echo json_encode($date_format); ?>,
'services' : <?php echo json_encode($services); ?>,
'categories' : <?php echo json_encode($categories); ?>,
'user' : {
'id' : <?php echo $user_id; ?>,
'email' : <?php echo '"' . $user_email . '"'; ?>,

View file

@ -9,12 +9,13 @@
<script type="text/javascript">
var GlobalVariables = {
'csrfToken': <?php echo json_encode($this->security->get_csrf_hash()); ?>,
'baseUrl': <?php echo '"' . $base_url . '"'; ?>,
'userSlug': <?php echo '"' . $role_slug . '"'; ?>,
'settings': {
'system': <?php echo json_encode($system_settings); ?>,
'user': <?php echo json_encode($user_settings); ?>
'csrfToken' : <?php echo json_encode($this->security->get_csrf_hash()); ?>,
'baseUrl' : <?php echo '"' . $base_url . '"'; ?>,
'dateFormat' : <?php echo json_encode($date_format); ?>,
'userSlug' : <?php echo '"' . $role_slug . '"'; ?>,
'settings' : {
'system' : <?php echo json_encode($system_settings); ?>,
'user' : <?php echo json_encode($user_settings); ?>
},
'user' : {
'id' : <?php echo $user_id; ?>,

View file

@ -18,13 +18,14 @@
<script type="text/javascript">
var GlobalVariables = {
'csrfToken': <?php echo json_encode($this->security->get_csrf_hash()); ?>,
'baseUrl': <?php echo '"' . $base_url . '"'; ?>,
'admins': <?php echo json_encode($admins); ?>,
'providers': <?php echo json_encode($providers); ?>,
'secretaries': <?php echo json_encode($secretaries); ?>,
'services': <?php echo json_encode($services); ?>,
'workingPlan': $.parseJSON(<?php echo json_encode($working_plan); ?>),
'csrfToken' : <?php echo json_encode($this->security->get_csrf_hash()); ?>,
'baseUrl' : <?php echo '"' . $base_url . '"'; ?>,
'dateFormat' : <?php echo json_encode($date_format); ?>,
'admins' : <?php echo json_encode($admins); ?>,
'providers' : <?php echo json_encode($providers); ?>,
'secretaries' : <?php echo json_encode($secretaries); ?>,
'services' : <?php echo json_encode($services); ?>,
'workingPlan' : $.parseJSON(<?php echo json_encode($working_plan); ?>),
'user' : {
'id' : <?php echo $user_id; ?>,
'email' : <?php echo '"' . $user_email . '"'; ?>,

View file

@ -33,6 +33,31 @@ var BackendCalendar = {
initialize: function(defaultEventHandlers) {
if (defaultEventHandlers === undefined) defaultEventHandlers = true;
// Dynamic Date Formats
var columnFormat = {};
switch(GlobalVariables.dateFormat) {
case 'DMY':
columnFormat = {
'month': 'ddd',
'week': 'ddd dd/MM',
'day': 'dddd dd/MM'
};
break;
case 'MDY':
case 'YMD':
columnFormat = {
'month': 'ddd',
'week': 'ddd MM/dd',
'day': 'dddd MM/dd'
};
break;
default:
throw new Error('Invalid date format setting provided!', GlobalVariables.dateFormat);
}
// Initialize page calendar
$('#calendar').fullCalendar({
'defaultView': 'agendaWeek',
@ -44,11 +69,7 @@ var BackendCalendar = {
'axisFormat': 'HH:mm',
'timeFormat': 'HH:mm{ - HH:mm}',
'allDayText': EALang['all_day'],
'columnFormat': {
'month': 'ddd',
'week': 'ddd d/M',
'day': 'dddd d/M'
},
'columnFormat': columnFormat,
'titleFormat': {
'month': 'MMMM yyyy',
'week': "MMMM d[ yyyy]{ '&#8212;'[ MMM] d, yyyy}",