From ad816f10a36e6a6825d4fe89cc98c7c24866e867 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sat, 11 Mar 2023 19:57:19 +0100 Subject: [PATCH] EditTag: allow designating a tag owner --- controllers/EditTag.php | 5 +++++ models/Member.php | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/controllers/EditTag.php b/controllers/EditTag.php index a26107f..d752223 100644 --- a/controllers/EditTag.php +++ b/controllers/EditTag.php @@ -75,6 +75,11 @@ class EditTag extends HTMLController 'Person' => 'Person', ], ], + 'id_user_owner' => [ + 'type' => 'select', + 'label' => 'Owner', + 'options' => [0 => '(nobody)'] + Member::getMemberMap(), + ], 'tag' => [ 'type' => 'text', 'label' => 'Tag title', diff --git a/models/Member.php b/models/Member.php index 6675dac..84912a4 100644 --- a/models/Member.php +++ b/models/Member.php @@ -192,4 +192,15 @@ class Member extends User // We should probably phase out the use of this function, or refactor the access levels of member properties... return get_object_vars($this); } + + public static function getMemberMap() + { + return Registry::get('db')->queryPair(' + SELECT id_user, CONCAT(first_name, {string:blank}, surname) AS full_name + FROM users + ORDER BY first_name, surname', + [ + 'blank' => ' ', + ]); + } }