This repository has been archived on 2022-07-28. You can view files and clone it, but cannot push or open issues or pull requests.
md-cms/collection.php

75 lines
1.9 KiB
PHP
Raw Permalink Normal View History

<?PHP
/**
2018-06-19 18:02:04 +02:00
* This script offers detail pages for collections
* 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($settings, "Collection does not exist.");
return;
}
// Ensure working environment for frontend.
ensureEnvironment();
$pages = loadPublicPages(); // Load overview of pages.
2018-06-19 18:02:04 +02:00
// Load data
$contents = json_decode(queryCachePage($settings['mdVersion'] . "?t=sammlung&gesusa=" . urlencode($_GET['id']) . "&output=json", "institution", $settings), true);
if (!$contents || (isset($contents[0]) and $contents[0] == "There is no collection with this ID yet.")) {
echo printErrorPage($settings, "Temporarily unavailable.");
return;
}
if ($settings['limitToInstitutions'] != [] and !in_array($contents['collection_id'], $settings['limitToInstitutions'])) {
echo printErrorPage($settings, "This collection does not belong to an enabled institution.");
return;
}
/*
* Output
*/
$addToHead = '
<link rel="canonical" href="' . $settings['mdVersion'] . 'index.php?t=sammlung&gesusa=' . $contents['collection_id'] . '" />';
echo printPublicHead($settings, $_GET['id'], $settings['pageTitle'] . " - " . $contents['collection_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
echo '
<main>';
echo drawCollectionDetails($contents, $settings);
echo '
</main>
';
echo printStaticPagePart("aside", "aside"); // Print aside (if need be)
echo '
</div>';
echo printStaticPagePart("footer", "footer"); // Print footer (if need be)
echo printPublicEnd();
?>