diff --git a/JSON_renderer.php b/JSON_renderer.php index 43b0ded..fc2ccd1 100644 --- a/JSON_renderer.php +++ b/JSON_renderer.php @@ -101,6 +101,22 @@ class JSONRenderer return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink () ); } + public static function getContentArrayTypeahead ($page) { + $out = array (); + foreach ($page->entryArray as $entry) { + if ($entry instanceof EntryBook) { + array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ())); + } else { + if (empty ($entry->className) xor Base::noDatabaseSelected ()) { + array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink ())); + } else { + array_push ($out, array ("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink ())); + } + } + } + return $out; + } + public static function getJson ($complete = false) { global $config; $page = getURLParam ("page", Base::PAGE_INDEX); @@ -114,7 +130,7 @@ class JSONRenderer $currentPage->InitializeContent (); if ($search) { - return $currentPage->getContentArrayTypeahead (); + return self::getContentArrayTypeahead ($currentPage); } $out = array ( "title" => $currentPage->title); diff --git a/base.php b/base.php index 9f74588..537839b 100644 --- a/base.php +++ b/base.php @@ -551,23 +551,6 @@ class Page if (get_class ($this->entryArray [0]) == "EntryBook") return true; return false; } - - public function getContentArrayTypeahead () { - $out = array (); - foreach ($this->entryArray as $entry) { - if ($entry instanceof EntryBook) { - array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ())); - } else { - if (empty ($entry->className) xor Base::noDatabaseSelected ()) { - array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink ())); - } else { - array_push ($out, array ("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink ())); - } - } - } - return $out; - } - } class PageAllAuthors extends Page