From 65d283691124a836a0db879564f9af10df9cf547 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 18 Jan 2022 10:32:30 +0100 Subject: [PATCH] The timezone component must not use the global vars when rendering. --- application/controllers/Providers.php | 3 +- application/controllers/Secretaries.php | 2 +- application/helpers/render_helper.php | 6 +-- .../views/components/timezone_dropdown.php | 10 +++- application/views/pages/calendar.php | 50 +++++++++---------- application/views/pages/customers.php | 4 +- application/views/pages/providers.php | 4 +- application/views/pages/secretaries.php | 4 +- 8 files changed, 44 insertions(+), 39 deletions(-) diff --git a/application/controllers/Providers.php b/application/controllers/Providers.php index 8a24a2c6..936500b6 100644 --- a/application/controllers/Providers.php +++ b/application/controllers/Providers.php @@ -58,7 +58,6 @@ class Providers extends EA_Controller { return; } - $role_slug = session('role_slug'); $services = $this->services_model->get(); @@ -84,7 +83,7 @@ class Providers extends EA_Controller { 'page_title' => lang('providers'), 'active_menu' => PRIV_USERS, 'user_display_name' => $this->accounts->get_user_display_name($user_id), - 'timezones' => $this->timezones->to_array(), + 'timezones' => $this->timezones->to_grouped_array(), 'privileges' => $this->roles_model->get_permissions_by_slug($role_slug), 'services' => $this->services_model->get(), ]); diff --git a/application/controllers/Secretaries.php b/application/controllers/Secretaries.php index b37327aa..90979c95 100644 --- a/application/controllers/Secretaries.php +++ b/application/controllers/Secretaries.php @@ -83,7 +83,7 @@ class Secretaries extends EA_Controller { 'page_title' => lang('secretaries'), 'active_menu' => PRIV_USERS, 'user_display_name' => $this->accounts->get_user_display_name($user_id), - 'timezones' => $this->timezones->to_array(), + 'timezones' => $this->timezones->to_grouped_array(), 'privileges' => $this->roles_model->get_permissions_by_slug($role_slug), 'providers' => $this->providers_model->get(), ]); diff --git a/application/helpers/render_helper.php b/application/helpers/render_helper.php index bfbf9ab4..45e216ca 100644 --- a/application/helpers/render_helper.php +++ b/application/helpers/render_helper.php @@ -26,12 +26,10 @@ function render_timezone_dropdown(string $attributes = ''): string $timezones = $CI->timezones->to_grouped_array(); - html_vars([ + return $CI->load->view('components/timezone_dropdown', [ 'attributes' => $attributes, 'timezones' => $timezones - ]); - - return $CI->load->view('components/timezone_dropdown', html_vars(), TRUE); + ], TRUE); } /** diff --git a/application/views/components/timezone_dropdown.php b/application/views/components/timezone_dropdown.php index dcfd1033..374c74bf 100644 --- a/application/views/components/timezone_dropdown.php +++ b/application/views/components/timezone_dropdown.php @@ -1,5 +1,11 @@ -> + $entries): ?> $name): ?> diff --git a/application/views/pages/calendar.php b/application/views/pages/calendar.php index 44b5b605..16eb8ccc 100755 --- a/application/views/pages/calendar.php +++ b/application/views/pages/calendar.php @@ -88,34 +88,30 @@ - vars('available_services'), - 'timezones' => vars('timezones'), - 'require_first_name' => vars('require_first_name'), - 'require_last_name' => vars('require_last_name'), - 'require_email' => vars('require_email'), - 'require_phone_number' => vars('require_phone_number'), - 'require_address' => vars('require_address'), - 'require_city' => vars('require_city'), - 'require_zip_code' => vars('require_zip_code') - ] - ) -?> + vars('available_services'), + 'timezones' => vars('timezones'), + 'require_first_name' => vars('require_first_name'), + 'require_last_name' => vars('require_last_name'), + 'require_email' => vars('require_email'), + 'require_phone_number' => vars('require_phone_number'), + 'require_address' => vars('require_address'), + 'require_city' => vars('require_city'), + 'require_zip_code' => vars('require_zip_code') + ] +) ?> - vars('timezones'), - 'timezone' => vars('timezone') - ] - ) -?> + vars('timezones'), + 'timezone' => vars('timezone') + ] +) ?> diff --git a/application/views/pages/customers.php b/application/views/pages/customers.php index 77a15b3d..fca9e205 100755 --- a/application/views/pages/customers.php +++ b/application/views/pages/customers.php @@ -161,7 +161,9 @@ * - + vars('timezones') + ]) ?>
diff --git a/application/views/pages/providers.php b/application/views/pages/providers.php index c851ab1f..d32e36eb 100755 --- a/application/views/pages/providers.php +++ b/application/views/pages/providers.php @@ -198,7 +198,9 @@ * - + vars('timezones') + ]) ?>

diff --git a/application/views/pages/secretaries.php b/application/views/pages/secretaries.php index c1b58b6a..ae1df6e5 100755 --- a/application/views/pages/secretaries.php +++ b/application/views/pages/secretaries.php @@ -176,7 +176,9 @@ * - + vars('timezones') + ]) ?>