Tag: add getContributorList method

This commit is contained in:
Aaron van Geffen 2024-01-14 21:06:34 +01:00
parent 7cdcf8197c
commit 16683d2f1f

View File

@ -141,6 +141,21 @@ class Tag
return $rows; return $rows;
} }
public function getContributorList()
{
return Registry::get('db')->queryPairs('
SELECT u.id_user, u.first_name, u.surname, u.slug, COUNT(*) AS num_assets
FROM assets_tags AS at
LEFT JOIN assets AS a ON at.id_asset = a.id_asset
LEFT JOIN users AS u ON a.id_user_uploaded = u.id_user
WHERE at.id_tag = {int:id_tag}
GROUP BY a.id_user_uploaded
ORDER BY u.first_name, u.surname',
[
'id_tag' => $this->id_tag,
]);
}
public static function getPeople($id_parent = 0, $offset = 0, $limit = 24, $return_format = 'array') public static function getPeople($id_parent = 0, $offset = 0, $limit = 24, $return_format = 'array')
{ {
$rows = Registry::get('db')->queryAssocs(' $rows = Registry::get('db')->queryAssocs('