Hide tags & series if there is none. re #63

This commit is contained in:
Sébastien Lucas 2013-05-21 09:10:05 +02:00
parent 332e64a82a
commit 32279afc6e
4 changed files with 14 additions and 3 deletions

View file

@ -377,8 +377,10 @@ class Page
} }
} else { } else {
array_push ($this->entryArray, Author::getCount()); array_push ($this->entryArray, Author::getCount());
array_push ($this->entryArray, Serie::getCount()); $series = Serie::getCount();
array_push ($this->entryArray, Tag::getCount()); if (!is_null ($series)) array_push ($this->entryArray, $series);
$tags = Tag::getCount();
if (!is_null ($tags)) array_push ($this->entryArray, $tags);
foreach ($config['cops_calibre_custom_column'] as $lookup) { foreach ($config['cops_calibre_custom_column'] as $lookup) {
$customId = CustomColumn::getCustomId ($lookup); $customId = CustomColumn::getCustomId ($lookup);
if (!is_null ($customId)) { if (!is_null ($customId)) {

View file

@ -247,7 +247,14 @@
?> ?>
<span class="sr"><?php echo $entry->book->getRating () ?></span></h2> <span class="sr"><?php echo $entry->book->getRating () ?></span></h2>
<h4><?php echo localize("authors.title") . " : " ?></h4><span class="sa"><?php echo htmlspecialchars ($entry->book->getAuthorsName ()) ?></span><br /> <h4><?php echo localize("authors.title") . " : " ?></h4><span class="sa"><?php echo htmlspecialchars ($entry->book->getAuthorsName ()) ?></span><br />
<h4><?php echo localize("tags.title") . " : </h4>" . htmlspecialchars ($entry->book->getTagsName ()) ?><br /> <?php
$tags = $entry->book->getTagsName ();
if (!empty ($tags)) {
?>
<h4><?php echo localize("tags.title") . " : </h4>" . htmlspecialchars ($tags) ?><br />
<?php
}
?>
<?php <?php
$serie = $entry->book->getSerie (); $serie = $entry->book->getSerie ();
if (!is_null ($serie)) { if (!is_null ($serie)) {

View file

@ -29,6 +29,7 @@ class Serie extends Base {
public static function getCount() { public static function getCount() {
$nSeries = parent::getDb ()->query('select count(*) from series')->fetchColumn(); $nSeries = parent::getDb ()->query('select count(*) from series')->fetchColumn();
if ($nSeries == 0) return NULL;
$entry = new Entry (localize("series.title"), self::ALL_SERIES_ID, $entry = new Entry (localize("series.title"), self::ALL_SERIES_ID,
str_format (localize("series.alphabetical", $nSeries), $nSeries), "text", str_format (localize("series.alphabetical", $nSeries), $nSeries), "text",
array ( new LinkNavigation ("?page=".parent::PAGE_ALL_SERIES))); array ( new LinkNavigation ("?page=".parent::PAGE_ALL_SERIES)));

View file

@ -29,6 +29,7 @@ class tag extends Base {
public static function getCount() { public static function getCount() {
$nTags = parent::getDb ()->query('select count(*) from tags')->fetchColumn(); $nTags = parent::getDb ()->query('select count(*) from tags')->fetchColumn();
if ($nTags == 0) return NULL;
$entry = new Entry (localize("tags.title"), self::ALL_TAGS_ID, $entry = new Entry (localize("tags.title"), self::ALL_TAGS_ID,
str_format (localize("tags.alphabetical", $nTags), $nTags), "text", str_format (localize("tags.alphabetical", $nTags), $nTags), "text",
array ( new LinkNavigation ("?page=".parent::PAGE_ALL_TAGS))); array ( new LinkNavigation ("?page=".parent::PAGE_ALL_TAGS)));