Merge pull request #66 from ipuiu/master
Add language (along with Series / Tags / Authors) as a startup categorie.
This commit is contained in:
commit
9a116772ab
30
base.php
30
base.php
|
@ -235,6 +235,7 @@ class Entry
|
||||||
Serie::ALL_SERIES_ID => 'images/serie.png',
|
Serie::ALL_SERIES_ID => 'images/serie.png',
|
||||||
Book::ALL_RECENT_BOOKS_ID => 'images/recent.png',
|
Book::ALL_RECENT_BOOKS_ID => 'images/recent.png',
|
||||||
Tag::ALL_TAGS_ID => 'images/tag.png',
|
Tag::ALL_TAGS_ID => 'images/tag.png',
|
||||||
|
Language::ALL_LANGUAGES_ID => 'images/language.png',
|
||||||
CustomColumn::ALL_CUSTOMS_ID => 'images/tag.png',
|
CustomColumn::ALL_CUSTOMS_ID => 'images/tag.png',
|
||||||
"calibre:books$" => 'images/allbook.png',
|
"calibre:books$" => 'images/allbook.png',
|
||||||
"calibre:books:letter" => 'images/allbook.png'
|
"calibre:books:letter" => 'images/allbook.png'
|
||||||
|
@ -325,6 +326,10 @@ class Page
|
||||||
return new PageAllTags ($id, $query, $n);
|
return new PageAllTags ($id, $query, $n);
|
||||||
case Base::PAGE_TAG_DETAIL :
|
case Base::PAGE_TAG_DETAIL :
|
||||||
return new PageTagDetail ($id, $query, $n);
|
return new PageTagDetail ($id, $query, $n);
|
||||||
|
case Base::PAGE_ALL_LANGUAGES :
|
||||||
|
return new PageAllLanguages ($id, $query, $n);
|
||||||
|
case Base::PAGE_LANGUAGE_DETAIL :
|
||||||
|
return new PageLanguageDetail ($id, $query, $n);
|
||||||
case Base::PAGE_ALL_CUSTOMS :
|
case Base::PAGE_ALL_CUSTOMS :
|
||||||
return new PageAllCustoms ($id, $query, $n);
|
return new PageAllCustoms ($id, $query, $n);
|
||||||
case Base::PAGE_CUSTOM_DETAIL :
|
case Base::PAGE_CUSTOM_DETAIL :
|
||||||
|
@ -381,6 +386,8 @@ class Page
|
||||||
if (!is_null ($series)) array_push ($this->entryArray, $series);
|
if (!is_null ($series)) array_push ($this->entryArray, $series);
|
||||||
$tags = Tag::getCount();
|
$tags = Tag::getCount();
|
||||||
if (!is_null ($tags)) array_push ($this->entryArray, $tags);
|
if (!is_null ($tags)) array_push ($this->entryArray, $tags);
|
||||||
|
$languages = Language::getCount();
|
||||||
|
if (!is_null ($languages)) array_push ($this->entryArray, $languages);
|
||||||
foreach ($config['cops_calibre_custom_column'] as $lookup) {
|
foreach ($config['cops_calibre_custom_column'] as $lookup) {
|
||||||
$customId = CustomColumn::getCustomId ($lookup);
|
$customId = CustomColumn::getCustomId ($lookup);
|
||||||
if (!is_null ($customId)) {
|
if (!is_null ($customId)) {
|
||||||
|
@ -488,6 +495,16 @@ class PageAllTags extends Page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PageAllLanguages extends Page
|
||||||
|
{
|
||||||
|
public function InitializeContent ()
|
||||||
|
{
|
||||||
|
$this->title = localize("languages.title");
|
||||||
|
$this->entryArray = Language::getAllLanguages();
|
||||||
|
$this->idPage = Language::ALL_LANGUAGES_ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class PageCustomDetail extends Page
|
class PageCustomDetail extends Page
|
||||||
{
|
{
|
||||||
public function InitializeContent ()
|
public function InitializeContent ()
|
||||||
|
@ -522,6 +539,17 @@ class PageTagDetail extends Page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PageLanguageDetail extends Page
|
||||||
|
{
|
||||||
|
public function InitializeContent ()
|
||||||
|
{
|
||||||
|
$language = Language::getLanguageById ($this->idGet);
|
||||||
|
$this->idPage = $language->getEntryId ();
|
||||||
|
$this->title = $language->name;
|
||||||
|
list ($this->entryArray, $this->totalNumber) = Book::getBooksByLanguage ($this->idGet, $this->n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class PageAllSeries extends Page
|
class PageAllSeries extends Page
|
||||||
{
|
{
|
||||||
public function InitializeContent ()
|
public function InitializeContent ()
|
||||||
|
@ -648,6 +676,8 @@ abstract class Base
|
||||||
const PAGE_ALL_CUSTOMS = "14";
|
const PAGE_ALL_CUSTOMS = "14";
|
||||||
const PAGE_CUSTOM_DETAIL = "15";
|
const PAGE_CUSTOM_DETAIL = "15";
|
||||||
const PAGE_ABOUT = "16";
|
const PAGE_ABOUT = "16";
|
||||||
|
const PAGE_ALL_LANGUAGES = "17";
|
||||||
|
const PAGE_LANGUAGE_DETAIL = "18";
|
||||||
|
|
||||||
const COMPATIBILITY_XML_ALDIKO = "aldiko";
|
const COMPATIBILITY_XML_ALDIKO = "aldiko";
|
||||||
|
|
||||||
|
|
13
book.php
13
book.php
|
@ -10,7 +10,8 @@ require_once('base.php');
|
||||||
require_once('serie.php');
|
require_once('serie.php');
|
||||||
require_once('author.php');
|
require_once('author.php');
|
||||||
require_once('tag.php');
|
require_once('tag.php');
|
||||||
require_once ("customcolumn.php");
|
require_once('language.php');
|
||||||
|
require_once("customcolumn.php");
|
||||||
require_once('data.php');
|
require_once('data.php');
|
||||||
require_once('resources/php-epub-meta/epub.php');
|
require_once('resources/php-epub-meta/epub.php');
|
||||||
|
|
||||||
|
@ -26,6 +27,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");
|
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 . "
|
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");
|
where books_tags_link.book = books.id and tag = ? {1} order by sort");
|
||||||
|
define ('SQL_BOOKS_BY_LANGUAGE', "select {0} from books_languages_link, books " . SQL_BOOKS_LEFT_JOIN . "
|
||||||
|
where books_languages_link.book = books.id and lang_code = ? {1} order by sort");
|
||||||
define ('SQL_BOOKS_BY_CUSTOM', "select {0} from {2}, books " . SQL_BOOKS_LEFT_JOIN . "
|
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");
|
where {2}.book = books.id and {2}.{3} = ? {1} order by sort");
|
||||||
define ('SQL_BOOKS_QUERY', "select {0} from books " . SQL_BOOKS_LEFT_JOIN . "
|
define ('SQL_BOOKS_QUERY', "select {0} from books " . SQL_BOOKS_LEFT_JOIN . "
|
||||||
|
@ -44,6 +47,7 @@ class Book extends Base {
|
||||||
const SQL_BOOKS_BY_AUTHOR = SQL_BOOKS_BY_AUTHOR;
|
const SQL_BOOKS_BY_AUTHOR = SQL_BOOKS_BY_AUTHOR;
|
||||||
const SQL_BOOKS_BY_SERIE = SQL_BOOKS_BY_SERIE;
|
const SQL_BOOKS_BY_SERIE = SQL_BOOKS_BY_SERIE;
|
||||||
const SQL_BOOKS_BY_TAG = SQL_BOOKS_BY_TAG;
|
const SQL_BOOKS_BY_TAG = SQL_BOOKS_BY_TAG;
|
||||||
|
const SQL_BOOKS_BY_LANGUAGE = SQL_BOOKS_BY_LANGUAGE;
|
||||||
const SQL_BOOKS_BY_CUSTOM = SQL_BOOKS_BY_CUSTOM;
|
const SQL_BOOKS_BY_CUSTOM = SQL_BOOKS_BY_CUSTOM;
|
||||||
const SQL_BOOKS_QUERY = SQL_BOOKS_QUERY;
|
const SQL_BOOKS_QUERY = SQL_BOOKS_QUERY;
|
||||||
const SQL_BOOKS_RECENT = SQL_BOOKS_RECENT;
|
const SQL_BOOKS_RECENT = SQL_BOOKS_RECENT;
|
||||||
|
@ -63,6 +67,7 @@ class Book extends Base {
|
||||||
public $authors = NULL;
|
public $authors = NULL;
|
||||||
public $serie = NULL;
|
public $serie = NULL;
|
||||||
public $tags = NULL;
|
public $tags = NULL;
|
||||||
|
public $languages = NULL;
|
||||||
public $format = array ();
|
public $format = array ();
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,7 +165,7 @@ class Book extends Base {
|
||||||
$result->execute (array ($this->id));
|
$result->execute (array ($this->id));
|
||||||
while ($post = $result->fetchObject ())
|
while ($post = $result->fetchObject ())
|
||||||
{
|
{
|
||||||
array_push ($lang, $post->lang_code);
|
array_push ($lang, localize("languages.".$post->lang_code));
|
||||||
}
|
}
|
||||||
return implode (", ", $lang);
|
return implode (", ", $lang);
|
||||||
}
|
}
|
||||||
|
@ -408,6 +413,10 @@ class Book extends Base {
|
||||||
return self::getEntryArray (self::SQL_BOOKS_BY_TAG, array ($tagId), $n);
|
return self::getEntryArray (self::SQL_BOOKS_BY_TAG, array ($tagId), $n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getBooksByLanguage($languageId, $n) {
|
||||||
|
return self::getEntryArray (self::SQL_BOOKS_BY_LANGUAGE, array ($languageId), $n);
|
||||||
|
}
|
||||||
|
|
||||||
public static function getBooksByCustom($customId, $id, $n) {
|
public static function getBooksByCustom($customId, $id, $n) {
|
||||||
$query = str_format (self::SQL_BOOKS_BY_CUSTOM, "{0}", "{1}", CustomColumn::getTableLinkName ($customId), CustomColumn::getTableLinkColumn ($customId));
|
$query = str_format (self::SQL_BOOKS_BY_CUSTOM, "{0}", "{1}", CustomColumn::getTableLinkName ($customId), CustomColumn::getTableLinkColumn ($customId));
|
||||||
return self::getEntryArray ($query, array ($id), $n);
|
return self::getEntryArray ($query, array ($id), $n);
|
||||||
|
|
10
index.php
10
index.php
|
@ -12,6 +12,7 @@
|
||||||
require_once ("author.php");
|
require_once ("author.php");
|
||||||
require_once ("serie.php");
|
require_once ("serie.php");
|
||||||
require_once ("tag.php");
|
require_once ("tag.php");
|
||||||
|
require_once ("language.php");
|
||||||
require_once ("customcolumn.php");
|
require_once ("customcolumn.php");
|
||||||
require_once ("book.php");
|
require_once ("book.php");
|
||||||
|
|
||||||
|
@ -173,6 +174,7 @@
|
||||||
<option value="sa"><?php echo localize("authors.title") ?></option>
|
<option value="sa"><?php echo localize("authors.title") ?></option>
|
||||||
<option value="ss"><?php echo localize("series.title") ?></option>
|
<option value="ss"><?php echo localize("series.title") ?></option>
|
||||||
<option value="sp"><?php echo localize("content.published") ?></option>
|
<option value="sp"><?php echo localize("content.published") ?></option>
|
||||||
|
<option value="sl"><?php echo localize("language.title") ?></option>
|
||||||
</select>
|
</select>
|
||||||
<select id="sortorder">
|
<select id="sortorder">
|
||||||
<option value="asc"><?php echo localize("search.sortorder.asc") ?></option>
|
<option value="asc"><?php echo localize("search.sortorder.asc") ?></option>
|
||||||
|
@ -254,6 +256,14 @@
|
||||||
<h4><?php echo localize("tags.title") . " : </h4>" . htmlspecialchars ($tags) ?><br />
|
<h4><?php echo localize("tags.title") . " : </h4>" . htmlspecialchars ($tags) ?><br />
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
$languages = $entry->book->getLanguages ();
|
||||||
|
if (!empty ($languages)) {
|
||||||
|
?>
|
||||||
|
<h4><?php echo localize("languages.title") . " : </h4>" . htmlspecialchars ($languages) ?><br />
|
||||||
|
<?php
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
$serie = $entry->book->getSerie ();
|
$serie = $entry->book->getSerie ();
|
||||||
|
|
|
@ -54,6 +54,197 @@
|
||||||
"bookentry.download":"Download this ebook as {0}",
|
"bookentry.download":"Download this ebook as {0}",
|
||||||
"bookentry.rated":"{0} {1}",
|
"bookentry.rated":"{0} {1}",
|
||||||
"bookentry.fullentrylink":"Full entry",
|
"bookentry.fullentrylink":"Full entry",
|
||||||
|
"language.title":"Language",
|
||||||
|
"languages.title":"Language",
|
||||||
|
"languages.categorized":"Categorized index of the {0} languages",
|
||||||
|
"languages.categorized.single":"Categorized index of the single language - very useful indeed ;)",
|
||||||
|
"languages.alphabetical.many":"Alphabetical index of the {0} languages",
|
||||||
|
"languages.alphabetical.one":"Alphabetical index of the single language - very useful indeed ;)",
|
||||||
|
"languages.alphabetical.none":"Alphabetical index of absolutely no language - very useful indeed ;)",
|
||||||
|
"languages.abk":"Abkhaz",
|
||||||
|
"languages.aaf":"Afar",
|
||||||
|
"languages.afr":"Afrikaans",
|
||||||
|
"languages.aka":"Akan",
|
||||||
|
"languages.sqi":"Albanian",
|
||||||
|
"languages.amh":"Amharic",
|
||||||
|
"languages.ara":"Arabic",
|
||||||
|
"languages.arg":"Aragonese",
|
||||||
|
"languages.hye":"Armenian",
|
||||||
|
"languages.asm":"Assamese",
|
||||||
|
"languages.ava":"Avaric",
|
||||||
|
"languages.ave":"Avestan",
|
||||||
|
"languages.aym":"Aymara",
|
||||||
|
"languages.aze":"Azerbaijani",
|
||||||
|
"languages.bam":"Bambara",
|
||||||
|
"languages.bak":"Bashkir",
|
||||||
|
"languages.eus":"Basque",
|
||||||
|
"languages.bel":"Belarusian",
|
||||||
|
"languages.ben":"Bengali",
|
||||||
|
"languages.bih":"Bihari",
|
||||||
|
"languages.bis":"Bislama",
|
||||||
|
"languages.bos":"Bosnian",
|
||||||
|
"languages.bre":"Breton",
|
||||||
|
"languages.bul":"Bulgarian",
|
||||||
|
"languages.mya":"Burmese",
|
||||||
|
"languages.cat":"Catalan",
|
||||||
|
"languages.cha":"Chamorro",
|
||||||
|
"languages.che":"Chechen",
|
||||||
|
"languages.nya":"Chichewa",
|
||||||
|
"languages.zho":"Chinese",
|
||||||
|
"languages.chv":"Chuvash",
|
||||||
|
"languages.cor":"Cornish",
|
||||||
|
"languages.cos":"Corsican",
|
||||||
|
"languages.cre":"Cree",
|
||||||
|
"languages.hrv":"Croatian",
|
||||||
|
"languages.ces":"Czech",
|
||||||
|
"languages.dan":"Danish",
|
||||||
|
"languages.div":"Divehi",
|
||||||
|
"languages.nld":"Dutch",
|
||||||
|
"languages.dzo":"Dzongkha",
|
||||||
|
"languages.eng":"English",
|
||||||
|
"languages.epo":"Esperanto",
|
||||||
|
"languages.est":"Estonian",
|
||||||
|
"languages.ewe":"Ewe",
|
||||||
|
"languages.fao":"Faroese",
|
||||||
|
"languages.fij":"Fijian",
|
||||||
|
"languages.fin":"Finnish",
|
||||||
|
"languages.fra":"French",
|
||||||
|
"languages.ful":"Fula",
|
||||||
|
"languages.glg":"Galician",
|
||||||
|
"languages.kat":"Georgian",
|
||||||
|
"languages.deu":"German",
|
||||||
|
"languages.ell":"Greek",
|
||||||
|
"languages.grn":"Guaraní",
|
||||||
|
"languages.guj":"Gujarati",
|
||||||
|
"languages.hat":"Haitian",
|
||||||
|
"languages.hau":"Hausa",
|
||||||
|
"languages.hed":"Hebrew",
|
||||||
|
"languages.her":"Herero",
|
||||||
|
"languages.hin":"Hindi",
|
||||||
|
"languages.hmo":"Hiri Motu",
|
||||||
|
"languages.hun":"Hungarian",
|
||||||
|
"languages.ina":"Interlingua",
|
||||||
|
"languages.ind":"Indonesian",
|
||||||
|
"languages.ile":"Interlingue",
|
||||||
|
"languages.gle":"Irish",
|
||||||
|
"languages.ibo":"Igbo",
|
||||||
|
"languages.ipk":"Inupiaq",
|
||||||
|
"languages.ido":"Ido",
|
||||||
|
"languages.isl":"Icelandic",
|
||||||
|
"languages.ita":"Italian",
|
||||||
|
"languages.iku":"Inuktitut",
|
||||||
|
"languages.jpn":"Japanese",
|
||||||
|
"languages.jav":"Javanese",
|
||||||
|
"languages.kal":"Kalaallisut",
|
||||||
|
"languages.kan":"Kannada",
|
||||||
|
"languages.kau":"Kanuri",
|
||||||
|
"languages.kas":"Kashmiri",
|
||||||
|
"languages.kaz":"Kazakh",
|
||||||
|
"languages.khm":"Khmer",
|
||||||
|
"languages.kik":"Kikuyu",
|
||||||
|
"languages.kin":"Kinyarwanda",
|
||||||
|
"languages.kir":"Kyrgyz",
|
||||||
|
"languages.kom":"Komi",
|
||||||
|
"languages.kon":"Kongo",
|
||||||
|
"languages.kor":"Korean",
|
||||||
|
"languages.kur":"Kurdish",
|
||||||
|
"languages.kua":"Kwanyama",
|
||||||
|
"languages.lat":"Latin",
|
||||||
|
"languages.ltz":"Luxembourgish",
|
||||||
|
"languages.lug":"Ganda",
|
||||||
|
"languages.lim":"Limburgish",
|
||||||
|
"languages.lin":"Lingala",
|
||||||
|
"languages.lao":"Lao",
|
||||||
|
"languages.lit":"Lithuanian",
|
||||||
|
"languages.lub":"Luba-Katanga",
|
||||||
|
"languages.lav":"Latvian",
|
||||||
|
"languages.glv":"Manx",
|
||||||
|
"languages.mkd":"Macedonian",
|
||||||
|
"languages.mlg":"Malagasy",
|
||||||
|
"languages.msa":"Malay",
|
||||||
|
"languages.mal":"Malayalam",
|
||||||
|
"languages.mlt":"Maltese",
|
||||||
|
"languages.mri":"Māori",
|
||||||
|
"languages.mar":"Marathi",
|
||||||
|
"languages.mah":"Marshallese",
|
||||||
|
"languages.mon":"Mongolian",
|
||||||
|
"languages.nau":"Nauru",
|
||||||
|
"languages.nav":"Navajo",
|
||||||
|
"languages.nob":"Norwegian Bokmål",
|
||||||
|
"languages.nde":"North Ndebele",
|
||||||
|
"languages.nep":"Nepali",
|
||||||
|
"languages.ndo":"Ndonga",
|
||||||
|
"languages.nno":"Norwegian Nynorsk",
|
||||||
|
"languages.nor":"Norwegian",
|
||||||
|
"languages.iii":"Nuosu",
|
||||||
|
"languages.nbl":"South Ndebele",
|
||||||
|
"languages.oci":"Occitan",
|
||||||
|
"languages.oji":"Ojibwe",
|
||||||
|
"languages.chu":"Old Church Slavonic",
|
||||||
|
"languages.orm":"Oromo",
|
||||||
|
"languages.ori":"Oriya",
|
||||||
|
"languages.oss":"Ossetian",
|
||||||
|
"languages.pan":"Panjabi",
|
||||||
|
"languages.pli":"Pāli",
|
||||||
|
"languages.fas":"Persian",
|
||||||
|
"languages.pol":"Polish",
|
||||||
|
"languages.pus":"Pashto",
|
||||||
|
"languages.pur":"Portuguese",
|
||||||
|
"languages.que":"Quechua",
|
||||||
|
"languages.roh":"Romansh",
|
||||||
|
"languages.run":"Kirundi",
|
||||||
|
"languages.ron":"Romanian",
|
||||||
|
"languages.rus":"Russian",
|
||||||
|
"languages.san":"Sanskrit",
|
||||||
|
"languages.srd":"Sardinian",
|
||||||
|
"languages.snd":"Sindhi",
|
||||||
|
"languages.sme":"Northern Sami",
|
||||||
|
"languages.smo":"Samoan",
|
||||||
|
"languages.sag":"Sango",
|
||||||
|
"languages.srp":"Serbian",
|
||||||
|
"languages.gla":"Scottish Gaelic",
|
||||||
|
"languages.sna":"Shona",
|
||||||
|
"languages.sin":"Sinhala",
|
||||||
|
"languages.slk":"Slovak",
|
||||||
|
"languages.slv":"Slovene",
|
||||||
|
"languages.som":"Somali",
|
||||||
|
"languages.sot":"Southern Sotho",
|
||||||
|
"languages.spa":"Spanish",
|
||||||
|
"languages.sun":"Sundanese",
|
||||||
|
"languages.swa":"Swahili",
|
||||||
|
"languages.ssw":"Swati",
|
||||||
|
"languages.swe":"Swedish",
|
||||||
|
"languages.tam":"Tamil",
|
||||||
|
"languages.tel":"Telugu",
|
||||||
|
"languages.tgk":"Tajik",
|
||||||
|
"languages.tha":"Thai",
|
||||||
|
"languages.tir":"Tigrinya",
|
||||||
|
"languages.bod":"Tibetan Standard",
|
||||||
|
"languages.tuk":"Turkmen",
|
||||||
|
"languages.tgl":"Tagalog",
|
||||||
|
"languages.tsn":"Tswana",
|
||||||
|
"languages.ton":"Tonga",
|
||||||
|
"languages.tur":"Turkish",
|
||||||
|
"languages.tso":"Tsonga",
|
||||||
|
"languages.tat":"Tatar",
|
||||||
|
"languages.twi":"Twi",
|
||||||
|
"languages.tah":"Tahitian",
|
||||||
|
"languages.uig":"Uighur",
|
||||||
|
"languages.ukr":"Ukrainian",
|
||||||
|
"languages.urd":"Urdu",
|
||||||
|
"languages.uzb":"Uzbek",
|
||||||
|
"languages.ven":"Venda",
|
||||||
|
"languages.vie":"Vietnamese",
|
||||||
|
"languages.vol":"Volapük",
|
||||||
|
"languages.win":"Walloon",
|
||||||
|
"languages.cym":"Welsh",
|
||||||
|
"languages.wol":"Wolof",
|
||||||
|
"languages.fry":"Western Frisian",
|
||||||
|
"languages.xho":"Xhosa",
|
||||||
|
"languages.yid":"Yiddish",
|
||||||
|
"languages.yor":"Yoruba",
|
||||||
|
"languages.zha":"Zhuang",
|
||||||
|
"languages.zul":"Zulu",
|
||||||
"tags.title":"Tags",
|
"tags.title":"Tags",
|
||||||
"tags.categorized":"Categorized index of the {0} tags",
|
"tags.categorized":"Categorized index of the {0} tags",
|
||||||
"tags.categorized.single":"Categorized index of the single tag - very useful indeed ;)",
|
"tags.categorized.single":"Categorized index of the single tag - very useful indeed ;)",
|
||||||
|
|
66
language.php
Normal file
66
language.php
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* COPS (Calibre OPDS PHP Server) class file
|
||||||
|
*
|
||||||
|
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||||
|
* @author Sébastien Lucas <sebastien@slucas.fr>
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once('base.php');
|
||||||
|
|
||||||
|
class language extends Base {
|
||||||
|
const ALL_LANGUAGES_ID = "calibre:languages";
|
||||||
|
|
||||||
|
public $id;
|
||||||
|
public $lang_code;
|
||||||
|
|
||||||
|
public function __construct($pid, $plang_code) {
|
||||||
|
$this->id = $pid;
|
||||||
|
$this->lang_code = $plang_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUri () {
|
||||||
|
return "?page=".parent::PAGE_LANGUAGE_DETAIL."&id=$this->id";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEntryId () {
|
||||||
|
return self::ALL_LANGUAGES_ID.":".$this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCount() {
|
||||||
|
$nLanguages = parent::getDb ()->query('select count(*) from languages')->fetchColumn();
|
||||||
|
$entry = new Entry (localize("languages.title"), self::ALL_LANGUAGES_ID,
|
||||||
|
str_format (localize("languages.alphabetical", $nLanguages), $nLanguages), "text non",
|
||||||
|
array ( new LinkNavigation ("?page=".parent::PAGE_ALL_LANGUAGES)));
|
||||||
|
return $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLanguageById ($languageId) {
|
||||||
|
$result = parent::getDb ()->prepare('select id, lang_code from languages where id = ?');
|
||||||
|
$result->execute (array ($languageId));
|
||||||
|
if ($post = $result->fetchObject ()) {
|
||||||
|
return new Language ($post->id, localize("languages.".$post->lang_code));
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getAllLanguages() {
|
||||||
|
$result = parent::getDb ()->query('select languages.id as id, languages.lang_code as lang_code, count(*) as count
|
||||||
|
from languages, books_languages_link
|
||||||
|
where languages.id = books_languages_link.lang_code
|
||||||
|
group by languages.id, books_languages_link.lang_code
|
||||||
|
order by languages.lang_code');
|
||||||
|
$entryArray = array();
|
||||||
|
while ($post = $result->fetchObject ())
|
||||||
|
{
|
||||||
|
$language = new Language ($post->id, $post->lang_code);
|
||||||
|
array_push ($entryArray, new Entry (localize("languages.".$language->lang_code), $language->getEntryId (),
|
||||||
|
str_format (localize("bookword", $post->count), $post->count), "text non",
|
||||||
|
array ( new LinkNavigation ($language->getUri ()))));
|
||||||
|
}
|
||||||
|
return $entryArray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in a new issue