<?PHP
/**
* This script offers detail pages for institutions
* based on data fetched from museum-digital.
*
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
*/
// Include functions and settings.
require_once __DIR__ . "/inc/functions.php";
// Check validity of request.
if (!isset($_GET['id']) or !is_numeric($_GET['id'])) {
echo printErrorPage("Institution does not exist.");
return;
}
// Ensure working environment for frontend.
ensureEnvironment();
$pages = loadPublicPages(); // Load overview of pages.
$contents = json_decode(queryCachePage($settings['mdVersion'] . "?t=institution&instnr=" . urlencode($_GET['id']) . "&output=json", "institution", $settings), true);
if (!$contents || (isset($contents[0]) and $contents[0] == "There is no institution with this ID yet.")) {
echo printErrorPage("Temporarily unavailable.");
if ($settings['limitToInstitutions'] != [] and !in_array($_GET['id'], $settings['limitToInstitutions'])) {
echo printErrorPage("This object does not belong to an enabled institution.");
/*
* Output
$addToHead = '
<link rel="canonical" href="' . $settings['mdVersion'] . 'index.php?t=institution&instnr=' . $contents['institution_id'] . '" />';
echo printPublicHead($settings, $_GET['id'], $settings['pageTitle'] . " - " . $contents['institution_name'], $settings['logo'], $addToHead);
echo printPublicHeader($settings['pageTitle']);
echo printStaticPagePart("banner", "header"); // Print aside (if need be)
echo generatePublicNav($pages);
echo '
<div id="mainWrapper">
';
// Print main content
<main>';
echo drawInstitutionDetails($contents, $settings);
</main>
echo printStaticPagePart("aside", "aside"); // Print aside (if need be)
</div>';
echo printStaticPagePart("footer", "footer"); // Print footer (if need be)
echo printPublicEnd();
?>