@@ -19,37 +19,42 @@ discard block |
||
19 | 19 | public $name; |
20 | 20 | public $sort; |
21 | 21 | |
22 | - public function __construct($post) { |
|
22 | + public function __construct($post) |
|
23 | + { |
|
23 | 24 | $this->id = $post->id; |
24 | 25 | $this->name = str_replace("|", ",", $post->name); |
25 | 26 | $this->sort = $post->sort; |
26 | 27 | } |
27 | 28 | |
28 | - public function getUri () { |
|
29 | + public function getUri () |
|
30 | + { |
|
29 | 31 | return "?page=".parent::PAGE_AUTHOR_DETAIL."&id=$this->id"; |
30 | 32 | } |
31 | 33 | |
32 | - public function getEntryId () { |
|
34 | + public function getEntryId () |
|
35 | + { |
|
33 | 36 | return self::ALL_AUTHORS_ID.":".$this->id; |
34 | 37 | } |
35 | 38 | |
36 | - public static function getEntryIdByLetter ($startingLetter) { |
|
39 | + public static function getEntryIdByLetter ($startingLetter) |
|
40 | + { |
|
37 | 41 | return self::ALL_AUTHORS_ID.":letter:".$startingLetter; |
38 | 42 | } |
39 | 43 | |
40 | - public static function getCount() { |
|
44 | + public static function getCount() |
|
45 | + { |
|
41 | 46 | // str_format (localize("authors.alphabetical", count(array)) |
42 | 47 | return parent::getCountGeneric ("authors", self::ALL_AUTHORS_ID, parent::PAGE_ALL_AUTHORS); |
43 | 48 | } |
44 | 49 | |
45 | - public static function getAllAuthorsByFirstLetter() { |
|
50 | + public static function getAllAuthorsByFirstLetter() |
|
51 | + { |
|
46 | 52 | list (, $result) = parent::executeQuery ("select {0} |
47 | 53 | from authors |
48 | 54 | group by substr (upper (sort), 1, 1) |
49 | 55 | order by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array (), -1); |
50 | 56 | $entryArray = array(); |
51 | - while ($post = $result->fetchObject ()) |
|
52 | - { |
|
57 | + while ($post = $result->fetchObject ()) { |
|
53 | 58 | array_push ($entryArray, new Entry ($post->title, Author::getEntryIdByLetter ($post->title), |
54 | 59 | str_format (localize("authorword", $post->count), $post->count), "text", |
55 | 60 | array ( new LinkNavigation ("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode ($post->title))), "", $post->count)); |
@@ -57,30 +62,36 @@ discard block |
||
57 | 62 | return $entryArray; |
58 | 63 | } |
59 | 64 | |
60 | - public static function getAuthorsByStartingLetter($letter) { |
|
65 | + public static function getAuthorsByStartingLetter($letter) |
|
66 | + { |
|
61 | 67 | return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%")); |
62 | 68 | } |
63 | 69 | |
64 | - public static function getAuthorsForSearch($query) { |
|
70 | + public static function getAuthorsForSearch($query) |
|
71 | + { |
|
65 | 72 | return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%")); |
66 | 73 | } |
67 | 74 | |
68 | - public static function getAllAuthors() { |
|
75 | + public static function getAllAuthors() |
|
76 | + { |
|
69 | 77 | return self::getEntryArray (self::SQL_ALL_AUTHORS, array ()); |
70 | 78 | } |
71 | 79 | |
72 | - public static function getEntryArray ($query, $params) { |
|
80 | + public static function getEntryArray ($query, $params) |
|
81 | + { |
|
73 | 82 | return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author"); |
74 | 83 | } |
75 | 84 | |
76 | - public static function getAuthorById ($authorId) { |
|
85 | + public static function getAuthorById ($authorId) |
|
86 | + { |
|
77 | 87 | $result = parent::getDb ()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors where id = ?'); |
78 | 88 | $result->execute (array ($authorId)); |
79 | 89 | $post = $result->fetchObject (); |
80 | 90 | return new Author ($post); |
81 | 91 | } |
82 | 92 | |
83 | - public static function getAuthorByBookId ($bookId) { |
|
93 | + public static function getAuthorByBookId ($bookId) |
|
94 | + { |
|
84 | 95 | $result = parent::getDb ()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link |
85 | 96 | where author = authors.id |
86 | 97 | and book = ? order by books_authors_link.id'); |