| @@ 164-172 (lines=9) @@ | ||
| 161 | * @param integer $customId |
|
| 162 | * @return string|null |
|
| 163 | */ |
|
| 164 | private static function getDatatypeByCustomID($customId) |
|
| 165 | { |
|
| 166 | $result = Base::getDb()->prepare('SELECT datatype FROM custom_columns WHERE id = ?'); |
|
| 167 | $result->execute(array($customId)); |
|
| 168 | if ($post = $result->fetchObject()) { |
|
| 169 | return $post->datatype; |
|
| 170 | } |
|
| 171 | return NULL; |
|
| 172 | } |
|
| 173 | ||
| 174 | /** |
|
| 175 | * Create a CustomColumnType by CustomID |
|
| @@ 256-264 (lines=9) @@ | ||
| 253 | * @param integer $customId |
|
| 254 | * @return string |
|
| 255 | */ |
|
| 256 | protected static function getTitleByCustomID($customId) |
|
| 257 | { |
|
| 258 | $result = Base::getDb()->prepare('SELECT name FROM custom_columns WHERE id = ?'); |
|
| 259 | $result->execute(array($customId)); |
|
| 260 | if ($post = $result->fetchObject()) { |
|
| 261 | return $post->name; |
|
| 262 | } |
|
| 263 | return ""; |
|
| 264 | } |
|
| 265 | ||
| 266 | /** |
|
| 267 | * Get the query to find all books with a specific value of this column |
|
| @@ 42-49 (lines=8) @@ | ||
| 39 | return Base::getCountGeneric ("languages", self::ALL_LANGUAGES_ID, Base::PAGE_ALL_LANGUAGES); |
|
| 40 | } |
|
| 41 | ||
| 42 | public static function getLanguageById ($languageId) { |
|
| 43 | $result = Base::getDb ()->prepare('select id, lang_code from languages where id = ?'); |
|
| 44 | $result->execute (array ($languageId)); |
|
| 45 | if ($post = $result->fetchObject ()) { |
|
| 46 | return new Language ($post->id, Language::getLanguageString ($post->lang_code)); |
|
| 47 | } |
|
| 48 | return NULL; |
|
| 49 | } |
|
| 50 | ||
| 51 | ||
| 52 | ||
| @@ 38-47 (lines=10) @@ | ||
| 35 | return Base::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, Base::PAGE_ALL_PUBLISHERS); |
|
| 36 | } |
|
| 37 | ||
| 38 | public static function getPublisherByBookId ($bookId) { |
|
| 39 | $result = Base::getDb ()->prepare('select publishers.id as id, name |
|
| 40 | from books_publishers_link, publishers |
|
| 41 | where publishers.id = publisher and book = ?'); |
|
| 42 | $result->execute (array ($bookId)); |
|
| 43 | if ($post = $result->fetchObject ()) { |
|
| 44 | return new Publisher ($post); |
|
| 45 | } |
|
| 46 | return NULL; |
|
| 47 | } |
|
| 48 | ||
| 49 | public static function getPublisherById ($publisherId) { |
|
| 50 | $result = Base::getDb ()->prepare('select id, name |
|
| @@ 49-57 (lines=9) @@ | ||
| 46 | return NULL; |
|
| 47 | } |
|
| 48 | ||
| 49 | public static function getPublisherById ($publisherId) { |
|
| 50 | $result = Base::getDb ()->prepare('select id, name |
|
| 51 | from publishers where id = ?'); |
|
| 52 | $result->execute (array ($publisherId)); |
|
| 53 | if ($post = $result->fetchObject ()) { |
|
| 54 | return new Publisher ($post); |
|
| 55 | } |
|
| 56 | return NULL; |
|
| 57 | } |
|
| 58 | ||
| 59 | public static function getAllPublishers() { |
|
| 60 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array (), "Publisher"); |
|
| @@ 37-46 (lines=10) @@ | ||
| 34 | return Base::getCountGeneric ("series", self::ALL_SERIES_ID, Base::PAGE_ALL_SERIES); |
|
| 35 | } |
|
| 36 | ||
| 37 | public static function getSerieByBookId ($bookId) { |
|
| 38 | $result = Base::getDb ()->prepare('select series.id as id, name |
|
| 39 | from books_series_link, series |
|
| 40 | where series.id = series and book = ?'); |
|
| 41 | $result->execute (array ($bookId)); |
|
| 42 | if ($post = $result->fetchObject ()) { |
|
| 43 | return new Serie ($post); |
|
| 44 | } |
|
| 45 | return NULL; |
|
| 46 | } |
|
| 47 | ||
| 48 | public static function getSerieById ($serieId) { |
|
| 49 | $result = Base::getDb ()->prepare('select id, name from series where id = ?'); |
|
| @@ 48-55 (lines=8) @@ | ||
| 45 | return NULL; |
|
| 46 | } |
|
| 47 | ||
| 48 | public static function getSerieById ($serieId) { |
|
| 49 | $result = Base::getDb ()->prepare('select id, name from series where id = ?'); |
|
| 50 | $result->execute (array ($serieId)); |
|
| 51 | if ($post = $result->fetchObject ()) { |
|
| 52 | return new Serie ($post); |
|
| 53 | } |
|
| 54 | return NULL; |
|
| 55 | } |
|
| 56 | ||
| 57 | public static function getAllSeries() { |
|
| 58 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_SERIES, self::SERIES_COLUMNS, array (), "Serie"); |
|
| @@ 36-43 (lines=8) @@ | ||
| 33 | return Base::getCountGeneric ("tags", self::ALL_TAGS_ID, Base::PAGE_ALL_TAGS); |
|
| 34 | } |
|
| 35 | ||
| 36 | public static function getTagById ($tagId) { |
|
| 37 | $result = Base::getDb ()->prepare('select id, name from tags where id = ?'); |
|
| 38 | $result->execute (array ($tagId)); |
|
| 39 | if ($post = $result->fetchObject ()) { |
|
| 40 | return new Tag ($post); |
|
| 41 | } |
|
| 42 | return NULL; |
|
| 43 | } |
|
| 44 | ||
| 45 | public static function getAllTags() { |
|
| 46 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag"); |
|