Allow updating and getting names of vocabulary groups

This commit is contained in:
Joshua Ramon Enslin 2023-12-07 19:07:11 +01:00
parent a677c605c5
commit 50cb33720b
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
2 changed files with 25 additions and 0 deletions

View File

@ -30,6 +30,7 @@ final class NodaLogEdit {
'synchronize',
'status',
'translation',
'group',
];
/**

View File

@ -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 "";
}
}