From 61dcf61e9e295ca2fb866f88b6423068075c07ab Mon Sep 17 00:00:00 2001 From: Gerald Raab Date: Tue, 12 Jun 2018 11:47:48 +0200 Subject: [PATCH 01/10] =?UTF-8?q?exclude=20Abgewiesene=20ohne=20Status=20b?= =?UTF-8?q?est=C3=A4tigt=20beim=20INteressenten,=20damit=20noch=20nicht=20?= =?UTF-8?q?abgeschickte=20Bewerbungen=20wieder=20in=20Liste=20sind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/views/system/infocenter/infocenterData.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index 3f1dc5182..b012a0a1a 100755 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -63,6 +63,7 @@ FROM public.tbl_studiensemester WHERE ende >= NOW() ) + AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\' and psss.studiensemester_kurzbz = \'WS2018\') ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC LIMIT 1 ) AS "SendDate", From e0bf5a084f862d46f79ee2505d731f7ed604f455 Mon Sep 17 00:00:00 2001 From: Manfred Kindl Date: Tue, 12 Jun 2018 18:04:37 +0200 Subject: [PATCH 02/10] Bakkurkunde und Diplomurkunde archivierbar --- content/student/studentoverlay.js.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/student/studentoverlay.js.php b/content/student/studentoverlay.js.php index 4981da00c..c21069514 100644 --- a/content/student/studentoverlay.js.php +++ b/content/student/studentoverlay.js.php @@ -3005,6 +3005,10 @@ function StudentZeugnisDokumentArchivieren() case 'PrProtMAEng': case 'Bescheid': case 'BescheidEng': + case 'Bakkurkunde': + case 'BakkurkundeEng': + case 'Diplomurkunde': + case 'DiplomurkundeEng': xml = 'abschlusspruefung.rdf.php'; break; From fda0db329ef6566acf4e01dba2bd6e66fedbe9e5 Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 13 Jun 2018 16:41:08 +0200 Subject: [PATCH 03/10] Database update uses a different file for filters - Added system/filtersupdate.php to collect all the filters and to perform an insert or an update in the database - Removed filters from system/dbupdate_3.3.php - Updated system/checksystem.php to call system/filtersupdate.php --- system/checksystem.php | 10 + system/dbupdate_3.3.php | 85 +-------- system/filtersupdate.php | 390 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 401 insertions(+), 84 deletions(-) create mode 100644 system/filtersupdate.php diff --git a/system/checksystem.php b/system/checksystem.php index 5e4daa1d4..9f631b434 100644 --- a/system/checksystem.php +++ b/system/checksystem.php @@ -73,6 +73,16 @@ echo '
'; require_once('phrasesupdate.php'); echo '
'; +// ******** filtersupdate ************/ +echo '

Filters time!

'; + +echo '
'; + echo 'filtersupdate.php wird aufgerufen...'; +echo '
'; +echo '
'; + require_once('filtersupdate.php'); +echo '
'; + // ******** Berechtigungen Prüfen ************/ echo '

Berechtigungen pruefen

'; diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index d3cf9eb7c..73c2ea755 100755 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -1878,89 +1878,6 @@ if($result = $db->db_query("SELECT obj_description('public.ci_apikey'::regclass) } } -if($result = @$db->db_query("SELECT * FROM system.tbl_filters WHERE filter_kurzbz='InfoCenterSentApplicationAll' AND app='infocenter'")) -{ - if($db->db_num_rows($result)==0) - { - $qry = "INSERT INTO system.tbl_filters(app, dataset_name, filter_kurzbz, person_id, description, sort, - default_filter, filter, oe_kurzbz) - VALUES ('infocenter', 'PersonActions', 'InfoCenterSentApplicationAll', NULL, '{Alle}', 1, false, - '{\"name\": \"Abgeschickt - Alle\", \"columns\": [{\"name\": \"Vorname\"}, - {\"name\": \"Nachname\"}, {\"name\": \"LastAction\"}, {\"name\": \"LockUser\"}, - {\"name\": \"Studiensemester\"}, {\"name\": \"SendDate\"}, {\"name\": \"StgAbgeschickt\"}], - \"filters\": [{\"name\": \"AnzahlAbgeschickt\", \"option\": \"\", - \"condition\": \"0\", \"operation\": \"gt\"}]}', NULL);"; - if(!$db->db_query($qry)) - echo 'Filter: '.$db->db_last_error().'
'; - else - echo '
Filter InfoCenterSentApplicationAll hinzugefuegt'; - } -} - -if($result = @$db->db_query("SELECT * FROM system.tbl_filters WHERE filter_kurzbz='InfoCenterSentApplication3days' AND app='infocenter'")) -{ - if($db->db_num_rows($result)==0) - { - $qry = "INSERT INTO system.tbl_filters(app, dataset_name, filter_kurzbz, person_id, description, sort, - default_filter, filter, oe_kurzbz) - VALUES ('infocenter', 'PersonActions', 'InfoCenterSentApplication3days', NULL, - '{\"3 Tage keine Aktion\"}', 2, false, '{\"name\": \"Abgeschickt - 3 Tage keine Aktion\", - \"columns\": [{\"name\": \"Vorname\"}, {\"name\": \"Nachname\"}, {\"name\": \"LastAction\"}, - {\"name\": \"LockUser\"}, {\"name\": \"Studiensemester\"}, {\"name\": \"SendDate\"}, - {\"name\": \"StgAbgeschickt\"}], - \"filters\": [{\"name\": \"LastAction\", \"option\": \"days\", \"condition\": \"3\", - \"operation\": \"gt\"}, {\"name\": \"AnzahlAbgeschickt\", \"option\": \"\", - \"condition\": \"0\", \"operation\": \"gt\"}]}', NULL);"; - - if(!$db->db_query($qry)) - echo 'Filter: '.$db->db_last_error().'
'; - else - echo '
Filter InfoCenterSentApplication3days hinzugefuegt'; - } -} - -if($result = @$db->db_query("SELECT * FROM system.tbl_filters WHERE filter_kurzbz='InfoCenterNotSentApplicationAll' AND app='infocenter'")) -{ - if($db->db_num_rows($result)==0) - { - $qry = "INSERT INTO system.tbl_filters(app, dataset_name, filter_kurzbz, person_id, description, sort, - default_filter, filter, oe_kurzbz) - VALUES ('infocenter', 'PersonActions', 'InfoCenterNotSentApplicationAll', NULL, '{Alle}', 1, false, - '{\"name\": \"Nicht abgeschickt - Alle\", \"columns\": [{\"name\": \"Vorname\"}, - {\"name\": \"Nachname\"}, {\"name\": \"LastAction\"}, {\"name\": \"LockUser\"}, - {\"name\": \"Studiensemester\"}, {\"name\": \"SendDate\"}, {\"name\": \"StgAbgeschickt\"}], - \"filters\": [{\"name\": \"SendDate\", \"option\": \"\", - \"condition\": \"\", \"operation\": \"nset\"}]}', NULL);"; - - if(!$db->db_query($qry)) - echo 'Filter: '.$db->db_last_error().'
'; - else - echo '
Filter InfoCenterNotSentApplicationAll hinzugefuegt'; - } -} - -if($result = @$db->db_query("SELECT * FROM system.tbl_filters WHERE filter_kurzbz='InfoCenterNotSentApplication14Days' AND app='infocenter'")) -{ - if($db->db_num_rows($result)==0) - { - $qry = "INSERT INTO system.tbl_filters(app, dataset_name, filter_kurzbz, person_id, description, sort, - default_filter, filter, oe_kurzbz) - VALUES ('infocenter', 'PersonActions', 'InfoCenterNotSentApplication14Days', NULL, - '{\"14 Tage keine Aktion\"}', 2, false, '{\"name\": \"Nicht abgeschickt - 14 Tage keine Aktion\", - \"columns\": [{\"name\": \"Vorname\"}, {\"name\": \"Nachname\"}, {\"name\": \"LastAction\"}, - {\"name\": \"LockUser\"}, {\"name\": \"Studiensemester\"}, {\"name\": \"SendDate\"}, - {\"name\": \"StgAbgeschickt\"}], \"filters\": [{\"name\": \"LastAction\", \"option\": \"days\", - \"condition\": \"14\", \"operation\": \"gt\"}, {\"name\": \"SendDate\", \"option\": \"\", - \"condition\": \"\", \"operation\": \"nset\"}]}', NULL); - "; - - if(!$db->db_query($qry)) - echo 'Filter: '.$db->db_last_error().'
'; - else - echo '
Filter InfoCenterNotSentApplication14Days hinzugefuegt'; - } -} - if (!$result = @$db->db_query("SELECT projekt_id FROM fue.tbl_projekt LIMIT 1")) { $qry = "CREATE SEQUENCE fue.tbl_projekt_projekt_id_seq @@ -2267,7 +2184,7 @@ if($result = @$db->db_query("SELECT * FROM information_schema.role_table_grants if($db->db_num_rows($result)==0) { $qry = "GRANT DELETE ON system.tbl_log TO web;"; - + if(!$db->db_query($qry)) echo 'Permission Log: '.$db->db_last_error().'
'; else diff --git a/system/filtersupdate.php b/system/filtersupdate.php new file mode 100644 index 000000000..7134b16bf --- /dev/null +++ b/system/filtersupdate.php @@ -0,0 +1,390 @@ + 'infocenter', + 'dataset_name' => 'PersonActions', + 'filter_kurzbz' => 'InfoCenterSentApplicationAll', + 'description' => '{Alle}', + 'sort' => 1, + 'default_filter' => false, + 'filter' => ' + { + "name": "Abgeschickt - Alle", + "columns": [ + {"name": "Vorname"}, + {"name": "Nachname"}, + {"name": "Nation"}, + {"name": "StgAbgeschickt"}, + {"name": "LastAction"}, + {"name": "User/Operator"}, + {"name": "LockUser"} + ], + "filters": [ + { + "name": "AnzahlAbgeschickt", + "option": "", + "condition": "0", + "operation": "gt" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'infocenter', + 'dataset_name' => 'PersonActions', + 'filter_kurzbz' => 'InfoCenterSentApplication3days', + 'description' => '{"3 Tage keine Aktion"}', + 'sort' => 2, + 'default_filter' => false, + 'filter' => ' + { + "name": "Abgeschickt - 3 Tage keine Aktion", + "columns": [ + {"name": "Vorname"}, + {"name": "Nachname"}, + {"name": "Nation"}, + {"name": "StgAbgeschickt"}, + {"name": "LastAction"}, + {"name": "User/Operator"}, + {"name": "LockUser"} + ], + "filters": [ + { + "name": "LastAction", + "option": "days", + "condition": "3", + "operation": "gt" + }, + { + "name": "AnzahlAbgeschickt", + "option": "", + "condition": "0", + "operation": "gt" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'infocenter', + 'dataset_name' => 'PersonActions', + 'filter_kurzbz' => 'InfoCenterNotSentApplicationAll', + 'description' => '{Alle}', + 'sort' => 1, + 'default_filter' => false, + 'filter' => ' + { + "name": "Nicht abgeschickt - Alle", + "columns": [ + {"name": "Vorname"}, + {"name": "Nachname"}, + {"name": "Nation"}, + {"name": "LastAction"}, + {"name": "User/Operator"}, + {"name": "LockUser" + }, + {"name": "StgNichtAbgeschickt"}, + {"name": "StgAbgeschickt"}, + {"name": "StgAktiv"}, + {"name": "Studiensemester"} + ], + "filters": [ + { + "name": "SendDate", + "option": "", + "condition": "", + "operation": "nset" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'infocenter', + 'dataset_name' => 'PersonActions', + 'filter_kurzbz' => 'InfoCenterNotSentApplication14Days', + 'description' => '{"14 Tage keine Aktion"}', + 'sort' => 3, + 'default_filter' => false, + 'filter' => ' + { + "name": "Nicht abgeschickt - 14 Tage keine Aktion", + "columns": [ + {"name": "Vorname"}, + {"name": "Nachname"}, + {"name": "Nation"}, + {"name": "LastAction"}, + {"name": "User/Operator"}, + {"name": "LockUser"}, + {"name": "StgNichtAbgeschickt"}, + {"name": "StgAbgeschickt"}, + {"name": "StgAktiv"}, + {"name": "Studiensemester"} + ], + "filters": [ + { + "name": "LastAction", + "option": "days", + "condition": "14", + "operation": "gt" + }, + { + "name": "SendDate", + "option": "", + "condition": "", + "operation": "nset" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'infocenter', + 'dataset_name' => 'PersonActions', + 'filter_kurzbz' => 'InfoCenterSentApplicationLt3days', + 'description' => '{"< 3 Tage"}', + 'sort' => 3, + 'default_filter' => false, + 'filter' => ' + { + "name": "Abgeschickt - Aktion innert der letzten 3 Tage", + "columns": [ + {"name": "Vorname"}, + {"name": "Nachname"}, + {"name": "Nation"}, + {"name": "StgAbgeschickt"}, + {"name": "LastAction"}, + {"name": "User/Operator"}, + {"name": "LockUser"} + ], + "filters": [ + { + "name": "LastAction", + "option": "days", + "condition": "3", + "operation": "lt" + }, + { + "name": "AnzahlAbgeschickt", + "option": "", + "condition": "0", + "operation": "gt" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'infocenter', + 'dataset_name' => 'PersonActions', + 'filter_kurzbz' => 'InfoCenterNotSentApplication5DaysOnline', + 'description' => '{"5 Tage keine BewAktion"}', + 'sort' => 2, + 'default_filter' => false, + 'filter' => ' + { + "name": "Nicht abgeschickt - 5 Tage keine Aktion durch BewerberIn", + "columns": [ + {"name": "Vorname"}, + {"name": "Nachname"}, + {"name": "Nation"}, + {"name": "LastAction"}, + {"name": "User/Operator"}, + {"name": "LockUser"}, + {"name": "StgNichtAbgeschickt"}, + {"name": "StgAbgeschickt"}, + {"name": "StgAktiv"}, + {"name": "Studiensemester"} + ], + "filters": [ + { + "name": "SendDate", + "option": "", + "condition": "", + "operation": "nset" + }, + { + "name": "LastAction", + "option": "days", + "condition": "5", + "operation": "gt" + }, + { + "name": "User/Operator", + "option": "", + "condition": "online", + "operation": "contains" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'infocenter', + 'dataset_name' => 'PersonActions', + 'filter_kurzbz' => 'InfoCenterFreigegeben5days', + 'description' => '{"5 Tage Letzte Aktion"}', + 'sort' => 1, + 'default_filter' => true, + 'filter' => ' + { + "name": "Freigegeben - 5 Tage Letzte Aktion", + "columns": [ + {"name": "Vorname"}, + {"name": "Nachname"}, + {"name": "StgAbgeschickt"}, + {"name": "LastAction"}, + {"name": "User/Operator"}, + {"name": "LockUser"} + ], + "filters": [ + { + "name": "LastAction", + "option": "days", + "condition": "5", + "operation": "lt" + } + ] + } + ', + 'oe_kurzbz' => null, + ), + array( + 'app' => 'infocenter', + 'dataset_name' => 'PersonActions', + 'filter_kurzbz' => 'InfoCenterFreigegebenAlle', + 'description' => '{Alle}', + 'sort' => 2, + 'default_filter' => false, + 'filter' => ' + { + "name": "Freigegeben - Alle", + "columns": [ + {"name": "Vorname"}, + {"name": "Nachname"}, + {"name": "StgAbgeschickt"}, + {"name": "LastAction"}, + {"name": "User/Operator"}, + {"name": "LockUser"} + ], + "filters": [] + } + ', + 'oe_kurzbz' => null, + ) +); + +// Loop through the filters array +for ($filtersCounter = 0; $filtersCounter < count($filters); $filtersCounter++) +{ + $filter = $filters[$filtersCounter]; // single filter definition + + // If it's an array and contains the required number of elements + // and contains the required fields + if (is_array($filter) && count($filter) == 8 + && isset($filter['app']) && isset($filter['dataset_name']) + && isset($filter['filter_kurzbz']) && isset($filter['description']) + && isset($filter['filter'])) + { + $selectFilterQuery = 'SELECT filter_id + FROM system.tbl_filters + WHERE app = '.$db->db_add_param($filter['app']). + ' AND dataset_name = '.$db->db_add_param($filter['dataset_name']). + ' AND filter_kurzbz = '.$db->db_add_param($filter['filter_kurzbz']); + + // If no error occurred while loading a filter from the DB + if ($dbFilterDefinition = @$db->db_query($selectFilterQuery)) + { + // If NO filters were loaded: insert + if ($db->db_num_rows($dbFilterDefinition) == 0) + { + $insertFilterQuery = 'INSERT INTO system.tbl_filters ( + app, + dataset_name, + filter_kurzbz, + person_id, + description, + sort, + default_filter, + filter, + oe_kurzbz + ) VALUES ( + '.$db->db_add_param($filter['app']).', + '.$db->db_add_param($filter['dataset_name']).', + '.$db->db_add_param($filter['filter_kurzbz']).', + null, + '.$db->db_add_param($filter['description']).', + '.$db->db_add_param($filter['sort']).', + '.$db->db_add_param($filter['default_filter']).', + '.$db->db_add_param($filter['filter']).', + '.$db->db_add_param($filter['oe_kurzbz']).' + )'; + + if (!@$db->db_query($insertFilterQuery)) // checks query execution + { + echo 'An error occurred while inserting filters: '.$db->db_last_error().'
'; + } + else + { + echo 'Filter added: '.$filter['app'].' - '.$filter['dataset_name'].' - '.$filter['filter_kurzbz'].'
'; + } + } + else // otherwise if the filter is already present in the DB: update + { + if ($filterDb = $db->db_fetch_object($dbFilterDefinition)) + { + $updateFilterQuery = 'UPDATE system.tbl_filters SET + app = '.$db->db_add_param($filter['app']).', + dataset_name = '.$db->db_add_param($filter['dataset_name']).', + filter_kurzbz = '.$db->db_add_param($filter['filter_kurzbz']).', + person_id = null, + description = '.$db->db_add_param($filter['description']).', + sort = '.$db->db_add_param($filter['sort']).', + default_filter = '.$db->db_add_param($filter['default_filter']).', + filter = '.$db->db_add_param($filter['filter']).', + oe_kurzbz = '.$db->db_add_param($filter['oe_kurzbz']).' + WHERE filter_id = '.$db->db_add_param($filterDb->filter_id); + + if (!@$db->db_query($updateFilterQuery)) // checks query execution + { + echo 'An error occurred while inserting filters: '.$db->db_last_error().'
'; + } + else + { + echo 'Filter updated: '.$filter['app'].' - '.$filter['dataset_name'].' - '.$filter['filter_kurzbz'].'
'; + } + } + } + } + else // otherwise if errors occurred + { + echo 'An error occurred while inserting filters: '.$db->db_last_error().'
'; + } + } +} From 34296a436e75bd2270fdff8038b1d28d271f1234 Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 13 Jun 2018 16:45:36 +0200 Subject: [PATCH 04/10] =?UTF-8?q?Changed=20the=20menu=20entry=20for=20the?= =?UTF-8?q?=20left=20menu=20from=20"Z=C3=BCruck"=20to=20"Home"=20for=20the?= =?UTF-8?q?=20page=20system/infocenter/InfoCenter/infocenterFreigegeben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/config/navigation.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/application/config/navigation.php b/application/config/navigation.php index 64397f681..e0bf33348 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -64,18 +64,21 @@ $config['navigation_menu']['system/infocenter/InfoCenter/index'] = array( 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/infocenterFreigegeben'), 'description' => 'Freigegeben', 'icon' => 'thumbs-up' - )); + ) +); $config['navigation_menu']['system/infocenter/InfoCenter/showDetails'] = array( 'Freigegeben' => array( 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/infocenterFreigegeben'), 'description' => 'Freigegeben', 'icon' => 'thumbs-up' - )); + ) +); $config['navigation_menu']['system/infocenter/InfoCenter/infocenterFreigegeben'] = array( 'Zurück' => array( 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/index'), - 'description' => 'Zurück', + 'description' => 'Home', 'icon' => 'angle-left' - )); + ) +); From 2cbda912e349fecb38b751becc12d3d8a0dcf534 Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 13 Jun 2018 16:50:39 +0200 Subject: [PATCH 05/10] - FiltersLib bugfix: now method generateDatasetQuery always build a query with no filters (no where clause) if the filters array is empty - Added comments to Filters_model methods - Removed method deleteCustomFilter from Filters_model - Method getFilterList changed to load all the filters, removed default_filter = false from the where clause --- application/libraries/FiltersLib.php | 4 ++-- application/models/system/Filters_model.php | 13 ++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/application/libraries/FiltersLib.php b/application/libraries/FiltersLib.php index a4703bf7d..638fc7251 100644 --- a/application/libraries/FiltersLib.php +++ b/application/libraries/FiltersLib.php @@ -264,7 +264,7 @@ class FiltersLib */ public function generateDatasetQuery($query, $filters) { - $datasetQuery = null; + $datasetQuery = 'SELECT * FROM ('.$query.') '.self::DATASET_TABLE_ALIAS; // If the given query is valid and the parameter filters is an array if (!empty(trim($query)) && $filters != null && is_array($filters)) @@ -287,7 +287,7 @@ class FiltersLib if ($where != '') // if the SQL where clause was built { - $datasetQuery = 'SELECT * FROM ('.$query.') '.self::DATASET_TABLE_ALIAS.' WHERE '.$where; + $datasetQuery .= ' WHERE '.$where; } } diff --git a/application/models/system/Filters_model.php b/application/models/system/Filters_model.php index eb81dbb32..20ab6419e 100644 --- a/application/models/system/Filters_model.php +++ b/application/models/system/Filters_model.php @@ -13,7 +13,7 @@ class Filters_model extends DB_Model } /** - * + * Loads a filter by its app, dataset_name and filter_kurzbz */ public function getFilterList($app, $dataset_name, $filter_kurzbz) { @@ -24,7 +24,6 @@ class Filters_model extends DB_Model 'app' => $app, 'dataset_name' => $dataset_name, 'person_id' => null, - 'default_filter' => false, 'array_length(description, 1) >' => 0, 'filter_kurzbz ILIKE' => $filter_kurzbz ); @@ -33,7 +32,7 @@ class Filters_model extends DB_Model } /** - * + * Loads a custom filter by its app, dataset_name and the uid of the owner */ public function getCustomFiltersList($app, $dataset_name, $uid) { @@ -50,12 +49,4 @@ class Filters_model extends DB_Model return $this->loadWhere($filterParametersArray); } - - /** - * - */ - public function deleteCustomFilter($filter_id) - { - return $this->delete($filter_id); - } } From fbcefcbd511c45d67e326c27fc002fd1af02a247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Wed, 13 Jun 2018 18:40:07 +0200 Subject: [PATCH 06/10] =?UTF-8?q?Schnittstelle=20zum=20Datenverbund=20f?= =?UTF-8?q?=C3=BCr=20Abfrage=20und=20Vergabe=20von=20Matrikelnummern=20ink?= =?UTF-8?q?l.=20Testclient=20f=C3=BCr=20manuelle=20Abfrage=20der=20Daten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/dvb.class.php | 654 +++++++++++++++++++++++++++++++++++ soap/datenverbund_client.php | 245 +++++++++++++ soap/index.html | 5 +- 3 files changed, 902 insertions(+), 2 deletions(-) create mode 100644 include/dvb.class.php create mode 100644 soap/datenverbund_client.php diff --git a/include/dvb.class.php b/include/dvb.class.php new file mode 100644 index 000000000..fc9b26c1d --- /dev/null +++ b/include/dvb.class.php @@ -0,0 +1,654 @@ +, + */ +/** + * Datenverbund Services + * Anbindung für Datenverbund des Bundesrechenzetrums zur + * Abfrage und Vergabe von Matrikelnummern + */ +require_once(dirname(__FILE__).'/basis_db.class.php'); + +class dvb +{ + const DVB_URL_WEBSERVICE_OAUTH = 'https://stubei-q.portal.at/dvb/oauth/token'; + const DVB_URL_WEBSERVICE_SVNR = 'https://stubei-q.portal.at/rws/0.1/simpleStudentBySozialVersicherungsnummer.xml'; + const DVB_URL_WEBSERVICE_ERSATZKZ = 'https://stubei-q.portal.at/rws/0.1/simpleStudentByErsatzKennzeichen.xml'; + const DVB_URL_WEBSERVICE_RESERVIERUNG = 'https://stubei-q.portal.at/dvb/matrikelnummern/1.0/reservierung.xml'; + const DVB_URL_WEBSERVICE_MELDUNG = 'https://stubei-q.portal.at/dvb/matrikelnummern/1.0/meldung.xml'; + + public $authentication; + private $username; + private $password; + private $debug; + public $debug_output = ''; + + /** + * Constructor + * @param string $username Username fuer OAuth2 Login. + * @param string $password Passwort fuer OAuth2 Login. + * @param bool $debug Enables/Disables Debugging. + */ + public function __construct($username, $password, $debug = false) + { + $this->username = $username; + $this->password = $password; + $this->debug = $debug; + } + + /** + * Performs a OAuth2 Authentication and returns the OAuth Bearer Token + * @return boolean true wenn erfolgreich, false im Fehlerfall + */ + public function authenticate() + { + $this->debug('Request new OAuth Token'); + + $curl = curl_init(); + $url = self::DVB_URL_WEBSERVICE_OAUTH; + $url .= '?grant_type=client_credentials'; + + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + + $headers = array( + 'Accept: application/json', + 'Content-Type: application/x-www-form-urlencoded', + 'Authorization: Basic '.base64_encode($this->username.":".$this->password), + 'User-Agent: FHComplete', + 'Connection: Keep-Alive', + 'Expect:', + 'Content-Length: 0' + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + $this->debug('Sending Request to '.$url); + $json_response = curl_exec($curl); + $curl_info = curl_getinfo($curl); + curl_close($curl); + + $this->debug('Response: '.$curl_info['http_code']); + + if ($curl_info['http_code'] == '200') + { + /* Example Response: + { + "access_token": "d9c60404-1530-4b05-bb8e-0a0b0f321726", + "token_type": "bearer", + "expires_in": 41087, + "scope": "read write ROLE_bildungseinrichtung + ROLE_bildungseinrichtung_A" + } + */ + + $this->authentication = json_decode($json_response); + + // Calculate Expire Date + $ttl = new DateTime(); + $ttl->add(new DateInterval('PT'.$this->authentication->expires_in.'S')); + $this->authentication->DateTimeExpires = $ttl; + + $this->debug('Access_token:'.$this->authentication->access_token); + $this->debug('Scope:'.$this->authentication->scope); + + return true; + } + else + { + $this->errormsg = 'Request Failed with HTTP Code:'.$curl_info['http_code'].' and Response:'.$json_response; + return false; + } + } + + /** + * Checks if the Token is Expired + * @return boolean true if expired, false if valid. + */ + private function tokenIsExpired() + { + if (!isset($this->authentication)) + return true; + + $dtnow = new DateTime(); + if ($this->authentication->DateTimeExpires < $dtnow) + { + return true; + } + else + return false; + } + + /** + * Get Matrikelnummer by Social Security Number + * @param string $svnr Social Security Number. + * @return Matrikelnummer or false on error. + */ + public function getMatrikelnrBySVNR($svnr) + { + if ($this->tokenIsExpired()) + { + $this->authenticate(); + } + + $this->debug('getMatirkelnrBySVNR'); + + $curl = curl_init(); + + $url = self::DVB_URL_WEBSERVICE_SVNR; + $url .= '?sozialVersicherungsNummer='.curl_escape($curl, $svnr); + + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + + $headers = array( + 'Accept: application/json', + 'Authorization: Bearer '.$this->authentication->access_token, + 'User-Agent: FHComplete', + 'Connection: Keep-Alive', + 'Expect:', + 'Content-Length: 0' + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + $this->debug('Sending Request to '.$url); + + $response = curl_exec($curl); + $curl_info = curl_getinfo($curl); + curl_close($curl); + + $this->debug('Response '.$curl_info['http_code']); + if ($curl_info['http_code'] == '200') + { + /* Example Response: + + + 12345678 + Max + Mustermann + M + 1999-02-19 + A + + + */ + $dom = new DOMDocument(); + $dom->loadXML($response); + $namespace = 'http://www.brz.gv.at/datenverbund-unis'; + $domnodes_matrikelnummer = $dom->getElementsByTagNameNS($namespace, 'matrikelNummer'); + foreach ($domnodes_matrikelnummer as $row) + { + // Found + return $row->textContent; + } + + $this->errormsg = ''; + return false; + } + else + { + $this->errormsg = 'Request Failed with HTTP Code:'.$curl_info['http_code'].' and Response:'.$response; + return false; + } + } + + /** + * Get Matrikelnummer by Ersatzkennzeichen + * @param string $ersatzkennzeichen Ersatzkennzeichen to search for. + * @return Matrikelnummer or false + */ + public function getMatrikelnrByErsatzkennzeichen($ersatzkennzeichen) + { + if ($this->tokenIsExpired()) + { + $this->authenticate(); + } + + $this->debug('getMatrikelnrByErsatzkennzeichen'); + $curl = curl_init(); + + $url = self::DVB_URL_WEBSERVICE_ERSATZKZ; + $url .= '?ersatzKennzeichen='.curl_escape($curl, $ersatzkennzeichen); + + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + + $headers = array( + 'Accept: application/json', + 'Authorization: Bearer '.$this->authentication->access_token, + 'User-Agent: FHComplete', + 'Connection: Keep-Alive', + 'Expect:', + 'Content-Length: 0' + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + $this->debug('Sending Request to '.$url); + $xml_response = curl_exec($curl); + $curl_info = curl_getinfo($curl); + curl_close($curl); + $this->debug('Response: '.$curl_info['http_code']); + + if ($curl_info['http_code'] == '200') + { + /* Example Response Success + + + A + 12345678 + 2017S + ABCD201093 + Bc. + Max + Mustermann + W + 1993-06-26 + TCH + + A + 1030 + Wien + Obere Bahngasse 20/12 + + + A + 1030 + Wien + Obere Bahngasse 20/12 + + + + 12345678 + Max + Mustermann + W + 1993-06-26 + TCH + + + */ + /* 200 - No Entry found + + */ + /* 401 Error Code Token Expired + { + "error": "invalid_token", + "error_description": "Access token expired: 64a58ef3-1a70-46e9-b44f-35cc5051ae8e" + } + */ + /* 400 Bad Request + + 318e1bc5-279d-43c4-af47-5e6df2ff5279 + + + ZD00001 + Z + + Der Server konnte die Anfrage nicht vearbeiten. + Required String parameter 'ersatzKennzeichen' is not present + + + + */ + + $dom = new DOMDocument(); + $dom->loadXML($xml_response); + $namespace = 'http://www.brz.gv.at/datenverbund-unis'; + $domnodes_matrikelnummer = $dom->getElementsByTagNameNS($namespace, 'matrikelNummer'); + foreach ($domnodes_matrikelnummer as $row) + { + // Found + return $row->textContent; + } + } + else + { + $this->errormsg = 'Request Failed with HTTP Code:'.$curl_info['http_code'].' and Response:'.$xml_response; + return false; + } + } + + /** + * List of already Reserved Matrikelnummern + * @param string $bildungseinrichtung Shortname of Institution. + * @param string $studienjahr Year of Reservation. + * @return array with reserved Matrikelnr. or false on failure. + */ + public function getReservations($bildungseinrichtung, $studienjahr) + { + $this->debug('getReservations'); + $uuid = $this->getUUID(); + + if ($this->tokenIsExpired()) + { + $this->authenticate(); + } + + $curl = curl_init(); + $url = self::DVB_URL_WEBSERVICE_RESERVIERUNG; + $url .= '?uuid='.curl_escape($curl, $uuid); + $url .= '&be='.curl_escape($curl, $bildungseinrichtung); + $url .= '&sj='.curl_escape($curl, $studienjahr); + + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + + $headers = array( + 'Accept: application/xml', + 'Authorization: Bearer '.$this->authentication->access_token, + 'User-Agent: FHComplete', + 'Connection: Keep-Alive', + 'Expect:', + 'Content-Length: 0' + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + $this->debug('Request URL:'.$url); + $response = curl_exec($curl); + $curl_info = curl_getinfo($curl); + curl_close($curl); + + $this->debug('Response: '.$curl_info['http_code']); + + /* 200 ok + + + 793d44fa-5646-42b1-b0cb-f2f121b2f14f + + + 12345678 + 23456789 + + + */ + if ($curl_info['http_code'] == '200') + { + $dom = new DOMDocument(); + $dom->loadXML($response); + $domnodes_matrikelnummer = $dom->getElementsByTagName('matrikelnummer'); + $reservations = array(); + foreach ($domnodes_matrikelnummer as $row) + { + $reservations[] = $row->textContent; + } + return $reservations; + } + else + { + $this->errormsg = 'Request Failed with HTTP Code:'.$curl_info['http_code'].' and Response:'.$response; + return false; + } + } + + /** + * Request a new Matrikelnummer + * @param string $bildungseinrichtung Shortname of Institution. + * @param string $studienjahr Year of issuing. + * @param int $anzahl Number of Requested Numbers. + * @return array list of matrikelnr or false on failure. + */ + public function getKontingent($bildungseinrichtung, $studienjahr, $anzahl = 1) + { + $this->debug('getKontingent'); + $uuid = $this->getUUID(); + + if ($this->tokenIsExpired()) + { + $this->authenticate(); + } + + $data = ' + + '.$uuid.' + + '.$anzahl.' + '.$bildungseinrichtung.' + '.$studienjahr.' + + + '; + + $curl = curl_init(); + $url = self::DVB_URL_WEBSERVICE_RESERVIERUNG; + + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + + $headers = array( + 'Accept: application/xml', + 'Content-Type: application/xml', + 'Authorization: Bearer '.$this->authentication->access_token, + 'User-Agent: FHComplete', + 'Connection: Keep-Alive', + 'Expect:' + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + $this->debug('Request URL:'.$url); + $this->debug('Request Data:'.$data); + $response = curl_exec($curl); + $curl_info = curl_getinfo($curl); + curl_close($curl); + + $this->debug('Response: '.$curl_info['http_code']); + + if ($curl_info['http_code'] == '200') + { + $dom = new DOMDocument(); + $dom->loadXML($response); + $domnodes_matrikelnummer = $dom->getElementsByTagName('matrikelnummer'); + $kontingent = array(); + foreach ($domnodes_matrikelnummer as $row) + { + $kontingent[] = $row->textContent; + } + return $kontingent; + } + else + { + $this->errormsg = 'Request Failed with HTTP Code:'.$curl_info['http_code'].' and Response:'.$response; + return false; + } + } + + /** + * Meldet die Vergabe der Matrikelnummer + * @param string $bildungseinrichtung Kennzeichen der Bildungseinrichtung. + * @param object $person Objekt mit den Personendaten. + * @return booelan true wenn erfolgreich + */ + public function setMatrikelnummer($bildungseinrichtung, $person) + { + $this->debug('setMatrikelnummer'); + $uuid = $this->getUUID(); + + if ($this->tokenIsExpired()) + { + $this->authenticate(); + } + + $data = ' + + '.$uuid.' + + '.$bildungseinrichtung.' + '.$person->geburtsdatum.' + '.$person->geschlecht.' + '.$person->matrikelnummer.''; + if (isset($person->matura) && $person->matura != '') + $data .= ''.$person->matura.''; + else + $data .= '00000000'; + + $data .= ''.$person->nachname.''; + + if (isset($person->plz) && $person->plz != '') + $data .= ''.$person->plz.''; + + $data .= ''.$person->staat.''; + + if (isset($person->svnr) && $person->svnr != '') + $data .= ''.$person->svnr.''; + + $data .= ''.$person->vorname.''; + + if (isset($person->writeonerror) && $person->writeonerror === true) + $data .= 'J'; + + $data .= ' + + + '; + + $curl = curl_init(); + $url = self::DVB_URL_WEBSERVICE_MELDUNG; + + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + + $headers = array( + 'Accept: application/xml', + 'Content-Type: application/xml', + 'Authorization: Bearer '.$this->authentication->access_token, + 'User-Agent: FHComplete', + 'Connection: Keep-Alive', + 'Expect:' + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + $this->debug('Request URL:'.$url); + $this->debug('Request Data:'.$data); + $response = curl_exec($curl); + $curl_info = curl_getinfo($curl); + curl_close($curl); + + $this->debug('Response: '.$curl_info['http_code']); + + $this->debug('Response: '.print_r($response, true)); + /* 200 Fehlermeldung + + + b76e84a9-c0bd-494c-97cb-c4ab9cd452c5 + + + ZD01471 + 90 + UNI-Kennzeichen + UNI-Kennzeichen fehlt oder ungültig (FHTEST) + BRZ + FHTEST + + + AG21333 + 65 + Datum allg.Univ.reife + kein gültiges Datum oder Format + Korrektur Datum allg. Univ.reife oder 000000 angeben, falls nicht anwendbar + leer + + + ZD10073 + 90 + Matrikelnummer + aus ungültigem Kontingent + Korrektur der Matrikelnummer + 12345678 + + + + */ + /* 200 ok + + + 8b239582-6bc5-4193-ac79-2dcf9ec96439 + + + */ + if ($curl_info['http_code'] == '200') + { + $dom = new DOMDocument(); + $dom->loadXML($response); + $domnodes_fehlerliste = $dom->getElementsByTagName('fehlerliste'); + + $fehleranzahl = $domnodes_fehlerliste[0]->getAttribute('fehleranzahl'); + if ($fehleranzahl === '0') + { + // Keine Fehler -> Meldung erfolgreich + return true; + } + else + { + $this->errormsg = 'Es gab '.$fehleranzahl.' Fehler:'; + $domnodes_fehler = $dom->getElementsByTagName('fehler'); + foreach ($domnodes_fehler as $row) + { + $datenfeld = $row->getElementsByTagName('datenfeld'); + $fehlertext = $row->getElementsByTagName('fehlertext'); + $this->errormsg .= ' Datenfeld:'.$datenfeld[0]->textContent; + $this->errormsg .= ' Fehlertext:'.$fehlertext[0]->textContent; + } + return false; + } + } + else + { + $this->errormsg = 'Request Failed with HTTP Code:'.$curl_info['http_code'].' and Response:'.$response; + return false; + } + } + + /** + * Generiert eine eindeutige UUID + * @return uuid + */ + private function getUUID() + { + $data = openssl_random_pseudo_bytes(16); + $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 + $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 + + return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); + } + + /** + * Erstellt eine Debug Message + * @param string $msg Message to log. + * @return void + */ + private function debug($msg) + { + if ($this->debug) + $this->debug_output .= "\n
".date('Y-m-d H:i:s').': '.htmlentities($msg); + } +} diff --git a/soap/datenverbund_client.php b/soap/datenverbund_client.php new file mode 100644 index 000000000..0dc47c109 --- /dev/null +++ b/soap/datenverbund_client.php @@ -0,0 +1,245 @@ +, + */ +/** + * Testclient fuer Abfrage der REST Webservice Schnittstelle des Datenverbundes + */ +require_once('../config/vilesci.config.inc.php'); +require_once('../include/functions.inc.php'); +require_once('../include/basis_db.class.php'); +require_once('../include/benutzerberechtigung.class.php'); +require_once('../include/dvb.class.php'); + +$uid = get_uid(); +$rechte = new benutzerberechtigung(); +$rechte->getBerechtigungen($uid); +if (!$rechte->isBerechtigt('admin')) + die($rechte->errormsg); + +$db = new basis_db(); + +if (isset($_GET['action'])) + $action = $_GET['action']; +else + $action = 'getBySvnr'; + +$username = filter_input(INPUT_POST, 'username'); +$password = filter_input(INPUT_POST, 'password'); +$bildungseinrichtung = filter_input(INPUT_POST, 'bildungseinrichtung'); +$studienjahr = filter_input(INPUT_POST, 'studienjahr'); +$matrikelnr = filter_input(INPUT_POST, 'matrikelnummer'); +$nachname = filter_input(INPUT_POST, 'nachname'); +$vorname = filter_input(INPUT_POST, 'vorname'); +$geburtsdatum = filter_input(INPUT_POST, 'geburtsdatum'); +$geschlecht = filter_input(INPUT_POST, 'geschlecht'); +$postleitzahl = filter_input(INPUT_POST, 'postleitzahl'); +$staat = filter_input(INPUT_POST, 'staat'); +$matura = filter_input(INPUT_POST, 'matura'); +$svnr = filter_input(INPUT_POST, 'svnr'); +$ersatzkennzeichen = filter_input(INPUT_POST, 'ersatzkennzeichen'); + +?> + + + + Datenverbund-Client + + +

Testclient für Datenverbund-Webservice

+ +

+
+ + + + + '; + } + + printrow('username', 'Username', $username, '', 100); + printrow('password', 'Passwort', $password, '', 100); + + switch($action) + { + case 'getOAuth': + break; + + case 'getBySvnr': + printrow('svnr', 'SVNR', $svnr); + break; + + case 'getByErsatzkennzeichen': + printrow('ersatzkennzeichen', 'Ersatzkennzeichen', $ersatzkennzeichen); + break; + + case 'getReservations': + case 'getKontingent': + printrow( + 'bildungseinrichtung', + 'Bildungseinrichtung', + $bildungseinrichtung, + 'Kurzzeichen der Bildungseinrichtung' + ); + printrow('studienjahr', 'Studienjahr', $studienjahr, 'zB 2016 (für WS2016 und SS2017)', 4); + break; + + case 'setMatrikelnummer': + printrow( + 'bildungseinrichtung', + 'Bildungseinrichtung', + $bildungseinrichtung, + 'Kurzzeichen der Bildungseinrichtung' + ); + printrow('matrikelnummer', 'Matrikelnummer', $matrikelnr); + printrow('nachname', 'Nachname', $nachname, '', 255); + printrow('vorname', 'Vorname', $vorname, '', 30); + printrow('geburtsdatum', 'Geburtsdatum', $geburtsdatum, 'Format: YYYYMMDD', 10); + printrow('geschlecht', 'Geschlecht', $geschlecht, 'Format: M | W', 1); + printrow('postleitzahl', 'Postleitzahl', $postleitzahl, '', 10); + printrow('staat', 'Staat', $staat, '1-3 Stellen Codex (zb A für Österreich)', 3); + printrow('svnr', 'SVNR', $staat); + printrow('matura', 'Maturadatum', $matura, 'Format: YYYYMMDD (optional)', 10); + break; + + default: + echo "Unknown action"; + break; + } + + echo ' + + + + '; + ?> + + + + + +
'.$title.': + '.$hint.' +
Debug
+ +
+
+authenticate()) + echo '
OAuth Bearer Token: '.$dvb->authentication->access_token; + else + echo '
Failed: '.$dvb->errormsg; + break; + + case 'getBySvnr': + $matrikelnr = $dvb->getMatrikelnrBySVNR($_POST['svnr']); + if ($matrikelnr !== false) + echo '
Matrikelnummer vorhanden:'.$matrikelnr; + else + echo '
Matrikelnummer nicht vorhanden:'.$dvb->errormsg; + break; + + case 'getByErsatzkennzeichen': + $matrikelnr = $dvb->getMatrikelnrByErsatzkennzeichen($_POST['ersatzkennzeichen']); + if ($matrikelnr !== false) + echo '
Matrikelnummer vorhanden:'.$matrikelnr; + else + echo '
Matrikelnummer nicht vorhanden:'.$dvb->errormsg; + break; + + case 'getReservations': + $reservierteNummern = $dvb->getReservations($_POST['bildungseinrichtung'], $_POST['studienjahr']); + + if ($reservierteNummern !== false) + echo '
Reservierte Nummern:'.print_r($reservierteNummern, true); + else + echo '
Fehlgeschlagen:'.$dvb->errormsg; + break; + + case 'getKontingent': + $kontingent = $dvb->getKontingent($_POST['bildungseinrichtung'], $_POST['studienjahr']); + + if ($kontingent !== false) + echo '
Kontingent:'.print_r($kontingent, true); + else + echo '
Fehlgeschlagen:'.$dvb->errormsg; + break; + + case 'setMatrikelnummer': + $person = new stdClass(); + $person->matrikelnummer = $matrikelnummer; + $person->vorname = $vorname; + $person->nachname = $nachname; + $person->geburtsdatum = $geburtsdatum; + $person->geschlecht = $geschlecht; + $person->staat = $staat; + $person->plz = $postleitzahl; + $person->matura = $matura; // Optional + $person->svnr = $svnr; // Optional + + if ($dvb->setMatrikelnummer($_POST['bildungseinrichtung'], $person)) + echo '
Erfolgreich gemeldet'; + else + echo '
Fehlgeschlagen:'.$dvb->errormsg; + break; + + default: + echo "Unknown action"; + break; + } + if (isset($_POST['debug'])) + echo '
'.$dvb->debug_output.'
'; +} + +?> + + diff --git a/soap/index.html b/soap/index.html index bad3ad150..3f086ac16 100644 --- a/soap/index.html +++ b/soap/index.html @@ -8,13 +8,14 @@
  • Ort / Raum
  • Studierendendaten
  • LV-Plan
  • -
  • Personen
  • +
  • Personen
  • Sonstiges

    • Projekte
    • @@ -23,4 +24,4 @@
    • Ressource
    - \ No newline at end of file + From 8837083f10541d5d4f3333322562e19e8c503e4e Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 14 Jun 2018 16:59:14 +0200 Subject: [PATCH 07/10] - Added helper session_helper to add utility functions to manage the php session - Adapted the library FiltersLib to use the session_helper --- application/helpers/session_helper.php | 88 ++++++++++++++++++++++++++ application/libraries/FiltersLib.php | 52 ++++----------- 2 files changed, 102 insertions(+), 38 deletions(-) create mode 100644 application/helpers/session_helper.php diff --git a/application/helpers/session_helper.php b/application/helpers/session_helper.php new file mode 100644 index 000000000..e74468896 --- /dev/null +++ b/application/helpers/session_helper.php @@ -0,0 +1,88 @@ +_ci =& get_instance(); + $this->_ci =& get_instance(); // get code igniter instance // Loads helper message to manage returning messages $this->_ci->load->helper('message'); + // Loads helper session to manage the php session + $this->_ci->load->helper('session'); $this->_filterUniqueId = $this->_getFilterUniqueId($params); // sets the id for the related filter widget } @@ -90,27 +92,19 @@ class FiltersLib // Public methods /** - * Returns the whole session for this filter widget if found, otherwise null + * Wrapper method to the session helper funtions to retrive the whole session for this filter */ public function getSession() { - $session = null; - - // If it is present a session for this filter - if (isset($_SESSION[self::SESSION_NAME]) && isset($_SESSION[self::SESSION_NAME][$this->_filterUniqueId])) - { - $session = $_SESSION[self::SESSION_NAME][$this->_filterUniqueId]; - } - - return $session; + return getElementSession(self::SESSION_NAME, $this->_filterUniqueId); } /** - * Returns one element from the session of this filter widget, otherwise null + * Wrapper method to the session helper funtions to retrive one element from the session of this filter */ public function getElementSession($name) { - $session = $this->getSession(); // get the whole session for this filter + $session = getElementSession(self::SESSION_NAME, $this->_filterUniqueId); if (isset($session[$name])) { @@ -121,41 +115,23 @@ class FiltersLib } /** - * Sets the whole session for this filter widget + * Wrapper method to the session helper funtions to set the whole session for this filter */ public function setSession($data) { - // If is NOT already present into the session - if (!isset($_SESSION[self::SESSION_NAME]) - || (isset($_SESSION[self::SESSION_NAME]) && !is_array($_SESSION[self::SESSION_NAME]))) - { - $_SESSION[self::SESSION_NAME] = array(); // then create it - } - - $_SESSION[self::SESSION_NAME][$this->_filterUniqueId] = $data; // stores data + setElementSession(self::SESSION_NAME, $this->_filterUniqueId, $data); } /** - * Sets one element of the session of this filter widget + * Wrapper method to the session helper funtions to set one element in the session for this filter */ public function setElementSession($name, $value) { - // If is NOT already present into the session - if (!isset($_SESSION[self::SESSION_NAME]) - || (isset($_SESSION[self::SESSION_NAME]) && !is_array($_SESSION[self::SESSION_NAME]))) - { - $_SESSION[self::SESSION_NAME] = array(); // then create it - } + $session = getElementSession(self::SESSION_NAME, $this->_filterUniqueId); - // If the session for this filter is NOT already present into the session - if (!isset($_SESSION[self::SESSION_NAME][$this->_filterUniqueId]) - || (isset($_SESSION[self::SESSION_NAME][$this->_filterUniqueId]) - && !is_array($_SESSION[self::SESSION_NAME][$this->_filterUniqueId]))) - { - $_SESSION[self::SESSION_NAME][$this->_filterUniqueId] = array(); // then create it - } + $session[$name] = $value; - $_SESSION[self::SESSION_NAME][$this->_filterUniqueId][$name] = $value; // stores the single value + setElementSession(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value } /** From 5b4d882bdb3f4c891004d8b6ead126d38a3e2540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Thu, 14 Jun 2018 18:22:34 +0200 Subject: [PATCH 08/10] =?UTF-8?q?-=20PHP=20Notice=20behoben=20bei=20Studie?= =?UTF-8?q?ng=C3=A4ngen=20ohne=20Leerzeichen=20-=20PHP=20Notice=20behoben?= =?UTF-8?q?=20bei=20Pr=C3=BCfern=20ohne=20geschlecht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rdf/abschlusspruefung.rdf.php | 505 ++++++++++++++++++---------------- 1 file changed, 268 insertions(+), 237 deletions(-) diff --git a/rdf/abschlusspruefung.rdf.php b/rdf/abschlusspruefung.rdf.php index 2571ed782..d06f1842d 100644 --- a/rdf/abschlusspruefung.rdf.php +++ b/rdf/abschlusspruefung.rdf.php @@ -19,16 +19,14 @@ * Andreas Oesterreicher and * Rudolf Hangl . */ -// header für no cache header("Cache-Control: no-cache"); header("Cache-Control: post-check=0, pre-check=0",false); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Pragma: no-cache"); -// content type setzen header("Content-type: application/xhtml+xml"); -// DAO require_once('../config/vilesci.config.inc.php'); +require_once('../include/functions.inc.php'); require_once('../include/abschlusspruefung.class.php'); require_once('../include/person.class.php'); require_once('../include/benutzer.class.php'); @@ -43,11 +41,22 @@ require_once('../include/projektarbeit.class.php'); require_once('../include/lehreinheit.class.php'); require_once('../include/lehrveranstaltung.class.php'); require_once('../include/note.class.php'); +require_once('../include/benutzerberechtigung.class.php'); $xmlformat='rdf'; if(isset($_GET['xmlformat'])) $xmlformat=$_GET['xmlformat']; +if(isset($_SERVER['REMOTE_USER'])) +{ + // Wenn das Script direkt aufgerufen wird muss es ein Admin sein + $user=get_uid(); + $berechtigung = new benutzerberechtigung(); + $berechtigung->getBerechtigungen($user); + if(!$berechtigung->isBerechtigt('admin')) + die('Sie haben keine Berechtigung fuer diese Seite'); +} + echo ''; $datum_obj = new datum(); @@ -57,235 +66,257 @@ $abschlussbeurteilung_arr = array(); $abschlussbeurteilung_arrEnglish = array(); $qry = "SELECT * FROM lehre.tbl_abschlussbeurteilung"; if($db->db_query($qry)) +{ while($row = $db->db_fetch_object()) { $abschlussbeurteilung_arr[$row->abschlussbeurteilung_kurzbz]=$row->bezeichnung; $abschlussbeurteilung_arrEng[$row->abschlussbeurteilung_kurzbz]=$row->bezeichnung_english; } +} $note_arr = array(); $qry = "SELECT * FROM lehre.tbl_note"; if($db->db_query($qry)) +{ while($row = $db->db_fetch_object()) - $note_arr[$row->note]=$row->anmerkung; - - function draw_content_xml($row) { - global $rdf_url, $datum_obj, $abschlussbeurteilung_arr, $abschlussbeurteilung_arrEng, $note_arr; - $vorsitz = ''; - $pruefer1= ''; - $pruefer2= ''; - $pruefer3= ''; + $note_arr[$row->note]=$row->anmerkung; + } +} - //Nachnamen der Pruefer holden - $person = new person(); - $mitarbeiter = new mitarbeiter(); - $student= new student($row->student_uid); +function draw_content_xml($row) +{ + global $rdf_url, $datum_obj, $abschlussbeurteilung_arr, $abschlussbeurteilung_arrEng, $note_arr; + $vorsitz = ''; + $pruefer1= ''; + $pruefer2= ''; + $pruefer3= ''; - $nation=new nation($student->geburtsnation); - $geburtsnation=$nation->kurztext; - $geburtsnation_engl=$nation->engltext; - $nation->load($student->staatsbuergerschaft); - $staatsbuergerschaft=$nation->kurztext; - $staatsbuergerschaft_engl=$nation->engltext; + //Nachnamen der Pruefer holden + $person = new person(); + $mitarbeiter = new mitarbeiter(); + $student= new student($row->student_uid); - $studiengang = new studiengang($student->studiengang_kz); - $akadgrad = new akadgrad($row->akadgrad_id); + $nation=new nation($student->geburtsnation); + $geburtsnation=$nation->kurztext; + $geburtsnation_engl=$nation->engltext; + $nation->load($student->staatsbuergerschaft); + $staatsbuergerschaft=$nation->kurztext; + $staatsbuergerschaft_engl=$nation->engltext; - if($mitarbeiter->load($row->vorsitz)) + $studiengang = new studiengang($student->studiengang_kz); + $akadgrad = new akadgrad($row->akadgrad_id); + $vorsitz_geschlecht = ''; + + if($mitarbeiter->load($row->vorsitz)) + { + $vorsitz = $mitarbeiter->titelpre.' '.$mitarbeiter->vorname; + $vorsitz .= ' '.$mitarbeiter->nachname.' '.$mitarbeiter->titelpost; + $vorsitz = trim($vorsitz); + + $vorsitz_geschlecht = $mitarbeiter->geschlecht; + } + if($person->load($row->pruefer1)) + $pruefer1 = trim($person->titelpre.' '.$person->vorname.' '.$person->nachname.' '.$person->titelpost); + if($person->load($row->pruefer2)) + $pruefer2 = trim($person->titelpre.' '.$person->vorname.' '.$person->nachname.' '.$person->titelpost); + if($person->load($row->pruefer3)) + $pruefer3 = trim($person->titelpre.' '.$person->vorname.' '.$person->nachname.' '.$person->titelpost); + + $qry = "SELECT * FROM public.tbl_benutzerfunktion JOIN campus.vw_mitarbeiter USING(uid) WHERE funktion_kurzbz='rek'"; + $rektor = ''; + $db = new basis_db(); + $db2 = new basis_db(); + if($db->db_query($qry)) + if($row_rek = $db->db_fetch_object()) + $rektor = $row_rek->titelpre.' '.$row_rek->vorname.' '.$row_rek->nachname.' '.$row_rek->titelpost; + $qry = "SELECT + * + FROM + ( + SELECT + titel as themenbereich, ende, projektarbeit_id, note, beginn + FROM + lehre.tbl_projektarbeit a + WHERE + student_uid=".$db->db_add_param($student->uid)." + AND projekttyp_kurzbz in('Bachelor','Diplom','Master','Dissertation','Lizenziat','Magister') + AND a.final=true + ORDER BY beginn DESC, projektarbeit_id ASC LIMIT 2 + ) as a + ORDER BY beginn asc"; + $themenbereich=''; + $datum_projekt=''; + $betreuer = ''; + $betreuer_2 = ''; + $themenbereich_2 = ''; + $note = ''; + $note2=''; + $datum_projekt2=''; + + if($result_proj = $db->db_query($qry)) + { + if($row_proj = $db->db_fetch_object($result_proj)) { - $vorsitz = trim($mitarbeiter->titelpre.' '.$mitarbeiter->vorname.' '.$mitarbeiter->nachname.' '.$mitarbeiter->titelpost); - $vorsitz_geschlecht = $mitarbeiter->geschlecht; - } - if($person->load($row->pruefer1)) - $pruefer1 = trim($person->titelpre.' '.$person->vorname.' '.$person->nachname.' '.$person->titelpost); - if($person->load($row->pruefer2)) - $pruefer2 = trim($person->titelpre.' '.$person->vorname.' '.$person->nachname.' '.$person->titelpost); - if($person->load($row->pruefer3)) - $pruefer3 = trim($person->titelpre.' '.$person->vorname.' '.$person->nachname.' '.$person->titelpost); - - $qry = "SELECT * FROM public.tbl_benutzerfunktion JOIN campus.vw_mitarbeiter USING(uid) WHERE funktion_kurzbz='rek'"; - $rektor = ''; - $db = new basis_db(); - $db2 = new basis_db(); - if($db->db_query($qry)) - if($row_rek = $db->db_fetch_object()) - $rektor = $row_rek->titelpre.' '.$row_rek->vorname.' '.$row_rek->nachname.' '.$row_rek->titelpost; - $qry = "SELECT - * + $qry_bet = "SELECT titelpre, vorname, nachname, titelpost FROM - ( - SELECT - titel as themenbereich, ende, projektarbeit_id, note, beginn + lehre.tbl_projektbetreuer + JOIN public.tbl_person USING(person_id) + WHERE + projektarbeit_id=".$db->db_add_param($row_proj->projektarbeit_id)." + AND (betreuerart_kurzbz in('Erstbegutachter', 'Erstbetreuer', 'Betreuer', 'Begutacher')) + LIMIT 1"; + if($db2->db_query($qry_bet)) + if($row_bet = $db2->db_fetch_object()) + $betreuer = $row_bet->titelpre.' '.$row_bet->vorname.' '.$row_bet->nachname.' '.$row_bet->titelpost; + + $themenbereich = $row_proj->themenbereich; + $note = (isset($note_arr[$row_proj->note])?$note_arr[$row_proj->note]:$row_proj->note); + $datum_projekt = $datum_obj->convertISODate($row_proj->ende); + $projektarbeit = new projektarbeit($row_proj->projektarbeit_id); + $lehreinheit = new lehreinheit($projektarbeit->lehreinheit_id); + $lehrveranstaltung = new lehrveranstaltung($lehreinheit->lehrveranstaltung_id); + $projektnote = new note($note); + } + + if($row_proj = $db->db_fetch_object($result_proj)) + { + $qry_bet = "SELECT titelpre, vorname, nachname, titelpost FROM - lehre.tbl_projektarbeit a + lehre.tbl_projektbetreuer + JOIN public.tbl_person USING(person_id) WHERE - student_uid=".$db->db_add_param($student->uid)." - AND projekttyp_kurzbz in('Bachelor','Diplom','Master','Dissertation','Lizenziat','Magister') - AND a.final=true - ORDER BY beginn DESC, projektarbeit_id ASC LIMIT 2 - ) as a - ORDER BY beginn asc"; - $themenbereich=''; - $datum_projekt=''; - $betreuer = ''; - $betreuer_2 = ''; - $themenbereich_2 = ''; - $note = ''; - $note2=''; - $datum_projekt2=''; + projektarbeit_id=".$db->db_add_param($row_proj->projektarbeit_id, FHC_INTEGER)." + AND (betreuerart_kurzbz in('Erstbegutachter', 'Erstbetreuer', 'Betreuer', 'Begutacher')) + LIMIT 1"; + if($db2->db_query($qry_bet)) + if($row_bet = $db2->db_fetch_object()) + $betreuer_2 = $row_bet->titelpre.' '.$row_bet->vorname.' '.$row_bet->nachname.' '.$row_bet->titelpost; - if($result_proj = $db->db_query($qry)) - { - if($row_proj = $db->db_fetch_object($result_proj)) - { - $qry_bet = "SELECT titelpre, vorname, nachname, titelpost FROM lehre.tbl_projektbetreuer JOIN public.tbl_person USING(person_id) WHERE projektarbeit_id='$row_proj->projektarbeit_id' AND (betreuerart_kurzbz in('Erstbegutachter', 'Erstbetreuer', 'Betreuer', 'Begutacher')) LIMIT 1"; - if($db2->db_query($qry_bet)) - if($row_bet = $db2->db_fetch_object()) - $betreuer = $row_bet->titelpre.' '.$row_bet->vorname.' '.$row_bet->nachname.' '.$row_bet->titelpost; - - $themenbereich = $row_proj->themenbereich; - $note = (isset($note_arr[$row_proj->note])?$note_arr[$row_proj->note]:$row_proj->note); - $datum_projekt = $datum_obj->convertISODate($row_proj->ende); - $projektarbeit = new projektarbeit($row_proj->projektarbeit_id); - $lehreinheit = new lehreinheit($projektarbeit->lehreinheit_id); - $lehrveranstaltung = new lehrveranstaltung($lehreinheit->lehrveranstaltung_id); - $projektnote = new note($note); - } - - if($row_proj = $db->db_fetch_object($result_proj)) - { - $qry_bet = "SELECT titelpre, vorname, nachname, titelpost FROM lehre.tbl_projektbetreuer JOIN public.tbl_person USING(person_id) WHERE projektarbeit_id='$row_proj->projektarbeit_id' AND (betreuerart_kurzbz in('Erstbegutachter', 'Erstbetreuer', 'Betreuer', 'Begutacher')) LIMIT 1"; - if($db2->db_query($qry_bet)) - if($row_bet = $db2->db_fetch_object()) - $betreuer_2 = $row_bet->titelpre.' '.$row_bet->vorname.' '.$row_bet->nachname.' '.$row_bet->titelpost; - - $themenbereich_2 = $row_proj->themenbereich; - $note2 = (isset($note_arr[$row_proj->note])?$note_arr[$row_proj->note]:$row_proj->note); - $datum_projekt2 = $datum_obj->convertISODate($row_proj->ende); - } + $themenbereich_2 = $row_proj->themenbereich; + $note2 = (isset($note_arr[$row_proj->note])?$note_arr[$row_proj->note]:$row_proj->note); + $datum_projekt2 = $datum_obj->convertISODate($row_proj->ende); } - - switch($student->anrede) - { - case 'Herr': $anrede_engl = 'Mr'; break; - case 'Frau': $anrede_engl = 'Ms'; break; - default: $anrede_engl = ''; break; - } - - if($student->anrede == 'Herr') - $anrede = 'Herrn'; - else - $anrede = $student->anrede; - - - - if($row->sponsion=='') - $row->sponsion=$row->datum; - - $oe = new organisationseinheit(); - $parents = $oe->getParents($studiengang->oe_kurzbz); - $oe_parent = ""; - - foreach ($parents as $parent) - { - $oe_temp = new organisationseinheit(); - $oe_temp->load($parent); - if($oe_temp->organisationseinheittyp_kurzbz == 'Fakultät') - { - $oe_parent = $oe_temp->bezeichnung; - break; - } - } - - $studiengang_bezeichnung2 = explode(" ", $studiengang->bezeichnung, 2); - $name = trim($student->titelpre.' '.trim($student->vorname.' '.$student->vornamen).' '.$student->nachname.($student->titelpost!=''?', '.$student->titelpost:'')); - - //Wenn Lehrgang, dann Erhalter-KZ vor die Studiengangs-Kz hängen - if ($student->studiengang_kz<0) - { - $stg = new studiengang(); - $stg->load($student->studiengang_kz); - - $studiengang_kz = sprintf("%03s", $stg->erhalter_kz).sprintf("%04s", abs($student->studiengang_kz)); - } - else - $studiengang_kz = sprintf("%04s", abs($student->studiengang_kz)); - - echo "\t".' - abschlusspruefung_id.']]> - student_uid.']]> - vorsitz.']]> - - - pruefer1.']]> - - pruefer2.']]> - - pruefer3.']]> - - abschlussbeurteilung_kurzbz!=''?$abschlussbeurteilung_arr[$row->abschlussbeurteilung_kurzbz]:'').']]> - abschlussbeurteilung_kurzbz!=''?$abschlussbeurteilung_arrEng[$row->abschlussbeurteilung_kurzbz]:'').']]> - akadgrad_id.']]> - convertISODate($row->datum).']]> - datum.']]> - uhrzeit.']]> - convertISODate($row->sponsion).']]> - sponsion.']]> - pruefungstyp_kurzbz.']]> - beschreibung.']]> - - - - titelpre.']]> - vorname.']]> - vornamen.']]> - nachname.']]> - titelpost.']]> - matrikelnr).']]> - gebdatum.']]> - geschlecht.']]> - convertISODate($student->gebdatum).']]> - gebort.']]> - - - - - - bezeichnung.']]> - - english.']]> - - typ.']]> - akadgrad_kurzbz.']]> - titel.']]> - - anmerkung.']]> - bescheidbgbl1.']]> - bescheidbgbl2.']]> - bescheidgz.']]> - convertISODate($studiengang->bescheidvom).']]> - convertISODate($studiengang->titelbescheidvom).']]> - - - projekttyp_bezeichnung.']]> - bezeichnung.']]> - titel.']]> - - - - - bezeichnung.']]> - - note.']]> - - - '; - - echo "\n\t"; } + switch($student->anrede) + { + case 'Herr': $anrede_engl = 'Mr'; break; + case 'Frau': $anrede_engl = 'Ms'; break; + default: $anrede_engl = ''; break; + } + if($student->anrede == 'Herr') + $anrede = 'Herrn'; + else + $anrede = $student->anrede; + + if($row->sponsion=='') + $row->sponsion=$row->datum; + + $oe = new organisationseinheit(); + $parents = $oe->getParents($studiengang->oe_kurzbz); + $oe_parent = ""; + + foreach ($parents as $parent) + { + $oe_temp = new organisationseinheit(); + $oe_temp->load($parent); + if($oe_temp->organisationseinheittyp_kurzbz == 'Fakultät') + { + $oe_parent = $oe_temp->bezeichnung; + break; + } + } + + $studiengang_bezeichnung2 = explode(" ", $studiengang->bezeichnung, 2); + $name = $student->titelpre.' '.trim($student->vorname.' '.$student->vornamen).' '.$student->nachname; + $name .= ($student->titelpost!=''?', '.$student->titelpost:''); + $name = trim($name); + + //Wenn Lehrgang, dann Erhalter-KZ vor die Studiengangs-Kz hängen + if ($student->studiengang_kz<0) + { + $stg = new studiengang(); + $stg->load($student->studiengang_kz); + + $studiengang_kz = sprintf("%03s", $stg->erhalter_kz).sprintf("%04s", abs($student->studiengang_kz)); + } + else + $studiengang_kz = sprintf("%04s", abs($student->studiengang_kz)); + + echo "\t".' + abschlusspruefung_id.']]> + student_uid.']]> + vorsitz.']]> + + + pruefer1.']]> + + pruefer2.']]> + + pruefer3.']]> + + abschlussbeurteilung_kurzbz!=''?$abschlussbeurteilung_arr[$row->abschlussbeurteilung_kurzbz]:'').']]> + abschlussbeurteilung_kurzbz!=''?$abschlussbeurteilung_arrEng[$row->abschlussbeurteilung_kurzbz]:'').']]> + akadgrad_id.']]> + convertISODate($row->datum).']]> + datum.']]> + uhrzeit.']]> + convertISODate($row->sponsion).']]> + sponsion.']]> + pruefungstyp_kurzbz.']]> + beschreibung.']]> + + + + titelpre.']]> + vorname.']]> + vornamen.']]> + nachname.']]> + titelpost.']]> + matrikelnr).']]> + gebdatum.']]> + geschlecht.']]> + convertISODate($student->gebdatum).']]> + gebort.']]> + + + + + + bezeichnung.']]> + + english.']]> + + typ.']]> + akadgrad_kurzbz.']]> + titel.']]> + + anmerkung.']]> + bescheidbgbl1.']]> + bescheidbgbl2.']]> + bescheidgz.']]> + convertISODate($studiengang->bescheidvom).']]> + convertISODate($studiengang->titelbescheidvom).']]> + + + projekttyp_bezeichnung.']]> + bezeichnung.']]> + titel.']]> + + + + + bezeichnung.']]> + + note.']]> + + + '; + + echo "\n\t"; +} // ----------------------------------- RDF -------------------------------------- if ($xmlformat=='rdf') @@ -314,32 +345,32 @@ if ($xmlformat=='rdf') $pruefer3 = $person->nachname; echo ' - - - abschlusspruefung_id.']]> - student_uid.']]> - vorsitz.']]> - - pruefer1.']]> - - pruefer2.']]> - - pruefer3.']]> - - abschlussbeurteilung_kurzbz.']]> - note.']]> - akadgrad_id.']]> - convertISODate($row->datum).']]> - datum.']]> - uhrzeit.']]> - convertISODate($row->sponsion).']]> - sponsion.']]> - pruefungstyp_kurzbz.']]> - beschreibung.']]> - anmerkung.']]> - - - '; + + + abschlusspruefung_id.']]> + student_uid.']]> + vorsitz.']]> + + pruefer1.']]> + + pruefer2.']]> + + pruefer3.']]> + + abschlussbeurteilung_kurzbz.']]> + note.']]> + akadgrad_id.']]> + convertISODate($row->datum).']]> + datum.']]> + uhrzeit.']]> + convertISODate($row->sponsion).']]> + sponsion.']]> + pruefungstyp_kurzbz.']]> + beschreibung.']]> + anmerkung.']]> + + + '; } echo ' - + '; if(isset($_GET['student_uid'])) @@ -370,7 +401,7 @@ if ($xmlformat=='rdf') echo ' '; echo ''; -} //endof xmlformat==rdf +} // ----------------------------------- XML -------------------------------------- elseif ($xmlformat=='xml') { @@ -412,5 +443,5 @@ elseif ($xmlformat=='xml') die('Student_uid oder Abschlusspruefung_id muss uebergeben werden'); echo "\n"; -} //endof xmlformat==xml +} ?> From 0f798faab58671f0be74da17df12fe0a8565316f Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 14 Jun 2018 18:36:21 +0200 Subject: [PATCH 09/10] - Removed navigation left menu entry for page system/infocenter/InfoCenter/showDetails from navigation config - Changed URI of path from system/infocenter/InfoCenter/infocenterFreigegeben to system/infocenter/InfoCenter/freigegeben in navigation config - Moved the logic from Navigation controller to NavigationLib - Added private method _loadNavigationLib to Navigation controller to load the NavigationLib with parameters - Navigation controller now extends FHC_Controller - Added NavigationLib to collect all the logic used by the NavigationWidget components - Remove the handle of the fhc_controller_id from the NavigationWidget.js - NavigationWidget.js now uses better tools that came from the AjaxLib - Adapted InfoCenter controller to work with the new tools from NavigationWidget - infocenterPersonDataset.js->refreshSideMenu now uses the parameter navigation_page in the ajax call - Renamed InfoCenter controller method from infocenterFreigegeben to freigegeben - Now methods index, freigegeben and showDetails generates their own left menu - showDetails generate a left menu based on the origin page (index or freigegeben) - freigegeben uses its own filters now - Added view infocenterFreigegebenData.php --- application/config/navigation.php | 12 +- application/controllers/system/Navigation.php | 180 +++------ .../system/infocenter/InfoCenter.php | 304 ++++++++++----- application/libraries/NavigationLib.php | 353 ++++++++++++++++++ .../views/system/infocenter/infocenter.php | 15 +- .../system/infocenter/infocenterData.php | 14 +- .../system/infocenter/infocenterDetails.php | 84 ++--- .../infocenter/infocenterFreigegeben.php | 228 +---------- .../infocenter/infocenterFreigegebenData.php | 223 +++++++++++ .../widgets/NavigationHeaderWidget.php | 4 +- application/widgets/NavigationMenuWidget.php | 4 +- application/widgets/NavigationWidget.php | 4 +- public/js/NavigationWidget.js | 39 +- public/js/infocenter/infocenterDetails.js | 7 +- .../js/infocenter/infocenterPersonDataset.js | 4 +- 15 files changed, 923 insertions(+), 552 deletions(-) create mode 100644 application/libraries/NavigationLib.php create mode 100644 application/views/system/infocenter/infocenterFreigegebenData.php diff --git a/application/config/navigation.php b/application/config/navigation.php index e0bf33348..86dc3bdde 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -61,21 +61,13 @@ $config['navigation_menu']['Vilesci/index'] = array( $config['navigation_menu']['system/infocenter/InfoCenter/index'] = array( 'Freigegeben' => array( - 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/infocenterFreigegeben'), + 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/freigegeben'), 'description' => 'Freigegeben', 'icon' => 'thumbs-up' ) ); -$config['navigation_menu']['system/infocenter/InfoCenter/showDetails'] = array( - 'Freigegeben' => array( - 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/infocenterFreigegeben'), - 'description' => 'Freigegeben', - 'icon' => 'thumbs-up' - ) -); - -$config['navigation_menu']['system/infocenter/InfoCenter/infocenterFreigegeben'] = array( +$config['navigation_menu']['system/infocenter/InfoCenter/freigegeben'] = array( 'Zurück' => array( 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/index'), 'description' => 'Home', diff --git a/application/controllers/system/Navigation.php b/application/controllers/system/Navigation.php index 65f311c66..d463017e7 100644 --- a/application/controllers/system/Navigation.php +++ b/application/controllers/system/Navigation.php @@ -3,178 +3,82 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); /** - * + * This controller operates between (interface) the JS (GUI) and the NavigationLib (back-end) + * Provides data to the ajax get calls about the filter + * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON */ -class Navigation extends VileSci_Controller +class Navigation extends FHC_Controller { - const SESSION_NAME = 'NAVIGATION_MENU'; + const NAVIGATION_PAGE_PARAM = 'navigation_page'; // Navigation page parameter name /** - * Constructor + * Loads the NavigationLib where the used logic lies */ public function __construct() { - parent::__construct(); + parent::__construct(); // parents constructor - $this->config->load('navigation'); - - // Load session library - $this->load->library('session'); - $this->load->library('ExtensionsLib'); + $this->_loadNavigationLib(); // Loads the NavigationLib with parameters } + //------------------------------------------------------------------------------------------------------------------ + // Public methods + /** * This function creates the left Menu for each Page - * @param navigation_widget_called GET Parameter witch holds the currently called Page + * @param NAVIGATION_PAGE_PARAM GET Parameter witch holds the currently called Page * @return JSON object with the Menu Entries */ public function menu() { - $navigation_widget_called = $this->input->get('navigation_widget_called'); - $json = array(); + $menuArray = $this->navigationlib->getMenuArray($this->input->get(self::NAVIGATION_PAGE_PARAM)); - if (isset($navigation_widget_called)) - { - // Get Menu Entries of the Core - $navigationMenuArray = $this->config->item('navigation_menu'); - $json = $this->wildcardsearch($navigationMenuArray, $navigation_widget_called); - - // Load Menu Entries of Extensions - $extensions = $this->extensionslib->getInstalledExtensions(); - if(hasData($extensions)) - { - $json_extension = array(); - foreach($extensions->retval as $ext) - { - $filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/navigation.php'; - if (file_exists($filename)) - { - unset($config); - include($filename); - if(isset($config['navigation_menu']) && is_array($config['navigation_menu'])) - { - $json_extension = array_merge_recursive($json_extension, $this->wildcardsearch($config['navigation_menu'], $navigation_widget_called)); - } - } - } - // Merge Extension Menuentries with the Core Entries - $json = array_merge_recursive($json, $json_extension); - } - - // Load dynamic Menu Entries from Session - if (isset($_SESSION['navigation_menu'])) - { - $navigationMenuSessionArray = $_SESSION['navigation_menu']; - - if (isset($navigationMenuSessionArray) && is_array($navigationMenuSessionArray)) - { - if (isset($navigationMenuSessionArray[$navigation_widget_called])) - { - $json = array_merge_recursive($json, $navigationMenuSessionArray[$navigation_widget_called]); - } - } - } - } - - $this->output->set_content_type('application/json')->set_output(json_encode($json)); + $this->outputJsonSuccess($menuArray); } /** * This function creates the Top Menu for each Page - * @param navigation_widget_called GET Parameter witch holds the currently called Page + * @param NAVIGATION_PAGE_PARAM GET Parameter witch holds the currently called Page * @return JSON object with the Menu Entries */ public function header() { - $navigation_widget_called = $this->input->get('navigation_widget_called'); - $json = array(); + $headerArray = $this->navigationlib->getHeaderArray($this->input->get(self::NAVIGATION_PAGE_PARAM)); - if (isset($navigation_widget_called)) - { - // Load Header Entries of Core - $navigationHeaderArray = $this->config->item('navigation_header'); - $json = $this->wildcardsearch($navigationHeaderArray, $navigation_widget_called); - - // Load Header Entries of Extensions - $extensions = $this->extensionslib->getInstalledExtensions(); - if(hasData($extensions)) - { - $json_extension = array(); - foreach($extensions->retval as $ext) - { - $filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/navigation.php'; - if (file_exists($filename)) - { - unset($config); - include($filename); - if(isset($config['navigation_header']) && is_array($config['navigation_header'])) - { - $json_extension = array_merge_recursive($json_extension, $this->wildcardsearch($config['navigation_header'], $navigation_widget_called)); - } - } - } - $json = array_merge_recursive($json, $json_extension); - } - - // Load dynamic Header Entries from Session - if (isset($_SESSION['navigation_header'])) - { - $navigationHeaderSessionArray = $_SESSION['navigation_header']; - - if (isset($navigationHeaderSessionArray) && is_array($navigationHeaderSessionArray)) - { - if (isset($navigationHeaderSessionArray[$navigation_widget_called])) - { - $jsontmp = $this->wildcardsearch($navigationHeaderSessionArray, $navigation_widget_called); - $json = array_merge_recursive($json, $jsontmp); - } - } - } - } - - $this->output->set_content_type('application/json')->set_output(json_encode($json)); + $this->outputJsonSuccess($headerArray); } + //------------------------------------------------------------------------------------------------------------------ + // Private methods + /** - * Searches a Menuentry. If there is no exact entry it searches for Wildcard Entries with a Star - * Example: - * Searching for /system/foo/index will Match the following Menuentries: - * /system/foo/index - * /system/foo/* - * /system/* - * * - * - * @param $navigationArray Array to Search in. - * @param $navigation_widget_called Navigation to search for. - * @return Navigation Array if found, empty array otherwise + * Loads the FiltersLib with the NAVIGATION_PAGE_PARAM parameter + * If the parameter NAVIGATION_PAGE_PARAM is not given then the execution of the controller is terminated and + * an error message is printed */ - private function wildcardsearch($navigationArray, $navigation_widget_called) + private function _loadNavigationLib() { - // Sort Navigation to have them in correct order - krsort($navigationArray); - - // 100% match found - if(isset($navigationArray[$navigation_widget_called])) + // If the parameter NAVIGATION_PAGE_PARAM is present in the HTTP GET or POST + if (isset($_GET[self::NAVIGATION_PAGE_PARAM]) || isset($_POST[self::NAVIGATION_PAGE_PARAM])) { - return $navigationArray[$navigation_widget_called]; - } - else - { - foreach($navigationArray as $key=>$row) + // If it is present in the HTTP GET + if (isset($_GET[self::NAVIGATION_PAGE_PARAM])) { - // Search for * Entries - if(mb_strpos($key, '*') === 0 || mb_strpos($key, '*') === mb_strlen($key) - 1) - { - // Take * Entry if Matches - $search = mb_substr($key, 0, -1); - if($search == '' || mb_strpos($navigation_widget_called, $search) === 0) - { - return $row; - } - } + $navigationPage = $this->input->get(self::NAVIGATION_PAGE_PARAM); // is retrived from the HTTP GET + } + elseif (isset($_POST[self::NAVIGATION_PAGE_PARAM])) // Else if it is present in the HTTP POST + { + $navigationPage = $this->input->post(self::NAVIGATION_PAGE_PARAM); // is retrived from the HTTP POST } - } - return array(); + // Loads the FiltersLib that contains all the used logic + $this->load->library('NavigationLib', array(self::NAVIGATION_PAGE_PARAM => $navigationPage)); + } + else // Otherwise an error will be written in the output + { + // NOTE: Used echo to speed up the output before the exit otherwise it's not shown + echo 'Parameter "'.self::NAVIGATION_PAGE_PARAM.'" not provided!'; + exit; + } } } diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index ed1f1d37d..285208e51 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -3,7 +3,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); /** - * Also shows infocenter-related data for a person and its prestudents, enables document and zgv checks, + * Shows infocenter-related data for a person and its prestudents, enables document and zgv checks, * displays and saves Notizen for a person, logs infocenter-related actions for a person */ class InfoCenter extends FHC_Controller @@ -11,10 +11,10 @@ class InfoCenter extends FHC_Controller // App and Verarbeitungstaetigkeit name for logging const APP = 'infocenter'; const TAETIGKEIT = 'bewerbung'; - const FILTER_ID = 'filter_id'; - // URL prefix for this controller - const URL_PREFIX = '/system/infocenter/InfoCenter'; + const URL_PREFIX = '/system/infocenter/InfoCenter'; // URL prefix for this controller + + private $_uid; // contains the UID of the logged user // Used to log with PersonLogLib private $logparams = array( @@ -53,7 +53,6 @@ class InfoCenter extends FHC_Controller 'success' => null ) ); - private $uid; // contains the UID of the logged user /** * Constructor @@ -74,7 +73,6 @@ class InfoCenter extends FHC_Controller $this->load->model('system/personLock_model', 'PersonLockModel'); // Loads libraries - $this->load->library('DmsLib'); $this->load->library('PersonLogLib'); $this->load->library('WidgetLib'); @@ -96,10 +94,6 @@ class InfoCenter extends FHC_Controller show_error('You have no Permission! You need Infocenter Role'); $this->setControllerId(); // sets the controller id - - $this->fhc_controller_id = $this->getControllerId(); - - $this->setNavigationMenuArray(); // sets property navigationMenuArray } // ----------------------------------------------------------------------------------------------------------------- @@ -110,20 +104,28 @@ class InfoCenter extends FHC_Controller */ public function index() { - $this->load->view('system/infocenter/infocenter.php', array('fhc_controller_id' => $this->fhc_controller_id)); + $this->setNavigationMenuIndex(); // define the navigation menu for this page + + $this->load->view('system/infocenter/infocenter.php'); } - public function infocenterFreigegeben() + public function freigegeben() { - $this->load->view('system/infocenter/infocenterFreigegeben.php', array('fhc_controller_id' => $this->fhc_controller_id)); + $this->setNavigationMenuFreigegeben(); // define the navigation menu for this page + + $this->load->view('system/infocenter/infocenterFreigegeben.php'); } /** * Initialization function, gets person and prestudent data and loads the view with the data * @param $person_id */ - public function showDetails($person_id) + public function showDetails() { + $this->setNavigationMenuShowDetails(); + + $person_id = $this->input->get('person_id'); + if (!is_numeric($person_id)) show_error('person id is not numeric!'); @@ -135,13 +137,11 @@ class InfoCenter extends FHC_Controller if (empty($personexists->retval)) show_error('person does not exist!'); - $show_lock_link_get = $this->input->get('show_lock_link'); - $show_lock_link = !isset($show_lock_link_get) || $show_lock_link_get === '1'; - - if ($show_lock_link) + $origin_page = $this->input->get('origin_page'); + if ($origin_page == 'index') { - //mark person as locked for editing - $result = $this->PersonLockModel->lockPerson($person_id, $this->uid, self::APP); + // mark person as locked for editing + $result = $this->PersonLockModel->lockPerson($person_id, $this->_uid, self::APP); if (isError($result)) show_error($result->retval); @@ -152,11 +152,11 @@ class InfoCenter extends FHC_Controller $data = array_merge( $persondata, - $prestudentdata, - array('show_lock_link' => $show_lock_link) + $prestudentdata ); - $data['fhc_controller_id'] = $this->fhc_controller_id; + $data['fhc_controller_id'] = $this->getControllerId(); + $data['origin_page'] = $origin_page; $this->load->view('system/infocenter/infocenterDetails.php', $data); } @@ -172,7 +172,7 @@ class InfoCenter extends FHC_Controller if (isError($result)) show_error($result->retval); - redirect(self::URL_PREFIX.'?fhc_controller_id='.$this->fhc_controller_id); + redirect(self::URL_PREFIX.'?fhc_controller_id='.$this->getControllerId()); } /** @@ -318,7 +318,6 @@ class InfoCenter extends FHC_Controller public function saveAbsage($prestudent_id) { $statusgrund = $this->input->post('statusgrund'); - $this->fhc_controller_id = $this->input->post('fhc_controller_id'); $lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id); @@ -340,7 +339,7 @@ class InfoCenter extends FHC_Controller 'studienplan_id' => $lastStatus->retval[0]->studienplan_id, 'status_kurzbz' => 'Abgewiesener', 'statusgrund_id' => $statusgrund, - 'insertvon' => $this->uid, + 'insertvon' => $this->_uid, 'insertamum' => date('Y-m-d H:i:s') ) ); @@ -396,9 +395,9 @@ class InfoCenter extends FHC_Controller 'ausbildungssemester' => $lastStatus->ausbildungssemester ), array( - 'bestaetigtvon' => $this->uid, + 'bestaetigtvon' => $this->_uid, 'bestaetigtam' => date('Y-m-d'), - 'updatevon' => $this->uid, + 'updatevon' => $this->_uid, 'updateamum' => date('Y-m-d H:i:s') ) ); @@ -454,7 +453,7 @@ class InfoCenter extends FHC_Controller $text = $this->input->post('notiz'); $erledigt = false; - $result = $this->NotizModel->addNotizForPerson($person_id, $titel, $text, $erledigt, $this->uid); + $result = $this->NotizModel->addNotizForPerson($person_id, $titel, $text, $erledigt, $this->_uid); if (isSuccess($result)) { @@ -482,9 +481,9 @@ class InfoCenter extends FHC_Controller array( 'titel' => $titel, 'text' => $text, - 'verfasser_uid' => $this->uid, + 'verfasser_uid' => $this->_uid, "updateamum" => 'NOW()', - "updatevon" => $this->uid + "updatevon" => $this->_uid ) ); @@ -531,6 +530,8 @@ class InfoCenter extends FHC_Controller */ public function outputAkteContent($akte_id) { + $this->load->library('DmsLib'); + $akte = $this->AkteModel->load($akte_id); if (isError($akte)) @@ -574,7 +575,7 @@ class InfoCenter extends FHC_Controller $person_id = $this->input->post('person_id'); $date = $this->input->post('parkdate'); - $result = $this->personloglib->park($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->uid); + $result = $this->personloglib->park($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->_uid); $this->output ->set_content_type('application/json') @@ -624,18 +625,21 @@ class InfoCenter extends FHC_Controller */ private function _setAuthUID() { - $this->uid = getAuthUID(); + $this->_uid = getAuthUID(); - if (!$this->uid) show_error('User authentification failed'); + if (!$this->_uid) show_error('User authentification failed'); } /** - * + * Define the navigation menu for the index page */ - public function setNavigationMenuArray() + public function setNavigationMenuIndex() { + $this->load->library('NavigationLib', array('navigation_page' => 'system/infocenter/InfoCenter/index')); + $listFiltersSent = array(); $listFiltersNotSent = array(); + $listCustomFilters = array(); $filtersSent = $this->FiltersModel->getFilterList('infocenter', 'PersonActions', '%InfoCenterSentApplication%'); if (hasData($filtersSent)) @@ -659,7 +663,7 @@ class InfoCenter extends FHC_Controller } } - $customFilters = $this->FiltersModel->getCustomFiltersList('infocenter', 'PersonActions', $this->uid); + $customFilters = $this->FiltersModel->getCustomFiltersList('infocenter', 'PersonActions', $this->_uid); if (hasData($customFilters)) { for ($filtersCounter = 0; $filtersCounter < count($customFilters->retval); $filtersCounter++) @@ -670,58 +674,139 @@ class InfoCenter extends FHC_Controller } } - $filtersarray = array( - 'abgeschickt' => array( - 'link' => '#', - 'description' => ucfirst($this->p->t('global', 'abgeschickt')), - 'expand' => true, - 'children' => array() - ), - 'nichtabgeschickt' => array( - 'link' => '#', - 'description' => ucfirst($this->p->t('global', 'nichtAbgeschickt')), - 'expand' => true, - 'children' => array() - ) + $filtersArray = array(); + + $filtersArray['abgeschickt'] = $this->navigationlib->oneLevel( + ucfirst($this->p->t('global', 'abgeschickt')), // description + '#', // link + array(), // children + '', // icon + true // expand ); - $this->_fillFilters($listFiltersSent, $filtersarray['abgeschickt']); - $this->_fillFilters($listFiltersNotSent, $filtersarray['nichtabgeschickt']); + $filtersArray['nichtabgeschickt'] = $this->navigationlib->oneLevel( + ucfirst($this->p->t('global', 'nichtAbgeschickt')), // description + '#', // link + array(), // children + '', // icon + true // expand + ); - if (isset($listCustomFilters) && is_array($listCustomFilters) && count($listCustomFilters) > 0) + $this->_fillFilters($listFiltersSent, $filtersArray['abgeschickt']); + $this->_fillFilters($listFiltersNotSent, $filtersArray['nichtabgeschickt']); + + if (count($listCustomFilters) > 0) { - $filtersarray['personal'] = array( - 'link' => '#', - 'description' => 'Personal filters', - 'expand' => true, - 'children' => array() + $filtersArray['personal'] = $this->navigationlib->oneLevel( + 'Personal filters', // description + '#', // link + array(), // children + '', // icon + true // expand ); - $this->_fillCustomFilters($listCustomFilters, $filtersarray['personal']); + $this->_fillCustomFilters($listCustomFilters, $filtersArray['personal']); } - if (!isset($_SESSION['navigation_menu'])) - { - $_SESSION['navigation_menu'] = array(); - } - - $_SESSION['navigation_menu']['system/infocenter/InfoCenter/index'] = array( - 'filters' => array( - 'link' => '#', - 'description' => 'Filter', - 'icon' => 'filter', - 'expand' => true, - 'children' => $filtersarray + $this->navigationlib->setSessionMenu( + array( + 'filters' => $this->navigationlib->oneLevel( + 'Filter', // description + '#', // link + $filtersArray, // children + '', // icon + true // expand + ) ) ); + } - $_SESSION['navigation_menu']['system/infocenter/InfoCenter/showDetails'] = array( - 'filters' => array( - 'link' => '#', - 'description' => 'Filter', - 'icon' => 'filter', - 'expand' => true, - 'children' => $filtersarray + /** + * Define the navigation menu for the showDetails page + */ + public function setNavigationMenuShowDetails() + { + $this->load->library('NavigationLib', array('navigation_page' => 'system/infocenter/InfoCenter/showDetails')); + + $origin_page = $this->input->get('origin_page'); + + $link = base_url('index.ci.php/system/infocenter/InfoCenter/index'); + if ($origin_page == 'freigegeben') + { + $link = base_url('index.ci.php/system/infocenter/InfoCenter/freigegeben'); + } + + $this->navigationlib->setSessionMenu( + array( + 'back' => $this->navigationlib->oneLevel( + '<< Züruck', // description + $link, // link + array(), // children + '', // icon + true // expand + ) + ) + ); + } + + /** + * Define the navigation menu for the freigegeben page + */ + public function setNavigationMenuFreigegeben() + { + $this->load->library('NavigationLib', array('navigation_page' => 'system/infocenter/InfoCenter/freigegeben')); + + $listFilters = array(); + $listCustomFilters = array(); + + $filters = $this->FiltersModel->getFilterList('infocenter', 'PersonActions', '%InfoCenterFreigegeben%'); + if (hasData($filters)) + { + for ($filtersCounter = 0; $filtersCounter < count($filters->retval); $filtersCounter++) + { + $filter = $filters->retval[$filtersCounter]; + + $listFilters[$filter->filter_id] = $filter->description[0]; + } + } + + $customFilters = $this->FiltersModel->getCustomFiltersList('infocenter', 'PersonActions', $this->_uid); + if (hasData($customFilters)) + { + for ($filtersCounter = 0; $filtersCounter < count($customFilters->retval); $filtersCounter++) + { + $filter = $customFilters->retval[$filtersCounter]; + + $listCustomFilters[$filter->filter_id] = $filter->description[0]; + } + } + + $filtersArray = array(); + + $this->_fillFiltersFreigegeben($listFilters, $filtersArray); + + if (count($listCustomFilters) > 0) + { + $filtersArray['children']['personal'] = $this->navigationlib->oneLevel( + 'Personal filters', // description + '#', // link + array(), // children + '', // icon + true // expand + ); + + $this->_fillCustomFilters($listCustomFilters, $filtersArray['children']['personal']); + } + + $this->navigationlib->setSessionMenu( + array( + 'filters' => $this->navigationlib->oneLevel( + 'Filter', // description + '#', // link + $filtersArray['children'], // children + '', // icon + true // expand + ) ) ); } @@ -731,21 +816,51 @@ class InfoCenter extends FHC_Controller */ public function setNavigationMenuArrayJson() { - $this->setNavigationMenuArray(); + $navigation_page = $this->input->get('navigation_page'); - $this->output - ->set_content_type('application/json') - ->set_output(json_encode(success('success'))); + if (strpos($navigation_page, 'index') !== false) + { + $this->setNavigationMenuIndex(); + } + else + { + $this->setNavigationMenuFreigegeben(); + } + + $this->outputJsonSuccess('success'); } private function _fillFilters($filters, &$tofill) { + $toPrint = "%s?%s=%s&%s=%s"; + foreach ($filters as $filterId => $description) { - $toPrint = "%s?%s=%s"; - $tofill['children'][] = array( - 'link' => sprintf($toPrint, site_url('system/infocenter/InfoCenter'), 'filter_id', $filterId), + 'link' => sprintf( + $toPrint, + site_url('system/infocenter/InfoCenter'), 'filter_id', $filterId, + FHC_Controller::FHC_CONTROLLER_ID, + $this->getControllerId() + ), + 'description' => $description + ); + } + } + + private function _fillFiltersFreigegeben($filters, &$tofill) + { + $toPrint = "%s?%s=%s&%s=%s"; + + foreach ($filters as $filterId => $description) + { + $tofill['children'][] = array( + 'link' => sprintf( + $toPrint, + site_url('system/infocenter/InfoCenter/freigegeben'), 'filter_id', $filterId, + FHC_Controller::FHC_CONTROLLER_ID, + $this->getControllerId() + ), 'description' => $description ); } @@ -753,12 +868,17 @@ class InfoCenter extends FHC_Controller private function _fillCustomFilters($filters, &$tofill) { + $toPrint = "%s?%s=%s&%s=%s"; + foreach ($filters as $filterId => $description) { - $toPrint = "%s?%s=%s"; - $tofill['children'][] = array( - 'link' => sprintf($toPrint, site_url('system/infocenter/InfoCenter'), 'filter_id', $filterId), + 'link' => sprintf( + $toPrint, + site_url('system/infocenter/InfoCenter'), 'filter_id', $filterId, + FHC_Controller::FHC_CONTROLLER_ID, + $this->getControllerId() + ), 'description' => $description, 'subscriptDescription' => 'Remove', 'subscriptLinkClass' => 'remove-custom-filter', @@ -789,7 +909,7 @@ class InfoCenter extends FHC_Controller if (isset($locked->retval[0]->uid)) { $lockedby = $locked->retval[0]->uid; - if ($lockedby !== $this->uid) + if ($lockedby !== $this->_uid) $lockedbyother = true; } @@ -840,7 +960,7 @@ class InfoCenter extends FHC_Controller show_error($notizen_bewerbung->retval); } - $user_person = $this->PersonModel->getByUid($this->uid); + $user_person = $this->PersonModel->getByUid($this->_uid); if (isError($user_person)) { @@ -949,7 +1069,7 @@ class InfoCenter extends FHC_Controller $this->PrestudentModel->addSelect('person_id'); $person_id = $this->PrestudentModel->load($prestudent_id)->retval[0]->person_id; - redirect(self::URL_PREFIX.'/showDetails/'.$person_id.'?fhc_controller_id='.$this->fhc_controller_id.'#'.$section); + redirect(self::URL_PREFIX.'/showDetails/'.$person_id.'?fhc_controller_id='.$this->getControllerId().'#'.$section); } /** @@ -1000,7 +1120,7 @@ class InfoCenter extends FHC_Controller self::TAETIGKEIT, self::APP, null, - $this->uid + $this->_uid ); } diff --git a/application/libraries/NavigationLib.php b/application/libraries/NavigationLib.php new file mode 100644 index 000000000..4d2187e04 --- /dev/null +++ b/application/libraries/NavigationLib.php @@ -0,0 +1,353 @@ +_ci =& get_instance(); // get code igniter instance + + // Loads navigation configs + $this->_ci->config->load('navigation'); + + // Loads helper message to manage returning messages + $this->_ci->load->helper('message'); + // Loads helper session to manage the php session + $this->_ci->load->helper('session'); + + // Loads library ExtensionsLib + $this->_ci->load->library('ExtensionsLib'); + + $this->_navigationPage = $this->_getNavigationtPage($params); // sets the id for the related navigation widget + } + + //------------------------------------------------------------------------------------------------------------------ + // Public methods + + /** + * Creates the left Menu for each Page + * @param navigation_widget_called GET Parameter witch holds the currently called Page + * @return array with the Menu Entries + */ + public function getMenuArray($navigationPage) + { + $menuArray = array(); + + if (isset($navigationPage)) + { + // Get Menu Entries of the Core + $navigationMenuArray = $this->_ci->config->item(self::CONFIG_MENU_NAME); + $menuArray = $this->_wildcardsearch($navigationMenuArray, $navigationPage); + + // Load Menu Entries of Extensions + $extensions = $this->_ci->extensionslib->getInstalledExtensions(); + if(hasData($extensions)) + { + $json_extension = array(); + foreach($extensions->retval as $ext) + { + $filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/'.self::CONFIG_NAVIGATION_FILENAME; + if (file_exists($filename)) + { + unset($config); + include($filename); + if(isset($config[self::CONFIG_MENU_NAME]) && is_array($config[self::CONFIG_MENU_NAME])) + { + $json_extension = array_merge_recursive( + $json_extension, + $this->_wildcardsearch($config[self::CONFIG_MENU_NAME], + $navigationPage) + ); + } + } + } + // Merge Extension Menuentries with the Core Entries + $menuArray = array_merge_recursive($menuArray, $json_extension); + } + + // Load dynamic Menu Entries from Session + if (($navigationMenuSessionArray = $this->getSessionMenu()) != null) + { + if (isset($navigationMenuSessionArray) && is_array($navigationMenuSessionArray)) + { + $menuArray = array_merge_recursive($menuArray, $navigationMenuSessionArray); + } + } + } + + return $menuArray; + } + + /** + * Creates the Top Menu for each Page + * @param navigation_widget_called GET Parameter witch holds the currently called Page + * @return array with the Menu Entries + */ + public function getHeaderArray($navigationPage) + { + $headerArray = array(); + + if (isset($navigationPage)) + { + // Load Header Entries of Core + $navigationHeaderArray = $this->_ci->config->item(self::CONFIG_HEADER_NAME); + $headerArray = $this->_wildcardsearch($navigationHeaderArray, $navigationPage); + + // Load Header Entries of Extensions + $extensions = $this->_ci->extensionslib->getInstalledExtensions(); + if(hasData($extensions)) + { + $headerArray_extension = array(); + foreach($extensions->retval as $ext) + { + $filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/'.self::CONFIG_NAVIGATION_FILENAME; + if (file_exists($filename)) + { + unset($config); + include($filename); + if(isset($config[self::CONFIG_HEADER_NAME]) && is_array($config[self::CONFIG_HEADER_NAME])) + { + $headerArray_extension = array_merge_recursive( + $json_extension, + $this->_wildcardsearch($config[self::CONFIG_HEADER_NAME], + $navigationPage) + ); + } + } + } + $headerArray = array_merge_recursive($headerArray, $headerArray_extension); + } + + // Load dynamic Header Entries from Session + if (($navigationHeaderSessionArray = $this->getSessionHeader()) != null) + { + if (isset($navigationHeaderSessionArray) && is_array($navigationHeaderSessionArray)) + { + $headerArray = array_merge_recursive($headerArray, $navigationHeaderSessionArray); + } + } + } + + return $headerArray; + } + + /** + * Returns the structure for one level of the menu + */ + public function oneLevel( + $description, $link = '#', $children = null, $icon = '', $expand = false, + $subscriptDescription = null, $subscriptLinkClass = null, $subscriptLinkValue = null) + { + return array( + 'description' => $description, + 'link' => $link, + 'children'=> $children, + 'icon' => $icon, + 'expand' => $expand, + 'subscriptDescription' => $subscriptDescription, + 'subscriptLinkClass' => $subscriptLinkClass, + 'subscriptLinkValue' => $subscriptLinkValue + ); + } + + /** + * Wrapper method to the session helper funtions to retrive the whole session for this navigation widget + */ + public function getSessionMenu() + { + $session = getElementSession(self::SESSION_NAME, self::SESSION_MENU_NAME); + + if (isset($session[$this->_navigationPage])) + { + return $session[$this->_navigationPage]; + } + + return null; + } + + /** + * Wrapper method to the session helper funtions to retrive the whole session for this navigation widget + */ + public function getSessionHeader() + { + $session = getElementSession(self::SESSION_NAME, self::SESSION_HEADER_NAME); + + if (isset($session[$this->_navigationPage])) + { + return $session[$this->_navigationPage]; + } + + return null; + } + + /** + * Wrapper method to the session helper funtions to retrive one element from the session of this navigation widget + */ + public function getElementSessionMenu($name) + { + $session = $this->getSessionMenu(); + + if (isset($session[$name])) + { + return $session[$name]; + } + + return null; + } + + /** + * Wrapper method to the session helper funtions to retrive one element from the session of this navigation widget + */ + public function getElementSessionHeader($name) + { + $session = $this->getSessionHeader(); + + if (isset($session[$name])) + { + return $session[$name]; + } + + return null; + } + + /** + * Wrapper method to the session helper funtions to set the whole session for this navigation widget + */ + public function setSessionMenu($data) + { + setElementSession(self::SESSION_NAME, self::SESSION_MENU_NAME, array($this->_navigationPage => $data)); + } + + /** + * Wrapper method to the session helper funtions to set the whole session for this navigation widget + */ + public function setSessionHeader($data) + { + setElementSession(self::SESSION_NAME, self::SESSION_HEADER_NAME, array($this->_navigationPage => $data)); + } + + /** + * Wrapper method to the session helper funtions to set one element in the session for this navigation widget + */ + public function setElementSessionMenu($name, $value) + { + $session = $this->getSessionMenu(); + + if (!isset($session[$this->_navigationPage])) + { + $session[$this->_navigationPage] = array(); + } + + $session[$this->_navigationPage][$name] = $value; + + setElementSession(self::SESSION_NAME, self::SESSION_MENU_NAME, $session); // stores the single value + } + + /** + * Wrapper method to the session helper funtions to set one element in the session for this navigation widget + */ + public function setElementSessionHeader($name, $value) + { + $session = $this->getSessionHeader(); + + if (!isset($session[$this->_navigationPage])) + { + $session[$this->_navigationPage] = array(); + } + + $session[$this->_navigationPage][$name] = $value; + + setElementSession(self::SESSION_NAME, self::SESSION_HEADER_NAME, $session); // stores the single value + } + + //------------------------------------------------------------------------------------------------------------------ + // Private methods + + /** + * Searches a Menuentry. If there is no exact entry it searches for Wildcard Entries with a Star + * Example: + * Searching for /system/foo/index will Match the following Menuentries: + * /system/foo/index + * /system/foo/* + * /system/* + * * + * + * @param $navigationArray Array to Search in. + * @param $navigationPage Navigation to search for. + * @return Navigation Array if found, empty array otherwise + */ + private function _wildcardsearch($navigationArray, $navigationPage) + { + // Sort Navigation to have them in correct order + krsort($navigationArray); + + // 100% match found + if(isset($navigationArray[$navigationPage])) + { + return $navigationArray[$navigationPage]; + } + else + { + foreach($navigationArray as $key=>$row) + { + // Search for * Entries + if(mb_strpos($key, '*') === 0 || mb_strpos($key, '*') === mb_strlen($key) - 1) + { + // Take * Entry if Matches + $search = mb_substr($key, 0, -1); + if($search == '' || mb_strpos($navigationPage, $search) === 0) + { + return $row; + } + } + } + } + + return array(); + } + + /** + * Return an unique string that identify this navigation widget + * NOTE: The default value is the URI where the NavigationWidget is called + */ + private function _getNavigationtPage($params) + { + // + if ($params != null + && is_array($params) + && isset($params[self::NAVIGATION_PAGE_PARAM]) + && !empty(trim($params[self::NAVIGATION_PAGE_PARAM]))) + { + $navigationPage = $params[self::NAVIGATION_PAGE_PARAM]; + } + else + { + // Gets the current page URI + $navigationPage = $this->_ci->router->directory.$this->_ci->router->class.'/'.$this->_ci->router->method; + } + + return $navigationPage; + } +} diff --git a/application/views/system/infocenter/infocenter.php b/application/views/system/infocenter/infocenter.php index 80534c800..f92658fc7 100644 --- a/application/views/system/infocenter/infocenter.php +++ b/application/views/system/infocenter/infocenter.php @@ -5,18 +5,18 @@ 'title' => 'Info Center', 'jquery' => true, 'jqueryui' => true, - 'ajaxlib' => true, 'bootstrap' => true, 'fontawesome' => true, 'sbadmintemplate' => true, 'tablesorter' => true, + 'ajaxlib' => true, 'filterwidget' => true, + 'navigationwidget' => true, 'phrases' => array( 'person' => array('vorname', 'nachname'), 'global' => array('mailAnXversandt'), 'ui' => array('bitteEintragWaehlen') ), - 'navigationwidget' => true, 'customCSSs' => 'public/css/sbadmin2/tablesort_bootstrap.css', 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js') ) @@ -32,18 +32,13 @@
    -
    - load->view( - 'system/infocenter/infocenterData.php', - array('fhc_controller_id' => $fhc_controller_id) - ); - ?> + load->view('system/infocenter/infocenterData.php'); ?>
    diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index 3f1dc5182..83d7faca6 100755 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -2,6 +2,7 @@ $APP = 'infocenter'; $NOTBEFORE = '2018-03-01 18:00:00'; + $filterWidgetArray = array( 'query' => ' SELECT @@ -217,10 +218,11 @@ 'formatRow' => function($datasetRaw) { $datasetRaw->{'Details'} = sprintf( - 'Details', + 'Details', site_url('system/infocenter/InfoCenter/showDetails'), $datasetRaw->{'PersonId'}, - (isset($_GET['fhc_controller_id'])?$_GET['fhc_controller_id']:'') + $this->router->method, + $this->input->get('fhc_controller_id') ); if ($datasetRaw->{'SendDate'} == null) @@ -265,14 +267,17 @@ { $datasetRaw->{'StgAbgeschickt'} = '-'; } + if ($datasetRaw->{'StgNichtAbgeschickt'} == null) { $datasetRaw->{'StgNichtAbgeschickt'} = '-'; } + if ($datasetRaw->{'StgAktiv'} == null) { $datasetRaw->{'StgAktiv'} = '-'; } + if ($datasetRaw->{'Nation'} == null) { $datasetRaw->{'Nation'} = '-'; @@ -289,9 +294,9 @@ $mark = FilterWidget::DEFAULT_MARK_ROW_CLASS; } + // Parking has priority over locking if ($datasetRaw->ParkDate != null) { - // Parking has priority over locking $mark = "text-info"; } @@ -299,9 +304,10 @@ } ); - $filterWidgetArray[InfoCenter::FILTER_ID] = $this->input->get(InfoCenter::FILTER_ID); $filterWidgetArray['app'] = $APP; $filterWidgetArray['datasetName'] = 'PersonActions'; + $filterWidgetArray['filterKurzbz'] = 'InfoCenterSentApplicationAll'; + $filterWidgetArray['filter_id'] = $this->input->get('filter_id'); echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray); ?> diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index d8ccd10be..feed2f547 100755 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -13,41 +13,35 @@ 'sbadmintemplate' => true, 'addons' => true, 'navigationwidget' => true, - 'customCSSs' => - array( - 'public/css/sbadmin2/admintemplate.css', - 'public/css/sbadmin2/tablesort_bootstrap.css' + 'customCSSs' => array( + 'public/css/sbadmin2/admintemplate.css', + 'public/css/sbadmin2/tablesort_bootstrap.css' + ), + 'customJSs' => array( + 'public/js/bootstrapper.js', + 'public/js/tablesort/tablesort.js', + 'public/js/infocenter/infocenterDetails.js' + ), + 'phrases' => array( + 'infocenter' => array( + 'notizHinzufuegen', + 'notizAendern', + 'bewerberParken', + 'bewerberAusparken', + 'nichtsZumAusparken', + 'fehlerBeimAusparken', + 'fehlerBeimParken', + 'bewerberGeparktBis' ), - 'customJSs' => - array( - 'public/js/bootstrapper.js', - 'public/js/tablesort/tablesort.js', - 'public/js/infocenter/infocenterDetails.js' + 'ui' => array( + 'gespeichert', + 'fehlerBeimSpeichern' ), - 'phrases' => - array( - 'infocenter' => - array( - 'notizHinzufuegen', - 'notizAendern', - 'bewerberParken', - 'bewerberAusparken', - 'nichtsZumAusparken', - 'fehlerBeimAusparken', - 'fehlerBeimParken', - 'bewerberGeparktBis' - ), - 'ui' => - array( - 'gespeichert', - 'fehlerBeimSpeichern' - ), - 'global' => - array( - 'bis', - 'zeilen' - ) + 'global' => array( + 'bis', + 'zeilen' ) + ) ) ); ?> @@ -69,12 +63,12 @@
    p->t('global', 'wirdBearbeitetVon') . ': '; + echo $this->p->t('global', 'wirdBearbeitetVon').': '; echo $lockedby; - if (!isset($show_lock_link) || $show_lock_link === true): ?> + if ($origin_page == 'index'): ?>    - -  p->t('ui', 'freigeben')) ?> + +  p->t('ui', 'freigeben')) ?> @@ -103,7 +97,9 @@
    -

    p->t('infocenter', 'dokumentenpruefung')) ?>

    +

    + p->t('infocenter', 'dokumentenpruefung')) ?> +

    load->view('system/infocenter/dokpruefung.php'); ?> @@ -118,8 +114,9 @@
    -

    p->t('infocenter', 'zgv'). ' - '. - ucfirst($this->p->t('lehre', 'pruefung'))?>

    +

    + p->t('infocenter', 'zgv').' - '.ucfirst($this->p->t('lehre', 'pruefung'))?> +

    load->view('system/infocenter/zgvpruefungen.php'); ?> @@ -134,7 +131,9 @@
    -

    p->t('global', 'nachrichten')) ?>

    +

    + p->t('global', 'nachrichten')) ?> +

    @@ -153,8 +152,9 @@
    -

    p->t('global', 'notizen')). ' & '. - ucfirst($this->p->t('global', 'aktivitaeten')) ?>

    +

    + p->t('global', 'notizen')).' & '.ucfirst($this->p->t('global', 'aktivitaeten')) ?> +

    diff --git a/application/views/system/infocenter/infocenterFreigegeben.php b/application/views/system/infocenter/infocenterFreigegeben.php index bf3b34d65..eee68d69d 100755 --- a/application/views/system/infocenter/infocenterFreigegeben.php +++ b/application/views/system/infocenter/infocenterFreigegeben.php @@ -12,6 +12,11 @@ 'ajaxlib' => true, 'filterwidget' => true, 'navigationwidget' => true, + 'phrases' => array( + 'person' => array('vorname', 'nachname'), + 'global' => array('mailAnXversandt'), + 'ui' => array('bitteEintragWaehlen') + ), 'customCSSs' => 'public/css/sbadmin2/tablesort_bootstrap.css', 'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js') ) @@ -27,228 +32,13 @@
    - +
    - ' - SELECT - p.person_id AS "PersonId", - p.vorname AS "Vorname", - p.nachname AS "Nachname", - p.gebdatum AS "Gebdatum", - p.staatsbuergerschaft AS "Nation", - ( - SELECT zeitpunkt - FROM system.tbl_log - WHERE taetigkeit_kurzbz IN(\'bewerbung\',\'kommunikation\') - AND logdata->>\'name\' NOT IN (\'Login with code\', \'New application\') - AND person_id = p.person_id - ORDER BY zeitpunkt DESC - LIMIT 1 - ) AS "LastAction", - ( - SELECT insertvon - FROM system.tbl_log - WHERE taetigkeit_kurzbz IN(\'bewerbung\',\'kommunikation\') - AND logdata->>\'name\' NOT IN (\'Login with code\', \'New application\') - AND person_id = p.person_id - ORDER BY zeitpunkt DESC - LIMIT 1 - ) AS "User/Operator", - ( - SELECT - pss.studiensemester_kurzbz - FROM - public.tbl_prestudentstatus pss - INNER JOIN public.tbl_prestudent ps USING(prestudent_id) - JOIN public.tbl_studiengang USING(studiengang_kz) - WHERE pss.status_kurzbz = \'Interessent\' - AND ps.person_id = p.person_id - AND tbl_studiengang.typ in(\'b\') - AND studiensemester_kurzbz IN ( - SELECT studiensemester_kurzbz - FROM public.tbl_studiensemester - WHERE ende >= NOW() - ) - ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC - LIMIT 1 - ) AS "Studiensemester", - ( - SELECT pss.bewerbung_abgeschicktamum - FROM - public.tbl_prestudentstatus pss - INNER JOIN public.tbl_prestudent ps USING(prestudent_id) - JOIN public.tbl_studiengang USING(studiengang_kz) - WHERE pss.status_kurzbz = \'Interessent\' - AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\') - AND ps.person_id = p.person_id - AND tbl_studiengang.typ in(\'b\') - AND studiensemester_kurzbz IN ( - SELECT studiensemester_kurzbz - FROM public.tbl_studiensemester - WHERE ende >= NOW() - ) - ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC - LIMIT 1 - ) AS "SendDate", - ( - SELECT count(*) - FROM - public.tbl_prestudentstatus pss - INNER JOIN public.tbl_prestudent ps USING(prestudent_id) - JOIN public.tbl_studiengang USING(studiengang_kz) - WHERE pss.status_kurzbz = \'Interessent\' - AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\') - AND ps.person_id = p.person_id - AND tbl_studiengang.typ in(\'b\') - AND studiensemester_kurzbz IN ( - SELECT studiensemester_kurzbz - FROM public.tbl_studiensemester - WHERE ende >= NOW() - ) - LIMIT 1 - ) AS "AnzahlAbgeschickt", - array_to_string( - ( - SELECT array_agg(distinct UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz)) - FROM - public.tbl_prestudentstatus pss - INNER JOIN public.tbl_prestudent ps USING(prestudent_id) - JOIN public.tbl_studiengang USING(studiengang_kz) - WHERE pss.status_kurzbz = \'Interessent\' - AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\') - AND ps.person_id = p.person_id - AND tbl_studiengang.typ in(\'b\') - AND studiensemester_kurzbz IN ( - SELECT studiensemester_kurzbz - FROM public.tbl_studiensemester - WHERE ende >= NOW() - ) - LIMIT 1 - ),\', \' - ) AS "StgAbgeschickt", - pl.zeitpunkt AS "LockDate", - pl.lockuser as "LockUser" - FROM public.tbl_person p - LEFT JOIN (SELECT person_id, zeitpunkt, uid as lockuser FROM system.tbl_person_lock WHERE app = \''.$APP.'\') pl USING(person_id) - WHERE - EXISTS( - SELECT 1 - FROM - public.tbl_prestudent - JOIN public.tbl_studiengang USING(studiengang_kz) - WHERE - person_id=p.person_id - AND tbl_studiengang.typ in(\'b\') - - AND EXISTS ( - SELECT - 1 - FROM - public.tbl_prestudentstatus - WHERE - prestudent_id = tbl_prestudent.prestudent_id - AND status_kurzbz = \'Interessent\' - AND (bestaetigtam IS NOT NULL AND bewerbung_abgeschicktamum >= \''.$NOTBEFORE.'\') - AND studiensemester_kurzbz IN ( - SELECT studiensemester_kurzbz - FROM public.tbl_studiensemester - WHERE ende >= NOW() - ) - ) - ) - ORDER BY "LastAction" DESC - ', - 'checkboxes' => 'PersonId', - 'additionalColumns' => array('Details'), - 'columnsAliases' => array('PersonID','Vorname','Nachname','GebDatum','Nation','Letzte Aktion','Letzter Bearbeiter', - 'StSem','GesendetAm','NumAbgeschickt','Studiengänge','Sperrdatum','GesperrtVon'), - 'formatRow' => function($datasetRaw) { - - $datasetRaw->{'Details'} = sprintf( - 'Details', - site_url('system/infocenter/InfoCenter/showDetails'), - $datasetRaw->{'PersonId'}, - (isset($_GET['fhc_controller_id'])?$_GET['fhc_controller_id']:'') - ); - - if ($datasetRaw->{'SendDate'} == null) - { - $datasetRaw->{'SendDate'} = 'Not sent'; - } - else - { - $datasetRaw->{'SendDate'} = date_format(date_create($datasetRaw->{'SendDate'}),'Y-m-d H:i'); - } - - if ($datasetRaw->{'LastAction'} == null) - { - $datasetRaw->{'LastAction'} = '-'; - } - else - { - $datasetRaw->{'LastAction'} = date_format(date_create($datasetRaw->{'LastAction'}),'Y-m-d H:i'); - } - - if ($datasetRaw->{'User/Operator'} == '') - { - $datasetRaw->{'User/Operator'} = 'NA'; - } - - if ($datasetRaw->{'LockDate'} == null) - { - $datasetRaw->{'LockDate'} = '-'; - } - - if ($datasetRaw->{'LockUser'} == null) - { - $datasetRaw->{'LockUser'} = '-'; - } - - if ($datasetRaw->{'StgAbgeschickt'} == null) - { - $datasetRaw->{'StgAbgeschickt'} = 'N/A'; - } - - if ($datasetRaw->{'Nation'} == null) - { - $datasetRaw->{'Nation'} = '-'; - } - - return $datasetRaw; - }, - 'markRow' => function($datasetRaw) { - - if ($datasetRaw->LockDate != null) - { - return FilterWidget::DEFAULT_MARK_ROW_CLASS; - } - } - ); - - - $filterId = isset($_GET[InfoCenter::FILTER_ID]) ? $_GET[InfoCenter::FILTER_ID] : null; - - if (isset($filterId) && is_numeric($filterId)) - { - $filterWidgetArray[InfoCenter::FILTER_ID] = $filterId; - } - else - { - $filterWidgetArray['app'] = $APP; - $filterWidgetArray['datasetName'] = 'PersonActions'; - $filterWidgetArray['filterKurzbz'] = 'InfoCenterNotSentApplicationAll'; - } - - echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray); - ?> - + load->view('system/infocenter/infocenterFreigegebenData.php'); ?>
    diff --git a/application/views/system/infocenter/infocenterFreigegebenData.php b/application/views/system/infocenter/infocenterFreigegebenData.php new file mode 100644 index 000000000..39faefd5e --- /dev/null +++ b/application/views/system/infocenter/infocenterFreigegebenData.php @@ -0,0 +1,223 @@ + ' + SELECT + p.person_id AS "PersonId", + p.vorname AS "Vorname", + p.nachname AS "Nachname", + p.gebdatum AS "Gebdatum", + p.staatsbuergerschaft AS "Nation", + ( + SELECT zeitpunkt + FROM system.tbl_log + WHERE taetigkeit_kurzbz IN(\'bewerbung\',\'kommunikation\') + AND logdata->>\'name\' NOT IN (\'Login with code\', \'New application\') + AND person_id = p.person_id + ORDER BY zeitpunkt DESC + LIMIT 1 + ) AS "LastAction", + ( + SELECT insertvon + FROM system.tbl_log + WHERE taetigkeit_kurzbz IN(\'bewerbung\',\'kommunikation\') + AND logdata->>\'name\' NOT IN (\'Login with code\', \'New application\') + AND person_id = p.person_id + ORDER BY zeitpunkt DESC + LIMIT 1 + ) AS "User/Operator", + ( + SELECT + pss.studiensemester_kurzbz + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE pss.status_kurzbz = \'Interessent\' + AND ps.person_id = p.person_id + AND tbl_studiengang.typ in(\'b\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC + LIMIT 1 + ) AS "Studiensemester", + ( + SELECT pss.bewerbung_abgeschicktamum + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE pss.status_kurzbz = \'Interessent\' + AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\') + AND ps.person_id = p.person_id + AND tbl_studiengang.typ in(\'b\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC + LIMIT 1 + ) AS "SendDate", + ( + SELECT count(*) + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE pss.status_kurzbz = \'Interessent\' + AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\') + AND ps.person_id = p.person_id + AND tbl_studiengang.typ in(\'b\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + LIMIT 1 + ) AS "AnzahlAbgeschickt", + array_to_string( + ( + SELECT array_agg(distinct UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz)) + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE pss.status_kurzbz = \'Interessent\' + AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\') + AND ps.person_id = p.person_id + AND tbl_studiengang.typ in(\'b\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + LIMIT 1 + ),\', \' + ) AS "StgAbgeschickt", + pl.zeitpunkt AS "LockDate", + pl.lockuser as "LockUser" + FROM public.tbl_person p + LEFT JOIN (SELECT person_id, zeitpunkt, uid as lockuser FROM system.tbl_person_lock WHERE app = \''.$APP.'\') pl USING(person_id) + WHERE + EXISTS( + SELECT 1 + FROM + public.tbl_prestudent + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE + person_id=p.person_id + AND tbl_studiengang.typ in(\'b\') + + AND EXISTS ( + SELECT + 1 + FROM + public.tbl_prestudentstatus + WHERE + prestudent_id = tbl_prestudent.prestudent_id + AND status_kurzbz = \'Interessent\' + AND (bestaetigtam IS NOT NULL AND bewerbung_abgeschicktamum >= \''.$NOTBEFORE.'\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + ) + ) + ORDER BY "LastAction" DESC + ', + 'checkboxes' => 'PersonId', + 'additionalColumns' => array('Details'), + 'columnsAliases' => array( + 'PersonID', + 'Vorname', + 'Nachname', + 'GebDatum', + 'Nation', + 'Letzte Aktion', + 'Letzter Bearbeiter', + 'StSem', + 'GesendetAm', + 'NumAbgeschickt', + 'Studiengänge', + 'Sperrdatum', + 'GesperrtVon' + ), + 'formatRow' => function($datasetRaw) { + + $datasetRaw->{'Details'} = sprintf( + 'Details', + site_url('system/infocenter/InfoCenter/showDetails'), + $datasetRaw->{'PersonId'}, + $this->router->method, + $this->input->get('fhc_controller_id') + ); + + if ($datasetRaw->{'SendDate'} == null) + { + $datasetRaw->{'SendDate'} = 'Not sent'; + } + else + { + $datasetRaw->{'SendDate'} = date_format(date_create($datasetRaw->{'SendDate'}),'Y-m-d H:i'); + } + + if ($datasetRaw->{'LastAction'} == null) + { + $datasetRaw->{'LastAction'} = '-'; + } + else + { + $datasetRaw->{'LastAction'} = date_format(date_create($datasetRaw->{'LastAction'}),'Y-m-d H:i'); + } + + if ($datasetRaw->{'User/Operator'} == '') + { + $datasetRaw->{'User/Operator'} = 'NA'; + } + + if ($datasetRaw->{'LockDate'} == null) + { + $datasetRaw->{'LockDate'} = '-'; + } + + if ($datasetRaw->{'LockUser'} == null) + { + $datasetRaw->{'LockUser'} = '-'; + } + + if ($datasetRaw->{'StgAbgeschickt'} == null) + { + $datasetRaw->{'StgAbgeschickt'} = 'N/A'; + } + + if ($datasetRaw->{'Nation'} == null) + { + $datasetRaw->{'Nation'} = '-'; + } + + return $datasetRaw; + }, + 'markRow' => function($datasetRaw) { + + if ($datasetRaw->LockDate != null) + { + return FilterWidget::DEFAULT_MARK_ROW_CLASS; + } + } + ); + + $filterWidgetArray['app'] = $APP; + $filterWidgetArray['datasetName'] = 'PersonActions'; + $filterWidgetArray['filterKurzbz'] = 'InfoCenterFreigegeben5days'; + $filterWidgetArray['filter_id'] = $this->input->get('filter_id'); + + echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray); +?> diff --git a/application/widgets/NavigationHeaderWidget.php b/application/widgets/NavigationHeaderWidget.php index 9a1b48d5a..636394886 100644 --- a/application/widgets/NavigationHeaderWidget.php +++ b/application/widgets/NavigationHeaderWidget.php @@ -1,12 +1,12 @@ ' + i + ''); }); } @@ -47,18 +47,18 @@ var FHC_NavigationWidget = { FHC_AjaxClient.ajaxCallGet( 'system/Navigation/menu', { - navigation_widget_called: FHC_NavigationWidget._getNavigationWidgetCalled() + navigation_page: FHC_NavigationWidget._getNavigationWidgetCalled() }, { successCallback: function(data, textStatus, jqXHR) { - if (data != null) + if (FHC_AjaxClient.hasData(data)) { var strMenu = ''; FHC_NavigationWidget._printCollapseIcon(); - jQuery.each(data, function(i, e) { - strMenu += FHC_NavigationWidget._printNavItem(e); + jQuery.each(FHC_AjaxClient.getData(data), function(i, e) { + if (e != null) strMenu += FHC_NavigationWidget._printNavItem(e); }); $("#side-menu").html(strMenu); @@ -104,32 +104,18 @@ var FHC_NavigationWidget = { * */ _printNavItem: function(item, depth = 1) { + strMenu = ""; var expanded = typeof item['expand'] != 'undefined' && item['expand'] === true ? ' active' : ''; strMenu += '
  • '; - if (typeof item['subscriptLinkClass'] != 'undefined' && typeof item['subscriptDescription'] != 'undefined') + if (typeof item['subscriptLinkClass'] != 'undefined' && typeof item['subscriptDescription'] != 'undefined' + && item['subscriptLinkClass'] != null && item['subscriptDescription'] != null) { strMenu += ''; } - // Handle fhc_controller_id - var fhc_controller_id = FHC_AjaxClient.getUrlParameter('fhc_controller_id'); - if (fhc_controller_id != null && fhc_controller_id != '' && item['link'] != '#') - { - if (item['link'].indexOf('?') != -1) - { - item['link'] += '&'; - } - else - { - item['link'] += '?'; - } - - item['link'] += 'fhc_controller_id=' + fhc_controller_id; - } - strMenu += ''; if (item['icon'] != 'undefined') @@ -146,7 +132,8 @@ var FHC_NavigationWidget = { strMenu += ''; - if (typeof item['subscriptLinkClass'] != 'undefined' && typeof item['subscriptDescription'] != 'undefined') + if (typeof item['subscriptLinkClass'] != 'undefined' && typeof item['subscriptDescription'] != 'undefined' + && item['subscriptLinkClass'] != null && item['subscriptDescription'] != null) { strMenu += ' (' + item['subscriptDescription'] + ')'; strMenu += ''; @@ -167,7 +154,7 @@ var FHC_NavigationWidget = { strMenu += ''; diff --git a/public/js/infocenter/infocenterDetails.js b/public/js/infocenter/infocenterDetails.js index d4efed894..64377ae1c 100644 --- a/public/js/infocenter/infocenterDetails.js +++ b/public/js/infocenter/infocenterDetails.js @@ -1,5 +1,4 @@ -var fhc_controller_id = FHC_AjaxClient.getUrlParameter('fhc_controller_id'); const CONTROLLER_URL = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/"+FHC_JS_DATA_STORAGE_OBJECT.called_path; const CALLED_PATH = FHC_JS_DATA_STORAGE_OBJECT.called_path; @@ -403,9 +402,9 @@ var InfocenterDetails = { _refreshLog: function() { var personid = $("#hiddenpersonid").val(); - $("#logs").load(CONTROLLER_URL + '/reloadLogs/' + personid + '?fhc_controller_id=' + fhc_controller_id, - function () - { + $("#logs").load( + CONTROLLER_URL + '/reloadLogs/' + personid + '?fhc_controller_id=' + FHC_AjaxClient.getUrlParameter('fhc_controller_id'), + function () { //readd tablesorter InfocenterDetails._formatLogTable() } diff --git a/public/js/infocenter/infocenterPersonDataset.js b/public/js/infocenter/infocenterPersonDataset.js index a1315ef55..1bad6590e 100644 --- a/public/js/infocenter/infocenterPersonDataset.js +++ b/public/js/infocenter/infocenterPersonDataset.js @@ -11,7 +11,9 @@ function refreshSideMenu() // FHC_AjaxClient.ajaxCallGet( 'system/infocenter/InfoCenter/setNavigationMenuArrayJson', - null, + { + navigation_page: FHC_NavigationWidget._getNavigationWidgetCalled() + }, { successCallback: function(data, textStatus, jqXHR) { FHC_NavigationWidget.renderSideMenu(); From 264ec9be9e13fa6e799933d76f442512597edd81 Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 15 Jun 2018 11:04:24 +0200 Subject: [PATCH 10/10] InfoCenter: fixed relative URLs and HTTP GET parameters --- .../controllers/system/infocenter/InfoCenter.php | 2 +- .../views/system/infocenter/dokpruefung.php | 4 ++-- .../views/system/infocenter/zgvpruefungen.php | 15 +++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 285208e51..c2994f10f 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -1069,7 +1069,7 @@ class InfoCenter extends FHC_Controller $this->PrestudentModel->addSelect('person_id'); $person_id = $this->PrestudentModel->load($prestudent_id)->retval[0]->person_id; - redirect(self::URL_PREFIX.'/showDetails/'.$person_id.'?fhc_controller_id='.$this->getControllerId().'#'.$section); + redirect(self::URL_PREFIX.'/showDetails?person_id='.$person_id.'&fhc_controller_id='.$this->getControllerId().'#'.$section); } /** diff --git a/application/views/system/infocenter/dokpruefung.php b/application/views/system/infocenter/dokpruefung.php index b7fbbd4a7..fae23c48b 100644 --- a/application/views/system/infocenter/dokpruefung.php +++ b/application/views/system/infocenter/dokpruefung.php @@ -16,7 +16,7 @@ ?> - titel) ? $dokument->bezeichnung : $dokument->titel ?> + titel) ? $dokument->bezeichnung : $dokument->titel ?> dokument_bezeichnung ?> erstelltam), 'd.m.Y') ?> @@ -64,4 +64,4 @@ - \ No newline at end of file + diff --git a/application/views/system/infocenter/zgvpruefungen.php b/application/views/system/infocenter/zgvpruefungen.php index 048253d2c..0dbf6a1f0 100644 --- a/application/views/system/infocenter/zgvpruefungen.php +++ b/application/views/system/infocenter/zgvpruefungen.php @@ -241,8 +241,7 @@
    -
    +