From 3e98615ea9624dbf9db1f2f619c07eefcf42994c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sun, 6 Oct 2013 18:58:16 +0200 Subject: [PATCH] Cleanly handle suggestion title. re #34 --- base.php | 11 +++++++---- book.php | 9 +++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/base.php b/base.php index bfeae82..f28d758 100644 --- a/base.php +++ b/base.php @@ -287,14 +287,17 @@ class Entry return date (DATE_ATOM, self::$updated); } - public function getContentArray () { - $navlink = "#"; + public function getNavLink () { foreach ($this->linkArray as $link) { if ($link->type != Link::OPDS_NAVIGATION_TYPE) { continue; } - $navlink = $link->hrefXhtml (); + return $link->hrefXhtml (); } - return array ( "title" => $this->title, "content" => $this->content, "navlink" => $navlink ); + return "#"; + } + + public function getContentArray () { + return array ( "title" => $this->title, "content" => $this->content, "navlink" => $this->getNavLink () ); } public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray) { diff --git a/book.php b/book.php index 8d2531a..c5d5cd4 100644 --- a/book.php +++ b/book.php @@ -599,13 +599,14 @@ function getJson ($complete = false) { // str_format (localize("authorword", count($array) // str_format (localize("seriesword", count($array) // str_format (localize("tagword", count($array) - array_push ($out, array ("title" => "" . str_format (localize("{$key}word", count($array)), count($array)) . "", - "navlink" => "index.php?page={$pagequery}&query={$query}&db={$database}&scope={$key}")); + array_push ($out, array ("title" => str_format (localize("{$key}word", count($array)), count($array)), + "class" => "tt-header", + "navlink" => "index.php?page={$pagequery}&query={$query}&db={$database}&scope={$key}")); } if ($entry instanceof EntryBook) { - array_push ($out, array ("title" => $entry->title, "navlink" => $entry->book->getDetailUrl ())); + array_push ($out, array ("class" => "", "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ())); } else { - array_push ($out, $entry->getContentArray ()); + array_push ($out, array ("class" => "", "title" => $entry->title, "navlink" => $entry->getNavLink ())); } $i++; if ($i > 4) { break; };