Add Custom columns through config. Only tested in HTML catalog for now
re #32
This commit is contained in:
parent
a96888c76a
commit
f4675dec52
5 changed files with 71 additions and 6 deletions
9
book.php
9
book.php
|
@ -10,6 +10,7 @@ require_once('base.php');
|
|||
require_once('serie.php');
|
||||
require_once('author.php');
|
||||
require_once('tag.php');
|
||||
require_once ("customcolumn.php");
|
||||
require_once('data.php');
|
||||
require_once('php-epub-meta/epub.php');
|
||||
|
||||
|
@ -25,6 +26,8 @@ define ('SQL_BOOKS_BY_SERIE', "select {0} from books_series_link, books " . SQL_
|
|||
where books_series_link.book = books.id and series = ? {1} order by series_index");
|
||||
define ('SQL_BOOKS_BY_TAG', "select {0} from books_tags_link, books " . SQL_BOOKS_LEFT_JOIN . "
|
||||
where books_tags_link.book = books.id and tag = ? {1} order by sort");
|
||||
define ('SQL_BOOKS_BY_CUSTOM', "select {0} from {2}, books " . SQL_BOOKS_LEFT_JOIN . "
|
||||
where {2}.book = books.id and {2}.{3} = ? {1} order by sort");
|
||||
define ('SQL_BOOKS_QUERY', "select {0} from books " . SQL_BOOKS_LEFT_JOIN . "
|
||||
where (exists (select null from authors, books_authors_link where book = books.id and author = authors.id and authors.name like ?) or title like ?) {1}");
|
||||
define ('SQL_BOOKS_RECENT', "select {0} from books " . SQL_BOOKS_LEFT_JOIN . "
|
||||
|
@ -41,6 +44,7 @@ class Book extends Base {
|
|||
const SQL_BOOKS_BY_AUTHOR = SQL_BOOKS_BY_AUTHOR;
|
||||
const SQL_BOOKS_BY_SERIE = SQL_BOOKS_BY_SERIE;
|
||||
const SQL_BOOKS_BY_TAG = SQL_BOOKS_BY_TAG;
|
||||
const SQL_BOOKS_BY_CUSTOM = SQL_BOOKS_BY_CUSTOM;
|
||||
const SQL_BOOKS_QUERY = SQL_BOOKS_QUERY;
|
||||
const SQL_BOOKS_RECENT = SQL_BOOKS_RECENT;
|
||||
|
||||
|
@ -398,6 +402,11 @@ class Book extends Base {
|
|||
return self::getEntryArray (self::SQL_BOOKS_BY_TAG, array ($tagId), $n);
|
||||
}
|
||||
|
||||
public static function getBooksByCustom($customId, $id, $n) {
|
||||
$query = str_format (self::SQL_BOOKS_BY_CUSTOM, "{0}", "{1}", CustomColumn::getTableLinkName ($customId), CustomColumn::getTableLinkColumn ($customId));
|
||||
return self::getEntryArray ($query, array ($id), $n);
|
||||
}
|
||||
|
||||
public static function getBookById($bookId) {
|
||||
$result = parent::getDb ()->prepare('select ' . self::BOOK_COLUMNS . '
|
||||
from books ' . self::SQL_BOOKS_LEFT_JOIN . '
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue