From e5e22931a97a72885cb63615fe540899c50a184c Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 24 Apr 2026 12:49:00 +0200 Subject: [PATCH] add db queries for update system, update tags in config --- application/config/stv.php | 4 +- ...ehtTagLib.php => CoreStbErhoehtTagLib.php} | 2 +- system/dbupdate_3.4.php | 1 + .../75959_StudVw_Automatische_Tags.php | 125 ++++++++++++++++++ 4 files changed, 128 insertions(+), 4 deletions(-) rename application/libraries/tags/{CoreStudienbeitragErhoehtTagLib.php => CoreStbErhoehtTagLib.php} (97%) create mode 100644 system/dbupdate_3.4/75959_StudVw_Automatische_Tags.php diff --git a/application/config/stv.php b/application/config/stv.php index 2b11224d5..b0db82b34 100644 --- a/application/config/stv.php +++ b/application/config/stv.php @@ -147,9 +147,7 @@ $config['stv_prestudent_tags'] = [ 'prewh_auto' => ['readonly' => true], 'out_auto' => ['readonly' => false], 'zgv_auto' => ['readonly' => true], - 'wiedereinstieg_auto' => ['readonly' => true], + 'unterbrecher_auto' => ['readonly' => true], 'stbtr_erh_auto' => ['readonly' => true], - 'beitr_befr_auto' => ['readonly' => true], 'jgv_auto' => ['readonly' => false], - 'nachteilausgl_auto' => ['readonly' => true], ]; diff --git a/application/libraries/tags/CoreStudienbeitragErhoehtTagLib.php b/application/libraries/tags/CoreStbErhoehtTagLib.php similarity index 97% rename from application/libraries/tags/CoreStudienbeitragErhoehtTagLib.php rename to application/libraries/tags/CoreStbErhoehtTagLib.php index 82dcee3b8..2c0b47d2e 100644 --- a/application/libraries/tags/CoreStudienbeitragErhoehtTagLib.php +++ b/application/libraries/tags/CoreStbErhoehtTagLib.php @@ -4,7 +4,7 @@ * * @author ma0068 */ -class CoreStudienbeitragErhoehtTagLib +class CoreStbErhoehtTagLib { protected $ci; diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 4ddb38203..5d108a90a 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -92,6 +92,7 @@ require_once('dbupdate_3.4/68744_StV_settings.php'); require_once('dbupdate_3.4/62889_reihungstest_ueberwachung_mit_constructor.php'); require_once('dbupdate_3.4/71399_dashboard_update_widget_paths.php'); require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php'); +require_once('dbupdate_3.4/75959_StudVw_Automatische_Tags.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/system/dbupdate_3.4/75959_StudVw_Automatische_Tags.php b/system/dbupdate_3.4/75959_StudVw_Automatische_Tags.php new file mode 100644 index 000000000..c75d0ce14 --- /dev/null +++ b/system/dbupdate_3.4/75959_StudVw_Automatische_Tags.php @@ -0,0 +1,125 @@ +db_query("SELECT taglib FROM public.tbl_notiz_typ LIMIT 1")) +{ + $qry = 'ALTER TABLE public.tbl_notiz_typ ADD COLUMN taglib character varying(32);'; + + if(!$db->db_query($qry)) + echo ' public.tbl_notiz_typ '.$db->db_last_error().'
'; + else + echo '
public.tbl_notiz_typ: Neue Spalte taglib hinzugefügt'; +} + +//automatic tags anlegen +$tags = [ + [ + 'typ_kurzbz' => 'wh_auto', + 'bezeichnung' => '{Wiederholer, repeater}', + 'style' => 'tag_dark_grey', + 'prioritaet' => 11, + 'taglib' => 'tags/CoreWiederholerTagLib' + ], + [ + 'typ_kurzbz' => 'dd_auto', + 'bezeichnung' => '{DoubleDegree, DoubleDegree}', + 'style' => 'tag_braun', + 'prioritaet' => 10, + 'taglib' => 'tags/CoreDoubleDegreeTagLib' + ], + [ + 'typ_kurzbz' => 'out_auto', + 'bezeichnung' => '{Outgoing, Outgoing}', + 'style' => 'tag_limette', + 'prioritaet' => 12, + 'taglib' => 'tags/CoreOutgoingTagLib' + ], + [ + 'typ_kurzbz' => 'prewh_auto', + 'bezeichnung' => '{Pre-Wiederholer, pre-repeater}', + 'style' => 'tag_light_grey', + 'prioritaet' => 13, + 'taglib' => 'tags/CorePrewiederholerTagLib' + ], + [ + 'typ_kurzbz' => 'zgv_auto', + 'bezeichnung' => '{ZGV offen, ZGV missing}', + 'style' => 'tag_lavendel', + 'prioritaet' => 14, + 'taglib' => 'tags/CoreMissingZgvTagLib' + ], + [ + 'typ_kurzbz' => 'unterbrecher_auto', + 'bezeichnung' => '{Unterbrecher, Interrupter}', + 'style' => 'tag_blau', + 'prioritaet' => 15, + 'taglib' => 'tags/CoreUnterbrecherTagLib' + ], + [ + 'typ_kurzbz' => 'stbtr_erh_auto', + 'bezeichnung' => '{erh.Studienbeitrag, Incr. Tuition Fees}', + 'style' => 'tag_pfirsich', + 'prioritaet' => 16, + 'taglib' => 'tags/CoreStbErhoehtTagLib' + ], + [ + 'typ_kurzbz' => 'jgv_auto', + 'bezeichnung' => '{JGV, Year Group Representative}', + 'style' => 'tag_gelb', + 'prioritaet' => 17, + 'taglib' => 'tags/CoreJgvTagLib' + ], + +]; + +foreach ($tags as $tag) { + + $checkQry = " + SELECT 1 + FROM public.tbl_notiz_typ + WHERE typ_kurzbz = '".$tag['typ_kurzbz']."' + "; + + if ($result = $db->db_query($checkQry)) { + + if ($db->db_num_rows($result) == 0) { + + $qry = " + INSERT INTO public.tbl_notiz_typ + ( + typ_kurzbz, + bezeichnung_mehrsprachig, + automatisiert, + aktiv, + tag, + style, + vorrueckung, + prioritaet, + taglib + ) + VALUES + ( + '".$tag['typ_kurzbz']."', + '".$tag['bezeichnung']."', + true, + true, + true, + '".$tag['style']."', + false, + '".$tag['prioritaet']."', + '".$tag['taglib']."' + ) + "; + + if (!$db->db_query($qry)) + { + echo 'public.tbl_notiz_typ: '. $tag['typ_kurzbz']. ' '. $db->db_last_error().'
'; + } + else + { + echo '
public.tbl_notiz_typ: Automatic Tag '.$tag['typ_kurzbz'].' hinzugefuegt'; + } + } + } +}