gutenbergsite/catalog/admin/subj_locc_by_etext.php.2009...

55 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2020-08-28 16:21:11 +00:00
<?php
include_once ("pgcat.phh");
authenticate ();
getint("within_the_last");
$db = $config->db ();
$db->logger = new logger ();
if ($within_the_last) {
pageheader("List of Books released within the last $within_the_last days lacking a Subject and/or a LoCC");
} else {
pageheader("List of Books lacking a Subject and/or a LoCC");
}
class SubjLoccByEtextTable extends MoreTable {
function SubjLoccByEtextTable () {
$this->AddColumn ("<a href=\"book?mode=edit&fk_books=#pk#\">#pk#</a>",
"Etext Nr. (edit link)", "right");
$this->AddSimpleColumn ("author", "Author");
$this->AddColumn ("<a href=\"/etext/#pk#\">#title#</a>",
"Title (bibrec link)");
$this->AddColumn ("<span style=\"background-color:#nosubj#;\">" .
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>",
"No Subj", "narrow");
$this->AddColumn ("<span style=\"background-color:#nolocc#;\">" .
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>",
"No LoCC", "narrow");
$this->limit = 30;
$this->relay = array ();
}
}
$table = new SubjLoccByEtextTable ();
$sql="select distinct on (fk_books) fk_books as pk, text as title, author, " .
"(case when fk_subjects is null then 'black' end) as nosubj, " .
"(case when fk_loccs is null then 'black' end) as nolocc " .
"from attributes left join mn_books_subjects using (fk_books) " .
"left join mn_books_loccs using (fk_books) " .
"join mn_books_authors using (fk_books) " .
"join authors on authors.pk=fk_authors ";
if ($within_the_last) {
$sql=$sql . "join books on books.pk=fk_books ";
}
$sql=$sql . "where fk_attriblist=245 and " .
"fk_roles='aut' and heading=1 and ";
if ($within_the_last) {
$sql=$sql . "release_date>=(current_date-integer '$within_the_last') and ";
}
$sql=$sql . "((fk_subjects is null) or (fk_loccs is null)) " .
"order by fk_books, text, author" .
$table->MkOffset ();
$db->Exec($sql);
$table->PrintTable($db, "Books lacking a Subject and/or a LoCC");
pagefooter();