From 50cb33720b3fe39669d1c5eff9e83600a3b67269 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Thu, 7 Dec 2023 19:07:11 +0100 Subject: [PATCH] Allow updating and getting names of vocabulary groups --- src/NodaLogEdit.php | 1 + src/NodaNameGetter.php | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/NodaLogEdit.php b/src/NodaLogEdit.php index 74b63a2..b32c0f7 100644 --- a/src/NodaLogEdit.php +++ b/src/NodaLogEdit.php @@ -30,6 +30,7 @@ final class NodaLogEdit { 'synchronize', 'status', 'translation', + 'group', ]; /** diff --git a/src/NodaNameGetter.php b/src/NodaNameGetter.php index 02813b5..755be29 100644 --- a/src/NodaNameGetter.php +++ b/src/NodaNameGetter.php @@ -335,4 +335,28 @@ final class NodaNameGetter { return ""; } + + /** + * Static function for getting the name for a group. + * + * @param MDMysqli $mysqli_noda DB connection. + * @param integer $group_id Group ID. + * + * @return string + */ + public static function getGroupName(MDMysqli $mysqli_noda, int $group_id):string { + + $result = $mysqli_noda->query_by_stmt("SELECT `group_name` + FROM `group` + WHERE `group_id` = ?", "i", $group_id); + + if ($cur = $result->fetch_row()) { + $result->close(); + return MD_STD_IN::sanitize_text($cur[0]); + } + $result->close(); + + return ""; + + } }