mirror of
https://github.com/standardebooks/web.git
synced 2025-07-19 21:04:49 -04:00
Add series number to collection headline
This commit is contained in:
parent
2b07471252
commit
c8cacc4ace
3 changed files with 6 additions and 2 deletions
|
@ -3,6 +3,7 @@ class Collection{
|
|||
public $Name;
|
||||
public $Url;
|
||||
public $SequenceNumber = null;
|
||||
public $Type = null;
|
||||
|
||||
public function __construct(string $name){
|
||||
$this->Name = $name;
|
||||
|
|
|
@ -170,6 +170,9 @@ class Ebook{
|
|||
foreach($xml->xpath('/package/metadata/meta[@refines="#' . $collection->attributes()->id . '"][@property="group-position"]') ?: [] as $s){
|
||||
$c->SequenceNumber = (int)$s;
|
||||
}
|
||||
foreach($xml->xpath('/package/metadata/meta[@refines="#' . $collection->attributes()->id . '"][@property="collection-type"]') ?: [] as $s){
|
||||
$c->Type = (string)$s;
|
||||
}
|
||||
$this->Collections[] = $c;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,11 +79,11 @@ catch(\Exception $ex){
|
|||
<p><?= $ebook->ContributorsHtml ?></p>
|
||||
<? } ?>
|
||||
<? if(sizeof($ebook->Collections) > 0){ ?>
|
||||
<p>Part of the
|
||||
<p><? if(sizeof($ebook->Collections) == 1 && $ebook->Collections[0]->SequenceNumber !== null){ ?>№ <?= number_format($ebook->Collections[0]->SequenceNumber) ?> in the<? }else{ ?>Part of the<? } ?>
|
||||
<? for($i = 0; $i < sizeof($ebook->Collections); $i++){ ?>
|
||||
<a href="<?= $ebook->Collections[$i]->Url ?>"><?= Formatter::ToPlainText(preg_replace('/^The /ius', '', (string)$ebook->Collections[$i]->Name) ?? '') ?></a><? if(sizeof($ebook->Collections) > 2){ ?><? if($i == sizeof($ebook->Collections) - 2){ ?>, and <? }elseif($i != sizeof($ebook->Collections) - 1){ ?>, <? } ?><? }elseif($i == sizeof($ebook->Collections) - 2){ ?> and <? } ?>
|
||||
<? } ?>
|
||||
collection<? if(sizeof($ebook->Collections) > 1){ ?>s<? } ?>.</p>
|
||||
<? if(sizeof($ebook->Collections) == 1 && $ebook->Collections[0]->Type !== null){ ?><? if(substr_compare(mb_strtolower($ebook->Collections[0]->Name), mb_strtolower($ebook->Collections[0]->Type), -strlen(mb_strtolower($ebook->Collections[0]->Type))) !== 0){ ?><?= $ebook->Collections[0]->Type ?><? } ?><? }else{ ?>collection<? if(sizeof($ebook->Collections) > 1){ ?>s<? } ?><? } ?>.</p>
|
||||
<? } ?>
|
||||
<ul class="tags"><? foreach($ebook->Tags as $tag){ ?><li><a href="<?= $tag->Url ?>"><?= Formatter::ToPlainText($tag->Name) ?></a></li><? } ?></ul>
|
||||
</aside>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue