From fb9f2e86fc0bacc1610125b4a70e0fce3df8c1f8 Mon Sep 17 00:00:00 2001 From: chfhtw Date: Thu, 21 Aug 2025 13:46:30 +0200 Subject: [PATCH 1/2] StV: tab ordering --- application/config/stv.php | 29 ++++++++++++++ .../api/frontend/v1/stv/Config.php | 38 ++++++++++++++++++- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/application/config/stv.php b/application/config/stv.php index 675899108..295bb2544 100644 --- a/application/config/stv.php +++ b/application/config/stv.php @@ -83,3 +83,32 @@ if (!defined('ZGV_DOKTOR_ANZEIGEN') || !ZGV_DOKTOR_ANZEIGEN) { $fieldsZgvDoktor ); } + +$config['student_tab_order'] = [ + 'messages', + 'details', + 'notes', + 'contact', + 'prestudent', + 'status', + 'documents', + 'archive', + 'banking', + 'grades', + 'exam', + 'exemptions', + 'finalexam', + 'mobility', + 'jointstudies', + 'admissionDates', + 'functions', + 'resources', + 'groups', + 'coursedates', +]; +$config['students_tab_order'] = [ + 'banking', + 'status', + 'finalexam', + 'archive', +]; diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index 2fb436384..d52016943 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -184,7 +184,9 @@ class Config extends FHCAPI_Controller return $result; }); - $this->terminateWithSuccess($result); + $sortConfig = $this->config->item('student_tab_order'); + + $this->terminateWithSuccess($this->sortTabList($result, $sortConfig)); } public function students() @@ -231,7 +233,9 @@ class Config extends FHCAPI_Controller return $result; }); - $this->terminateWithSuccess($result); + $sortConfig = $this->config->item('students_tab_order'); + + $this->terminateWithSuccess($this->sortTabList($result, $sortConfig)); } protected function kontoColumns() @@ -507,4 +511,34 @@ class Config extends FHCAPI_Controller return $list; } + + /** + * Sort tab list + * + * @param array $input + * @param array $config + * + * @return array + */ + protected function sortTabList($input, $config) + { + // prepare config + if (!$config || !is_array($config)) + $config = []; + else + $config = array_flip($config); + + // fill missing items in config + foreach (array_keys($input) as $key) { + if (!isset($config[$key])) + $config[$key] = count($config); + } + + // do the sorting + uksort($input, function ($a, $b) use ($config) { + return $config[$a] - $config[$b]; + }); + + return $input; + } } From 11868d94967572ffc8ad6a7dc42c45af18aba1fc Mon Sep 17 00:00:00 2001 From: chfhtw Date: Thu, 21 Aug 2025 15:00:18 +0200 Subject: [PATCH 2/2] StV: tab final ordering --- application/config/stv.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/application/config/stv.php b/application/config/stv.php index 295bb2544..42afc318c 100644 --- a/application/config/stv.php +++ b/application/config/stv.php @@ -85,9 +85,9 @@ if (!defined('ZGV_DOKTOR_ANZEIGEN') || !ZGV_DOKTOR_ANZEIGEN) { } $config['student_tab_order'] = [ - 'messages', 'details', 'notes', + 'messages', 'contact', 'prestudent', 'status', @@ -101,14 +101,15 @@ $config['student_tab_order'] = [ 'mobility', 'jointstudies', 'admissionDates', - 'functions', - 'resources', 'groups', + 'functions', 'coursedates', + 'resources', ]; $config['students_tab_order'] = [ 'banking', 'status', + 'groups', 'finalexam', 'archive', ];