mirror of
https://github.com/standardebooks/web.git
synced 2025-07-14 02:21:55 -04:00
Create method for getting sets of ebooks
This commit is contained in:
parent
cd4be0a3e3
commit
8a1a64629d
7 changed files with 22 additions and 16 deletions
|
@ -2280,9 +2280,9 @@ final class Ebook{
|
|||
}
|
||||
|
||||
/**
|
||||
* Queries for books in a collection.
|
||||
* Get `Ebook`s in a collection.
|
||||
*
|
||||
* Puts ebooks without a `SequenceNumber` at the end of the list, which is more common in a collection with both published and placeholder ebooks.
|
||||
* Puts `Ebook`s without a `SequenceNumber` at the end of the list, which is more common in a collection with both published and placeholder ebooks.
|
||||
*
|
||||
* @return array<Ebook>
|
||||
*/
|
||||
|
@ -2299,9 +2299,10 @@ final class Ebook{
|
|||
}
|
||||
|
||||
/**
|
||||
* Queries for related to books to be shown, e.g., in a carousel.
|
||||
* Get related `Ebook`s, e.g., in a carousel.
|
||||
*
|
||||
* Does not include `EbookPlaceholder`s, because they're not useful for browsing.
|
||||
*
|
||||
* Filters out placeholder books because they are not useful for browsing.
|
||||
* @return array<Ebook>
|
||||
*/
|
||||
public static function GetAllByRelated(Ebook $ebook, int $count, ?EbookTag $relatedTag): array{
|
||||
|
@ -2331,6 +2332,17 @@ final class Ebook{
|
|||
return $relatedEbooks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all `Ebook`s in a set of `EbookId`s.
|
||||
*
|
||||
* @param array<int> $ebookIds
|
||||
*
|
||||
* @return array<Ebook>
|
||||
*/
|
||||
public static function GetAllBySet(array $ebookIds): array{
|
||||
return Db::Query('SELECT * from Ebooks where EbookId in ' . Db::CreateSetSql($ebookIds), $ebookIds, Ebook::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string> $tags
|
||||
*
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?
|
||||
$ebookIds = [2321, 1080, 185, 1090, 431];
|
||||
$carousel = Db::Query('SELECT * from Ebooks where EbookId in ' . Db::CreateSetSql($ebookIds), $ebookIds, Ebook::class);
|
||||
$carousel = Ebook::GetAllBySet([2321, 1080, 185, 1090, 431]);
|
||||
?>
|
||||
<?= Template::Header(title: 'A Kind of Bolshevism in an Uncanny Bookshop', css: ['/css/blog.css']) ?>
|
||||
<main>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?
|
||||
$ebookIds = [1085, 1052];
|
||||
$carousel = Db::Query('SELECT * from Ebooks where EbookId in ' . Db::CreateSetSql($ebookIds), $ebookIds, Ebook::class);
|
||||
$carousel = Ebook::GetAllBySet([1085, 1052]);
|
||||
?>
|
||||
<?= Template::Header(title: 'Death and Beauty in the Alps', css: ['/css/blog.css']) ?>
|
||||
<main>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?
|
||||
$ebookIds = [288, 485, 289, 908, 565, 2114];
|
||||
$carousel = Db::Query('SELECT * from Ebooks where EbookId in ' . Db::CreateSetSql($ebookIds), $ebookIds, Ebook::class);
|
||||
$carousel = Ebook::GetAllBySet([288, 485, 289, 908, 565, 2114]);
|
||||
?>
|
||||
<?= Template::Header(title: 'Edith Wharton’s Vision of Literary Art', css: ['/css/blog.css']) ?>
|
||||
<main>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?
|
||||
$ebookIds = [565, 778, 561, 1059];
|
||||
$carousel = Db::Query('SELECT * from Ebooks where EbookId in ' . Db::CreateSetSql($ebookIds), $ebookIds, Ebook::class);
|
||||
$carousel = Ebook::GetAllBySet([565, 778, 561, 1059]);
|
||||
?>
|
||||
<?= Template::Header(title: 'Joyce’s Ulysses, the Rubáiyát, and “Yes”', css: ['/css/blog.css']) ?>
|
||||
<main>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?
|
||||
$ebookIds = [981, 561, 833];
|
||||
$carousel = Db::Query('SELECT * from Ebooks where EbookId in ' . Db::CreateSetSql($ebookIds), $ebookIds, Ebook::class);
|
||||
$carousel = Ebook::GetAllBySet([981, 561, 833]);
|
||||
?>
|
||||
<?= Template::Header(title: 'Of Human Bondage, Spinoza, and the Meaning of Life', css: ['/css/blog.css']) ?>
|
||||
<main>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?
|
||||
$ebookIds = [415, 607];
|
||||
$carousel = Db::Query('SELECT * from Ebooks where EbookId in ' . Db::CreateSetSql($ebookIds), $ebookIds, Ebook::class);
|
||||
$carousel = Ebook::GetAllBySet([415, 607]);
|
||||
?>
|
||||
<?= Template::Header(title: 'The Ugly Duckling and the Carmelite in Middlemarch', css: ['/css/blog.css']) ?>
|
||||
<main>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue