@@ -25,69 +25,69 @@ |
||
| 25 | 25 | $this->sort = $post->sort; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function getUri () { |
|
| 29 | - return "?page=".parent::PAGE_AUTHOR_DETAIL."&id=$this->id"; |
|
| 28 | + public function getUri() { |
|
| 29 | + return "?page=" . parent::PAGE_AUTHOR_DETAIL . "&id=$this->id"; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function getEntryId () { |
|
| 33 | - return self::ALL_AUTHORS_ID.":".$this->id; |
|
| 32 | + public function getEntryId() { |
|
| 33 | + return self::ALL_AUTHORS_ID . ":" . $this->id; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public static function getEntryIdByLetter ($startingLetter) { |
|
| 37 | - return self::ALL_AUTHORS_ID.":letter:".$startingLetter; |
|
| 36 | + public static function getEntryIdByLetter($startingLetter) { |
|
| 37 | + return self::ALL_AUTHORS_ID . ":letter:" . $startingLetter; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public static function getCount() { |
| 41 | 41 | // str_format (localize("authors.alphabetical", count(array)) |
| 42 | - return parent::getCountGeneric ("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS); |
|
| 42 | + return parent::getCountGeneric("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function getAllAuthorsByFirstLetter() { |
| 46 | - list (, $result) = parent::executeQuery ("select {0} |
|
| 46 | + list (, $result) = parent::executeQuery("select {0} |
|
| 47 | 47 | from authors |
| 48 | 48 | group by substr (upper (sort), 1, 1) |
| 49 | -order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array (), -1); |
|
| 49 | +order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array(), -1); |
|
| 50 | 50 | $entryArray = array(); |
| 51 | - while ($post = $result->fetchObject ()) |
|
| 51 | + while ($post = $result->fetchObject()) |
|
| 52 | 52 | { |
| 53 | - array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title), |
|
| 54 | - str_format (localize("authorword", $post->count), $post->count), "text", |
|
| 55 | - array ( new LinkNavigation ("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title))), "", $post->count)); |
|
| 53 | + array_push($entryArray, new Entry($post->title, Author::getEntryIdByLetter($post->title), |
|
| 54 | + str_format(localize("authorword", $post->count), $post->count), "text", |
|
| 55 | + array(new LinkNavigation("?page=" . parent::PAGE_AUTHORS_FIRST_LETTER . "&id=" . rawurlencode($post->title))), "", $post->count)); |
|
| 56 | 56 | } |
| 57 | 57 | return $entryArray; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public static function getAuthorsByStartingLetter($letter) { |
| 61 | - return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%")); |
|
| 61 | + return self::getEntryArray(self::SQL_AUTHORS_BY_FIRST_LETTER, array($letter . "%")); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public static function getAuthorsForSearch($query) { |
| 65 | - return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%")); |
|
| 65 | + return self::getEntryArray(self::SQL_AUTHORS_FOR_SEARCH, array($query . "%", $query . "%")); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public static function getAllAuthors() { |
| 69 | - return self::getEntryArray (self::SQL_ALL_AUTHORS, array ()); |
|
| 69 | + return self::getEntryArray(self::SQL_ALL_AUTHORS, array()); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public static function getEntryArray ($query, $params) { |
|
| 73 | - return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author"); |
|
| 72 | + public static function getEntryArray($query, $params) { |
|
| 73 | + return Base::getEntryArrayWithBookNumber($query, self::AUTHOR_COLUMNS, $params, "Author"); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public static function getAuthorById ($authorId) { |
|
| 77 | - $result = parent::getDb ()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?'); |
|
| 78 | - $result->execute (array ($authorId)); |
|
| 79 | - $post = $result->fetchObject (); |
|
| 80 | - return new Author ($post); |
|
| 76 | + public static function getAuthorById($authorId) { |
|
| 77 | + $result = parent::getDb()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?'); |
|
| 78 | + $result->execute(array($authorId)); |
|
| 79 | + $post = $result->fetchObject(); |
|
| 80 | + return new Author($post); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public static function getAuthorByBookId ($bookId) { |
|
| 84 | - $result = parent::getDb ()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link |
|
| 83 | + public static function getAuthorByBookId($bookId) { |
|
| 84 | + $result = parent::getDb()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link |
|
| 85 | 85 | where author = authors.id |
| 86 | 86 | and book = ?'); |
| 87 | - $result->execute (array ($bookId)); |
|
| 88 | - $authorArray = array (); |
|
| 89 | - while ($post = $result->fetchObject ()) { |
|
| 90 | - array_push ($authorArray, new Author ($post)); |
|
| 87 | + $result->execute(array($bookId)); |
|
| 88 | + $authorArray = array(); |
|
| 89 | + while ($post = $result->fetchObject()) { |
|
| 90 | + array_push($authorArray, new Author($post)); |
|
| 91 | 91 | } |
| 92 | 92 | return $authorArray; |
| 93 | 93 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | const ALL_RATING_ID = "cops:rating"; |
| 12 | 12 | |
| 13 | 13 | const RATING_COLUMNS = "ratings.id as id, ratings.rating as rating, count(*) as count"; |
| 14 | - const SQL_ALL_RATINGS ="select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating"; |
|
| 14 | + const SQL_ALL_RATINGS = "select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating"; |
|
| 15 | 15 | public $id; |
| 16 | 16 | public $name; |
| 17 | 17 | |
@@ -20,41 +20,41 @@ discard block |
||
| 20 | 20 | $this->name = $pname; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function getUri () { |
|
| 24 | - return "?page=".parent::PAGE_RATING_DETAIL."&id=$this->id"; |
|
| 23 | + public function getUri() { |
|
| 24 | + return "?page=" . parent::PAGE_RATING_DETAIL . "&id=$this->id"; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function getEntryId () { |
|
| 28 | - return self::ALL_RATING_ID.":".$this->id; |
|
| 27 | + public function getEntryId() { |
|
| 28 | + return self::ALL_RATING_ID . ":" . $this->id; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public static function getCount() { |
| 32 | 32 | // str_format (localize("ratings", count(array)) |
| 33 | - return parent::getCountGeneric ("ratings", self::ALL_RATING_ID, parent::PAGE_ALL_RATINGS, "ratings"); |
|
| 33 | + return parent::getCountGeneric("ratings", self::ALL_RATING_ID, parent::PAGE_ALL_RATINGS, "ratings"); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public static function getAllRatings() { |
| 37 | - return self::getEntryArray (self::SQL_ALL_RATINGS, array ()); |
|
| 37 | + return self::getEntryArray(self::SQL_ALL_RATINGS, array()); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public static function getEntryArray ($query, $params) { |
|
| 41 | - list (, $result) = parent::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1); |
|
| 40 | + public static function getEntryArray($query, $params) { |
|
| 41 | + list (, $result) = parent::executeQuery($query, self::RATING_COLUMNS, "", $params, -1); |
|
| 42 | 42 | $entryArray = array(); |
| 43 | - while ($post = $result->fetchObject ()) |
|
| 43 | + while ($post = $result->fetchObject()) |
|
| 44 | 44 | { |
| 45 | - $ratingObj = new Rating ($post->id, $post->rating); |
|
| 46 | - $rating=$post->rating/2; |
|
| 47 | - $rating = str_format (localize("ratingword", $rating), $rating); |
|
| 48 | - array_push ($entryArray, new Entry ($rating, $ratingObj->getEntryId (), |
|
| 49 | - str_format (localize("bookword", $post->count), $post->count), "text", |
|
| 50 | - array ( new LinkNavigation ($ratingObj->getUri ())), "", $post->count)); |
|
| 45 | + $ratingObj = new Rating($post->id, $post->rating); |
|
| 46 | + $rating = $post->rating / 2; |
|
| 47 | + $rating = str_format(localize("ratingword", $rating), $rating); |
|
| 48 | + array_push($entryArray, new Entry($rating, $ratingObj->getEntryId(), |
|
| 49 | + str_format(localize("bookword", $post->count), $post->count), "text", |
|
| 50 | + array(new LinkNavigation($ratingObj->getUri())), "", $post->count)); |
|
| 51 | 51 | } |
| 52 | 52 | return $entryArray; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public static function getRatingById ($ratingId) { |
|
| 56 | - $result = parent::getDb ()->prepare('select rating from ratings where id = ?'); |
|
| 57 | - $result->execute (array ($ratingId)); |
|
| 58 | - return new Rating ($ratingId, $result->fetchColumn ()); |
|
| 55 | + public static function getRatingById($ratingId) { |
|
| 56 | + $result = parent::getDb()->prepare('select rating from ratings where id = ?'); |
|
| 57 | + $result->execute(array($ratingId)); |
|
| 58 | + return new Rating($ratingId, $result->fetchColumn()); |
|
| 59 | 59 | } |
| 60 | 60 | } |
@@ -22,45 +22,45 @@ |
||
| 22 | 22 | $this->name = $post->name; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function getUri () { |
|
| 26 | - return "?page=".parent::PAGE_PUBLISHER_DETAIL."&id=$this->id"; |
|
| 25 | + public function getUri() { |
|
| 26 | + return "?page=" . parent::PAGE_PUBLISHER_DETAIL . "&id=$this->id"; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function getEntryId () { |
|
| 30 | - return self::ALL_PUBLISHERS_ID.":".$this->id; |
|
| 29 | + public function getEntryId() { |
|
| 30 | + return self::ALL_PUBLISHERS_ID . ":" . $this->id; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public static function getCount() { |
| 34 | 34 | // str_format (localize("publishers.alphabetical", count(array)) |
| 35 | - return parent::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS); |
|
| 35 | + return parent::getCountGeneric("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public static function getPublisherByBookId ($bookId) { |
|
| 39 | - $result = parent::getDb ()->prepare('select publishers.id as id, name |
|
| 38 | + public static function getPublisherByBookId($bookId) { |
|
| 39 | + $result = parent::getDb()->prepare('select publishers.id as id, name |
|
| 40 | 40 | from books_publishers_link, publishers |
| 41 | 41 | where publishers.id = publisher and book = ?'); |
| 42 | - $result->execute (array ($bookId)); |
|
| 43 | - if ($post = $result->fetchObject ()) { |
|
| 44 | - return new Publisher ($post); |
|
| 42 | + $result->execute(array($bookId)); |
|
| 43 | + if ($post = $result->fetchObject()) { |
|
| 44 | + return new Publisher($post); |
|
| 45 | 45 | } |
| 46 | 46 | return NULL; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public static function getPublisherById ($publisherId) { |
|
| 50 | - $result = parent::getDb ()->prepare('select id, name |
|
| 49 | + public static function getPublisherById($publisherId) { |
|
| 50 | + $result = parent::getDb()->prepare('select id, name |
|
| 51 | 51 | from publishers where id = ?'); |
| 52 | - $result->execute (array ($publisherId)); |
|
| 53 | - if ($post = $result->fetchObject ()) { |
|
| 54 | - return new Publisher ($post); |
|
| 52 | + $result->execute(array($publisherId)); |
|
| 53 | + if ($post = $result->fetchObject()) { |
|
| 54 | + return new Publisher($post); |
|
| 55 | 55 | } |
| 56 | 56 | return NULL; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public static function getAllPublishers() { |
| 60 | - return Base::getEntryArrayWithBookNumber (self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array (), "Publisher"); |
|
| 60 | + return Base::getEntryArrayWithBookNumber(self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array(), "Publisher"); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public static function getAllPublishersByQuery($query) { |
| 64 | - return Base::getEntryArrayWithBookNumber (self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array ('%' . $query . '%'), "Publisher"); |
|
| 64 | + return Base::getEntryArrayWithBookNumber(self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array('%' . $query . '%'), "Publisher"); |
|
| 65 | 65 | } |
| 66 | 66 | } |
@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PagePublisherDetail extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $publisher = Publisher::getPublisherById ($this->idGet); |
|
| 13 | + $publisher = Publisher::getPublisherById($this->idGet); |
|
| 14 | 14 | $this->title = $publisher->name; |
| 15 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksByPublisher ($this->idGet, $this->n); |
|
| 16 | - $this->idPage = $publisher->getEntryId (); |
|
| 15 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksByPublisher($this->idGet, $this->n); |
|
| 16 | + $this->idPage = $publisher->getEntryId(); |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageAllRating extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | 13 | $this->title = localize("ratings.title"); |
| 14 | 14 | $this->entryArray = Rating::getAllRatings(); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageAllTags extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | 13 | $this->title = localize("tags.title"); |
| 14 | 14 | $this->entryArray = Tag::getAllTags(); |
@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageTagDetail extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $tag = Tag::getTagById ($this->idGet); |
|
| 14 | - $this->idPage = $tag->getEntryId (); |
|
| 13 | + $tag = Tag::getTagById($this->idGet); |
|
| 14 | + $this->idPage = $tag->getEntryId(); |
|
| 15 | 15 | $this->title = $tag->name; |
| 16 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksByTag ($this->idGet, $this->n); |
|
| 16 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksByTag($this->idGet, $this->n); |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageLanguageDetail extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $language = Language::getLanguageById ($this->idGet); |
|
| 14 | - $this->idPage = $language->getEntryId (); |
|
| 13 | + $language = Language::getLanguageById($this->idGet); |
|
| 14 | + $this->idPage = $language->getEntryId(); |
|
| 15 | 15 | $this->title = $language->lang_code; |
| 16 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksByLanguage ($this->idGet, $this->n); |
|
| 16 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksByLanguage($this->idGet, $this->n); |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -15,16 +15,16 @@ discard block |
||
| 15 | 15 | const SCOPE_BOOK = "book"; |
| 16 | 16 | const SCOPE_PUBLISHER = "publisher"; |
| 17 | 17 | |
| 18 | - private function useTypeahead () { |
|
| 19 | - return !is_null (getURLParam ("search")); |
|
| 18 | + private function useTypeahead() { |
|
| 19 | + return !is_null(getURLParam("search")); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - private function searchByScope ($scope, $limit = FALSE) { |
|
| 22 | + private function searchByScope($scope, $limit = FALSE) { |
|
| 23 | 23 | $n = $this->n; |
| 24 | 24 | $numberPerPage = NULL; |
| 25 | 25 | $queryNormedAndUp = trim($this->query); |
| 26 | - if (useNormAndUp ()) { |
|
| 27 | - $queryNormedAndUp = normAndUp ($this->query); |
|
| 26 | + if (useNormAndUp()) { |
|
| 27 | + $queryNormedAndUp = normAndUp($this->query); |
|
| 28 | 28 | } |
| 29 | 29 | if ($limit) { |
| 30 | 30 | $n = 1; |
@@ -32,59 +32,59 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | switch ($scope) { |
| 34 | 34 | case self::SCOPE_BOOK : |
| 35 | - $array = Book::getBooksByStartingLetter ('%' . $queryNormedAndUp, $n, NULL, $numberPerPage); |
|
| 35 | + $array = Book::getBooksByStartingLetter('%' . $queryNormedAndUp, $n, NULL, $numberPerPage); |
|
| 36 | 36 | break; |
| 37 | 37 | case self::SCOPE_AUTHOR : |
| 38 | - $array = Author::getAuthorsForSearch ('%' . $queryNormedAndUp); |
|
| 38 | + $array = Author::getAuthorsForSearch('%' . $queryNormedAndUp); |
|
| 39 | 39 | break; |
| 40 | 40 | case self::SCOPE_SERIES : |
| 41 | - $array = Serie::getAllSeriesByQuery ($queryNormedAndUp); |
|
| 41 | + $array = Serie::getAllSeriesByQuery($queryNormedAndUp); |
|
| 42 | 42 | break; |
| 43 | 43 | case self::SCOPE_TAG : |
| 44 | - $array = Tag::getAllTagsByQuery ($queryNormedAndUp, $n, NULL, $numberPerPage); |
|
| 44 | + $array = Tag::getAllTagsByQuery($queryNormedAndUp, $n, NULL, $numberPerPage); |
|
| 45 | 45 | break; |
| 46 | 46 | case self::SCOPE_PUBLISHER : |
| 47 | - $array = Publisher::getAllPublishersByQuery ($queryNormedAndUp); |
|
| 47 | + $array = Publisher::getAllPublishersByQuery($queryNormedAndUp); |
|
| 48 | 48 | break; |
| 49 | 49 | default: |
| 50 | - $array = Book::getBooksByQuery ( |
|
| 51 | - array ("all" => "%" . $queryNormedAndUp . "%"), $n); |
|
| 50 | + $array = Book::getBooksByQuery( |
|
| 51 | + array("all" => "%" . $queryNormedAndUp . "%"), $n); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | return $array; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function doSearchByCategory () { |
|
| 58 | - $database = GetUrlParam (DB); |
|
| 59 | - $out = array (); |
|
| 57 | + public function doSearchByCategory() { |
|
| 58 | + $database = GetUrlParam(DB); |
|
| 59 | + $out = array(); |
|
| 60 | 60 | $pagequery = Base::PAGE_OPENSEARCH_QUERY; |
| 61 | - $dbArray = array (""); |
|
| 61 | + $dbArray = array(""); |
|
| 62 | 62 | $d = $database; |
| 63 | 63 | $query = $this->query; |
| 64 | 64 | // Special case when no databases were chosen, we search on all databases |
| 65 | - if (Base::noDatabaseSelected ()) { |
|
| 66 | - $dbArray = Base::getDbNameList (); |
|
| 65 | + if (Base::noDatabaseSelected()) { |
|
| 66 | + $dbArray = Base::getDbNameList(); |
|
| 67 | 67 | $d = 0; |
| 68 | 68 | } |
| 69 | 69 | foreach ($dbArray as $key) { |
| 70 | - if (Base::noDatabaseSelected ()) { |
|
| 71 | - array_push ($this->entryArray, new Entry ($key, DB . ":query:{$d}", |
|
| 70 | + if (Base::noDatabaseSelected()) { |
|
| 71 | + array_push($this->entryArray, new Entry($key, DB . ":query:{$d}", |
|
| 72 | 72 | " ", "text", |
| 73 | - array ( new LinkNavigation ("?" . DB . "={$d}")), "tt-header")); |
|
| 74 | - Base::getDb ($d); |
|
| 73 | + array(new LinkNavigation("?" . DB . "={$d}")), "tt-header")); |
|
| 74 | + Base::getDb($d); |
|
| 75 | 75 | } |
| 76 | - foreach (array (PageQueryResult::SCOPE_BOOK, |
|
| 76 | + foreach (array(PageQueryResult::SCOPE_BOOK, |
|
| 77 | 77 | PageQueryResult::SCOPE_AUTHOR, |
| 78 | 78 | PageQueryResult::SCOPE_SERIES, |
| 79 | 79 | PageQueryResult::SCOPE_TAG, |
| 80 | 80 | PageQueryResult::SCOPE_PUBLISHER) as $key) { |
| 81 | - if (in_array($key, getCurrentOption ('ignored_categories'))) { |
|
| 81 | + if (in_array($key, getCurrentOption('ignored_categories'))) { |
|
| 82 | 82 | continue; |
| 83 | 83 | } |
| 84 | - $array = $this->searchByScope ($key, TRUE); |
|
| 84 | + $array = $this->searchByScope($key, TRUE); |
|
| 85 | 85 | |
| 86 | 86 | $i = 0; |
| 87 | - if (count ($array) == 2 && is_array ($array [0])) { |
|
| 87 | + if (count($array) == 2 && is_array($array [0])) { |
|
| 88 | 88 | $total = $array [1]; |
| 89 | 89 | $array = $array [0]; |
| 90 | 90 | } else { |
@@ -97,32 +97,32 @@ discard block |
||
| 97 | 97 | // str_format (localize("seriesword", count($array)) |
| 98 | 98 | // str_format (localize("tagword", count($array)) |
| 99 | 99 | // str_format (localize("publisherword", count($array)) |
| 100 | - array_push ($this->entryArray, new Entry (str_format (localize ("search.result.{$key}"), $this->query), DB . ":query:{$d}:{$key}", |
|
| 101 | - str_format (localize("{$key}word", $total), $total), "text", |
|
| 102 | - array ( new LinkNavigation ("?page={$pagequery}&query={$query}&db={$d}&scope={$key}")), |
|
| 103 | - Base::noDatabaseSelected () ? "" : "tt-header", $total)); |
|
| 100 | + array_push($this->entryArray, new Entry(str_format(localize("search.result.{$key}"), $this->query), DB . ":query:{$d}:{$key}", |
|
| 101 | + str_format(localize("{$key}word", $total), $total), "text", |
|
| 102 | + array(new LinkNavigation("?page={$pagequery}&query={$query}&db={$d}&scope={$key}")), |
|
| 103 | + Base::noDatabaseSelected()?"":"tt-header", $total)); |
|
| 104 | 104 | } |
| 105 | - if (!Base::noDatabaseSelected () && $this->useTypeahead ()) { |
|
| 105 | + if (!Base::noDatabaseSelected() && $this->useTypeahead()) { |
|
| 106 | 106 | foreach ($array as $entry) { |
| 107 | - array_push ($this->entryArray, $entry); |
|
| 107 | + array_push($this->entryArray, $entry); |
|
| 108 | 108 | $i++; |
| 109 | 109 | if ($i > 4) { break; }; |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | $d++; |
| 114 | - if (Base::noDatabaseSelected ()) { |
|
| 115 | - Base::clearDb (); |
|
| 114 | + if (Base::noDatabaseSelected()) { |
|
| 115 | + Base::clearDb(); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | return $out; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function InitializeContent () |
|
| 121 | + public function InitializeContent() |
|
| 122 | 122 | { |
| 123 | - $scope = getURLParam ("scope"); |
|
| 123 | + $scope = getURLParam("scope"); |
|
| 124 | 124 | if (empty ($scope)) { |
| 125 | - $this->title = str_format (localize ("search.result"), $this->query); |
|
| 125 | + $this->title = str_format(localize("search.result"), $this->query); |
|
| 126 | 126 | } else { |
| 127 | 127 | // Comment to help the perl i18n script |
| 128 | 128 | // str_format (localize ("search.result.author"), $this->query) |
@@ -130,31 +130,31 @@ discard block |
||
| 130 | 130 | // str_format (localize ("search.result.series"), $this->query) |
| 131 | 131 | // str_format (localize ("search.result.book"), $this->query) |
| 132 | 132 | // str_format (localize ("search.result.publisher"), $this->query) |
| 133 | - $this->title = str_format (localize ("search.result.{$scope}"), $this->query); |
|
| 133 | + $this->title = str_format(localize("search.result.{$scope}"), $this->query); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $crit = "%" . $this->query . "%"; |
| 137 | 137 | |
| 138 | 138 | // Special case when we are doing a search and no database is selected |
| 139 | - if (Base::noDatabaseSelected () && !$this->useTypeahead ()) { |
|
| 139 | + if (Base::noDatabaseSelected() && !$this->useTypeahead()) { |
|
| 140 | 140 | $i = 0; |
| 141 | - foreach (Base::getDbNameList () as $key) { |
|
| 142 | - Base::clearDb (); |
|
| 143 | - list ($array, $totalNumber) = Book::getBooksByQuery (array ("all" => $crit), 1, $i, 1); |
|
| 144 | - array_push ($this->entryArray, new Entry ($key, DB . ":query:{$i}", |
|
| 145 | - str_format (localize ("bookword", $totalNumber), $totalNumber), "text", |
|
| 146 | - array ( new LinkNavigation ("?" . DB . "={$i}&page=9&query=" . $this->query)), "", $totalNumber)); |
|
| 141 | + foreach (Base::getDbNameList() as $key) { |
|
| 142 | + Base::clearDb(); |
|
| 143 | + list ($array, $totalNumber) = Book::getBooksByQuery(array("all" => $crit), 1, $i, 1); |
|
| 144 | + array_push($this->entryArray, new Entry($key, DB . ":query:{$i}", |
|
| 145 | + str_format(localize("bookword", $totalNumber), $totalNumber), "text", |
|
| 146 | + array(new LinkNavigation("?" . DB . "={$i}&page=9&query=" . $this->query)), "", $totalNumber)); |
|
| 147 | 147 | $i++; |
| 148 | 148 | } |
| 149 | 149 | return; |
| 150 | 150 | } |
| 151 | 151 | if (empty ($scope)) { |
| 152 | - $this->doSearchByCategory (); |
|
| 152 | + $this->doSearchByCategory(); |
|
| 153 | 153 | return; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $array = $this->searchByScope ($scope); |
|
| 157 | - if (count ($array) == 2 && is_array ($array [0])) { |
|
| 156 | + $array = $this->searchByScope($scope); |
|
| 157 | + if (count($array) == 2 && is_array($array [0])) { |
|
| 158 | 158 | list ($this->entryArray, $this->totalNumber) = $array; |
| 159 | 159 | } else { |
| 160 | 160 | $this->entryArray = $array; |