";
//print_r($matches);
output_resultlist($lang, $matches);
}
function output_header($lang, $bl_title, $selected_collections) {
// Retrieve form data
$searchfor = htmlspecialchars($_POST["q"]);
$exclude_metadata_only = (array_key_exists('exclude_meta', $_POST)
or ($_SERVER['REQUEST_METHOD'] == 'GET'))
? 'checked' : '';
# override $selected_collections for POST requests
if (isset($_POST['coll'])) {
$selected_collections = $_POST['coll'];
}
$bl_description = ($lang == 'en')
? 'Search folders via linked Wikidata items.'
: 'Suche Mappen über die verknüpften Wikidata-Items';
$bl_hint = ($lang == 'en')
? '(At least 3 characters; use * for right-truncation)'
: '(Mindestens drei Zeichen; benutze * für Rechtstrunkierung)';
echo <<
$bl_title
$bl_title
$bl_description
EOF;
}
function output_resultlist($lang, $matches) {
$bl_results = ($lang == 'en')
? 'Resultlist:'
: 'Ergebnisse:';
echo "$bl_results
";
echo '';
$cnt = count($matches);
foreach ($matches as $entry) {
$url = $entry->pm20->value;
$wd = $entry->item->value;
$item_label = $entry->itemLabel->value;
$collection = $entry->collection->value;
$label = $item_label;
if (isset($entry->pmLabel) and ($collection == 'pe' or $collection == 'co')) {
$label = $entry->pmLabel->value;
}
$label = htmlentities($label, ENT_QUOTES, 'UTF-8', false);
## online document counts in WD are outdated!
##$online_count = (isset($entry->online))
## ? '(' . $entry->online->value . ') '
## : '';
echo "- $label"
, "

" ;
}
echo '
';
echo "$cnt ", ($lang == 'en') ? 'matches' : 'Treffer';
}
function output_footer($lang, $debug) {
$bl_footer = ($lang == 'en')
? 'All folders of the 20th Century Press Archives of ZBW (PM20) are linked to Wikidata items. The items include synonyms and other text in multiple languages, which is used for searching. More on PM20 in Wikidata here.'
: 'Alle Mappen des Pressearchiv 20. Jahrhundert der ZBW (PM20) sind in Wikidata-Datenobjekten verlinkt. Diese Datenobjekte enthalten Synonyme und sonstigen Text in unterschiedlichen Sprachen, der zum Suchen benutzt wird. Mehr über Pressemappen in Wikidata hier.';
echo " ";
echo "$bl_footer";
if ($debug) {
echo <<Debug
EOF;
print_r( $_POST);
echo '';
}
echo <<
EOF;
}