From 93b55d2da238a894b77752ddd89026433db621e5 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Wed, 9 Apr 2025 21:33:59 -0500 Subject: [PATCH] Add Authors index --- lib/Contributor.php | 22 ++++++++++++-------- templates/EbookPlaceholderForm.php | 4 ++-- www/authors/index.php | 22 ++++++++++++++++++++ www/images/leo-tolstoy-in-his-study.avif | Bin 0 -> 49871 bytes www/images/leo-tolstoy-in-his-study.jpg | Bin 0 -> 58638 bytes www/images/leo-tolstoy-in-his-study@2x.avif | Bin 0 -> 119815 bytes www/images/leo-tolstoy-in-his-study@2x.jpg | Bin 0 -> 181931 bytes 7 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 www/authors/index.php create mode 100644 www/images/leo-tolstoy-in-his-study.avif create mode 100644 www/images/leo-tolstoy-in-his-study.jpg create mode 100644 www/images/leo-tolstoy-in-his-study@2x.avif create mode 100644 www/images/leo-tolstoy-in-his-study@2x.jpg diff --git a/lib/Contributor.php b/lib/Contributor.php index 220bd129..18ba65c0 100644 --- a/lib/Contributor.php +++ b/lib/Contributor.php @@ -44,23 +44,27 @@ class Contributor{ /** * @return array */ - public static function GetAllAuthorNames(): array{ + public static function GetAllByMarcRole(Enums\MarcRole $marcRole): array{ return Db::Query(' - SELECT DISTINCT Name + SELECT + * from Contributors - where MarcRole = "aut" - order by Name asc', [], Contributor::class); + where MarcRole = ? + and SortName is not null + group by SortName + order by SortName asc', [$marcRole], Contributor::class); } /** - * @return array + * @return array */ - public static function GetAllTranslatorNames(): array{ + public static function GetAllNamesByMarcRole(Enums\MarcRole $marcRole): array{ return Db::Query(' - SELECT DISTINCT Name + SELECT + distinct Name from Contributors - where MarcRole = "trl" - order by Name asc', [], Contributor::class); + where MarcRole = ? + order by Name asc', [$marcRole]); } /** diff --git a/templates/EbookPlaceholderForm.php b/templates/EbookPlaceholderForm.php index 9ea69ca1..1315596e 100644 --- a/templates/EbookPlaceholderForm.php +++ b/templates/EbookPlaceholderForm.php @@ -11,7 +11,7 @@ $showProjectForm ??= true;