Cleanly handle suggestion title. re #34

This commit is contained in:
Sébastien Lucas 2013-10-06 18:58:16 +02:00
parent 23129b9c9e
commit 3e98615ea9
2 changed files with 12 additions and 8 deletions

View File

@ -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) {

View File

@ -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" => "<strong>" . str_format (localize("{$key}word", count($array)), count($array)) . "</strong>",
"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; };