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); return date (DATE_ATOM, self::$updated);
} }
public function getContentArray () { public function getNavLink () {
$navlink = "#";
foreach ($this->linkArray as $link) { foreach ($this->linkArray as $link) {
if ($link->type != Link::OPDS_NAVIGATION_TYPE) { continue; } 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) { 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("authorword", count($array)
// str_format (localize("seriesword", count($array) // str_format (localize("seriesword", count($array)
// str_format (localize("tagword", count($array) // str_format (localize("tagword", count($array)
array_push ($out, array ("title" => "<strong>" . str_format (localize("{$key}word", count($array)), count($array)) . "</strong>", 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}")); "class" => "tt-header",
"navlink" => "index.php?page={$pagequery}&query={$query}&db={$database}&scope={$key}"));
} }
if ($entry instanceof EntryBook) { 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 { } else {
array_push ($out, $entry->getContentArray ()); array_push ($out, array ("class" => "", "title" => $entry->title, "navlink" => $entry->getNavLink ()));
} }
$i++; $i++;
if ($i > 4) { break; }; if ($i > 4) { break; };