The calendar view setting will be available to javascript through GlobalVariables.calendarView (#182).

This commit is contained in:
Alex Tselegidis 2016-07-17 13:04:44 +02:00
parent 9c82805b83
commit 6cda484e1d
3 changed files with 16 additions and 3 deletions

View file

@ -77,5 +77,9 @@ define('DATE_FORMAT_YMD', 'YMD');
define('MIN_PASSWORD_LENGTH', 7); define('MIN_PASSWORD_LENGTH', 7);
define('ANY_PROVIDER', 'any-provider'); define('ANY_PROVIDER', 'any-provider');
define('CALENDAR_VIEW_DEFAULT', 'default');
define('CALENDAR_VIEW_TABLE', 'table');
/* End of file constants.php */ /* End of file constants.php */
/* Location: ./application/config/constants.php */ /* Location: ./application/config/constants.php */

View file

@ -66,6 +66,8 @@ class Backend extends CI_Controller {
$view['available_providers'] = $this->providers_model->get_available_providers(); $view['available_providers'] = $this->providers_model->get_available_providers();
$view['available_services'] = $this->services_model->get_available_services(); $view['available_services'] = $this->services_model->get_available_services();
$view['customers'] = $this->customers_model->get_batch(); $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'];
$this->set_user_data($view); $this->set_user_data($view);
if ($this->session->userdata('role_slug') == DB_SLUG_SECRETARY) { if ($this->session->userdata('role_slug') == DB_SLUG_SECRETARY) {

View file

@ -10,21 +10,28 @@
<script type="text/javascript" <script type="text/javascript"
src="<?php echo $base_url; ?>/assets/js/backend_calendar.js"></script> src="<?php echo $base_url; ?>/assets/js/backend_calendar.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>/assets/js/backend_calendar_default_view.js"></script>
<script type="text/javascript"
src="<?php echo $base_url; ?>/assets/js/backend_calendar_table_view.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var GlobalVariables = { var GlobalVariables = {
'csrfToken' : <?php echo json_encode($this->security->get_csrf_hash()); ?>, 'csrfToken' : <?php echo json_encode($this->security->get_csrf_hash()); ?>,
'availableProviders' : <?php echo json_encode($available_providers); ?>, 'availableProviders' : <?php echo json_encode($available_providers); ?>,
'availableServices' : <?php echo json_encode($available_services); ?>, 'availableServices' : <?php echo json_encode($available_services); ?>,
'baseUrl' : <?php echo '"' . $base_url . '"'; ?>, 'baseUrl' : <?php echo json_encode($base_url); ?>,
'bookAdvanceTimeout' : <?php echo $book_advance_timeout; ?>, 'bookAdvanceTimeout' : <?php echo $book_advance_timeout; ?>,
'dateFormat' : <?php echo json_encode($date_format); ?>, 'dateFormat' : <?php echo json_encode($date_format); ?>,
'editAppointment' : <?php echo json_encode($edit_appointment); ?>, 'editAppointment' : <?php echo json_encode($edit_appointment); ?>,
'customers' : <?php echo json_encode($customers); ?>, 'customers' : <?php echo json_encode($customers); ?>,
'secretaryProviders' : <?php echo json_encode($secretary_providers); ?>, 'secretaryProviders' : <?php echo json_encode($secretary_providers); ?>,
'calendarView' : <?php echo json_encode($calendar_view); ?>,
'user' : { 'user' : {
'id' : <?php echo $user_id; ?>, 'id' : <?php echo $user_id; ?>,
'email' : <?php echo '"' . $user_email . '"'; ?>, 'email' : <?php echo json_encode($user_email); ?>,
'role_slug' : <?php echo '"' . $role_slug . '"'; ?>, 'role_slug' : <?php echo json_encode($role_slug); ?>,
'privileges': <?php echo json_encode($privileges); ?> 'privileges': <?php echo json_encode($privileges); ?>
} }
}; };