mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
feat: student name popover preview on /repertoire via htmx
This commit is contained in:
@@ -455,6 +455,24 @@ class Database {
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch all published theses for a given author name.
|
||||
* Returns rows of [id => int, title => string].
|
||||
*/
|
||||
public function getThesesByAuthorName(string $name): array {
|
||||
$stmt = $this->pdo->prepare(
|
||||
"SELECT t.id, t.title
|
||||
FROM theses t
|
||||
JOIN thesis_authors ta ON ta.thesis_id = t.id
|
||||
JOIN authors a ON a.id = ta.author_id
|
||||
WHERE t.is_published = 1
|
||||
AND a.name = ?
|
||||
ORDER BY t.year DESC, t.title ASC"
|
||||
);
|
||||
$stmt->execute([$name]);
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
public function getAvailableYears() {
|
||||
$sql = "SELECT DISTINCT year FROM theses WHERE is_published = 1 ORDER BY year DESC";
|
||||
$stmt = $this->pdo->query($sql);
|
||||
|
||||
Reference in New Issue
Block a user