' . $contents['object_name'] . '
@@ -282,6 +308,360 @@ function embedObject(array $arguments, array $settings, bool $showDetails = fals
}
+/**
+ * Function drawInstitutionDetails generates a detail area
+ * containing data fetched from the institution API at museum-digital.
+ *
+ * @param string[] $contents Input data fetched from the institution API at museum-digital.
+ * @param array $settings Settings variable.
+ *
+ * @return string
+ */
+function drawInstitutionDetails(array $contents, array $settings):string {
+
+ $output = '
+
+ ';
+
+ if (isset($contents['institution_image']) and $contents['institution_image']) {
+ $output .= '
+
';
+ }
+
+ $output .= '
+
' . $contents['institution_name'] . '
+
' . $contents['institution_description'] . '
+ ';
+
+ $output .= '
+
';
+ if ($contents['institution_street']) $output .= $contents['institution_street'] . ' ';
+ if ($contents['institution_zipcode']) $output .= $contents['institution_zipcode'] . " " . $contents['institution_place'] . " ";
+ if ($contents['institution_telnr']) $output .= "" . $contents['institution_telnr'] . " ";
+ $output .= '
+ ';
+
+ if (count($contents['collections']) >= 1) {
+ $output .= '
+
+
';
+ }
+
+ $output .= '
+
+
+
+
+
+
+ ';
+
+ return $output;
+
+}
+
+/**
+ * Function drawInstitutionTile creates a tile with just the most basic information on an institiution.
+ *
+ * @param string[] $contents Input data fetched from the collection API at museum-digital.
+ * @param array $settings Settings variable.
+ *
+ * @return string
+ */
+function drawInstitutionTile(array $contents, array $settings):string {
+
+ $output = '
+
+ ';
+
+ if (isset($contents['institution_image']) and $contents['institution_image']) {
+ $output .= '
+
';
+ }
+
+ $output .= '
+
+
+
' . $contents['institution_name'] . '
+
+ ' . $contents['institution_street'] . '
+ ' . $contents['institution_zipcode'] . " " . $contents['institution_place'] . '
+
+
+
+
+
+
+
+ ';
+
+ return $output;
+
+}
+
+/**
+ * Function for displaying institution.
+ *
+ * @param array $arguments Arguments / GET parameters for urls to query.
+ * @param array $settings Settings variable.
+ * @param boolean $showDetails Optional. By default, only a tile with most basic information is displayed.
+ *
+ * @return string
+ */
+function embedInstitution(array $arguments, array $settings, bool $showDetails = false):string {
+
+ $toIgnore = ["t=", "output="];
+ $srcArgs = "t=institution";
+ foreach ($arguments as $arg) {
+ if (startsWithAny($arg, $toIgnore)) continue;
+ $srcArgs .= "&" . $arg;
+ }
+ $srcArgs .= "&output=json";
+
+ $contents = json_decode(queryCachePage($settings['mdVersion'] . "?$srcArgs", "institution", $settings), true);
+
+ if (!$showDetails) return drawInstitutionTile($contents, $settings);
+ else return drawInstitutionDetails($contents, $settings);
+
+}
+
+/**
+ * Function drawCollectionDetails generates a detail area.
+ *
+ * @param string[] $contents Input data fetched from the collections API at museum-digital.
+ * @param array $settings Settings variable.
+ *
+ * @return string
+ */
+function drawCollectionDetails(array $contents, array $settings):string {
+
+ $output = '
+
+ ';
+
+ if (isset($contents['collection_image']) and $contents['collection_image']) {
+ $output .= '
+
';
+ }
+
+ $output .= '
+
' . $contents['collection_name'] . '
+
' . $contents['collection_description'] . '
+ ';
+ if (!$settings['hideInstitution']) $output .= '
+
' . $contents['collection_institution']['institution_name'] . '
+ ';
+
+ $output .= '
+
+
+
+
+
+
+ ';
+
+ return $output;
+
+}
+
+/**
+ * Function drawCollectionTile creates a tile with just the most basic information on a collection.
+ *
+ * @param string[] $contents Input data fetched from the collection API at museum-digital.
+ * @param array $settings Settings variable.
+ *
+ * @return string
+ */
+function drawCollectionTile(array $contents, array $settings):string {
+
+ $output = '
+
+ ';
+
+ if (isset($contents['collection_image']) and $contents['collection_image']) {
+ $output .= '
+
';
+ }
+
+ $output .= '
+
+
+
+ ';
+
+ return $output;
+
+}
+
+/**
+ * Function for displaying collections.
+ *
+ * @param array $arguments Arguments / GET parameters for urls to query.
+ * @param array $settings Settings variable.
+ * @param boolean $showDetails Optional. By default, only a tile with most basic information is displayed.
+ *
+ * @return string
+ */
+function embedCollection(array $arguments, array $settings, bool $showDetails = false):string {
+
+ $toIgnore = ["t=", "output="];
+ $srcArgs = "t=sammlung";
+ foreach ($arguments as $arg) {
+ if (startsWithAny($arg, $toIgnore)) continue;
+ $srcArgs .= "&" . $arg;
+ }
+ $srcArgs .= "&output=json";
+
+ $contents = json_decode(queryCachePage($settings['mdVersion'] . "?$srcArgs", "collection", $settings), true);
+
+ if (!$showDetails) return drawCollectionTile($contents, $settings);
+ else return drawCollectionDetails($contents, $settings);
+
+}
+
+/**
+ * Function drawExhibitionDetails creates a tile with just the most basic information on an exhibition.
+ *
+ * @param string[] $contents Input data fetched from the collection API at museum-digital.
+ * @param array $settings Settings variable.
+ *
+ * @return string
+ */
+function drawExhibitionDetails(array $contents, array $settings):string {
+
+ $output = '
+
+ ';
+
+ return $output;
+
+}
+
+/**
+ * Function drawExhibitionTile creates a tile with just the most basic information on an exhibition.
+ *
+ * @param string[] $contents Input data fetched from the collection API at museum-digital.
+ * @param array $settings Settings variable.
+ *
+ * @return string
+ */
+function drawExhibitionTile(array $contents, array $settings):string {
+
+ $output = '
+
+ ';
+
+ if (isset($contents['image']) and $contents['image']) {
+ $output .= '
+
';
+ }
+
+ $output .= '
+
+
+
+ ';
+
+ return $output;
+
+}
+
+/**
+ * Function for displaying exhibition.
+ *
+ * @param array $arguments Arguments / GET parameters for urls to query.
+ * @param array $settings Settings variable.
+ * @param boolean $showDetails Optional. By default, only a tile with most basic information is displayed.
+ *
+ * @return string
+ */
+function embedExhibition(array $arguments, array $settings, bool $showDetails = false):string {
+
+ $toIgnore = ["t=", "output="];
+ $srcArgs = "t=exhibition";
+ foreach ($arguments as $arg) {
+ if (startsWithAny($arg, $toIgnore)) continue;
+ $srcArgs .= "&" . $arg;
+ }
+ $srcArgs .= "&output=json";
+
+ $contents = json_decode(queryCachePage($settings['mdVersion'] . "?$srcArgs", "exhibition", $settings), true);
+
+ if (!$showDetails) return drawExhibitionTile($contents, $settings);
+ else return drawExhibitionDetails($contents, $settings);
+
+}
+
/**
* Function for embedding event calendar.
*
@@ -322,6 +702,122 @@ function embedExhibitionCalendar(array $arguments):string {
return $output;
}
+/**
+ * Function drawEventDetails creates a tile with just the most basic information on an event.
+ *
+ * @param string[] $contents Input data fetched from the event API at museum-digital.
+ * @param array $settings Settings variable.
+ *
+ * @return string
+ */
+function drawEventDetails(array $contents, array $settings):string {
+
+ $output = '
+
+ ';
+
+ return $output;
+
+}
+
+/**
+ * Function drawEventTile creates a tile with just the most basic information on an event.
+ *
+ * @param string[] $contents Input data fetched from the event API at museum-digital.
+ * @param array $settings Settings variable.
+ *
+ * @return string
+ */
+function drawEventTile(array $contents, array $settings):string {
+
+ $output = '
+
+ ';
+
+ if (isset($contents['image']) and $contents['image']) {
+ $output .= '
+
';
+ }
+
+ $output .= '
+
+
+
+ ';
+
+ return $output;
+
+}
+
+/**
+ * Function for displaying events.
+ *
+ * @param array $arguments Arguments / GET parameters for urls to query.
+ * @param array $settings Settings variable.
+ * @param boolean $showDetails Optional. By default, only a tile with most basic information is displayed.
+ *
+ * @return string
+ */
+function embedEvent(array $arguments, array $settings, bool $showDetails = false):string {
+
+ $toIgnore = ["t=", "output="];
+ $srcArgs = "t=event";
+ foreach ($arguments as $arg) {
+ if (startsWithAny($arg, $toIgnore)) continue;
+ $srcArgs .= "&" . $arg;
+ }
+ $srcArgs .= "&output=json";
+
+ $contents = json_decode(queryCachePage($settings['mdVersion'] . "?$srcArgs", "event", $settings), true);
+
+ if (!$showDetails) return drawEventTile($contents, $settings);
+ else return drawEventDetails($contents, $settings);
+
+}
+
/**
* Function for embedding event calendar.
*
diff --git a/inc/standardHTML.php b/inc/standardHTML.php
index a83850a..70aeb89 100644
--- a/inc/standardHTML.php
+++ b/inc/standardHTML.php
@@ -21,14 +21,14 @@
function printPublicHead(array $settings, string $page = "home", string $title = "Home", string $icon = "", $additional = ""):string {
$output = '
-
+
' . $title . '
-
+
';
diff --git a/institution.php b/institution.php
new file mode 100644
index 0000000..377e52b
--- /dev/null
+++ b/institution.php
@@ -0,0 +1,71 @@
+
+ */
+
+// 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.");
+ return;
+}
+
+if ($settings['limitToInstitutions'] != [] and !in_array($_GET['id'], $settings['limitToInstitutions'])) {
+ echo printErrorPage("This object does not belong to an enabled institution.");
+ return;
+}
+
+/*
+ * Output
+ */
+$addToHead = '
+
';
+
+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 '
+
+';
+
+// Print main content
+echo '
+ ';
+
+echo drawInstitutionDetails($contents, $settings);
+
+echo '
+
+';
+
+echo printStaticPagePart("aside", "aside"); // Print aside (if need be)
+
+echo '
+
';
+
+echo printStaticPagePart("footer", "footer"); // Print footer (if need be)
+
+echo printPublicEnd();
+
+?>
diff --git a/js/main.js b/js/main.js
index 9f3cfda..9d6e913 100644
--- a/js/main.js
+++ b/js/main.js
@@ -17,7 +17,12 @@ document.addEventListener("DOMContentLoaded", function() {
"More" : "More",
"MoreAtMuseumDigital" : "museum-digital",
"ObjectAtMuseumDigital" : "Object entry at museum-digital",
+ "InstitutionAtMuseumDigital": "Institution at museum-digital",
+ "CollectionAtMuseumDigital" : "Collection at museum-digital",
+ "ExhibitionAtMuseumDigital" : "Exhibition at museum-digital",
+ "EventAtMuseumDigital" : "Event at museum-digital",
"Collection" : "Collection",
+ "Collections" : "Collections",
"object_material_technique" : "Material / Technique",
"object_dimensions" : "Dimensions",
"Metadata" : "Metadata",
@@ -41,7 +46,12 @@ document.addEventListener("DOMContentLoaded", function() {
"More" : "Mehr",
"MoreAtMuseumDigital" : "museum-digital",
"ObjectAtMuseumDigital" : "Objekt bei museum-digital",
+ "InstitutionAtMuseumDigital": "Institution bei museum-digital",
+ "CollectionAtMuseumDigital" : "Sammlung bei museum-digital",
+ "ExhibitionAtMuseumDigital" : "Ausstellung bei museum-digital",
+ "EventAtMuseumDigital" : "Veranstaltung bei museum-digital",
"Collection" : "Sammlung",
+ "Collection" : "Sammlungen",
"object_material_technique" : "Material / Technik",
"object_dimensions" : "Ausmaße",
"Metadata" : "Metadaten",
diff --git a/object.php b/object.php
index 10e2811..5845463 100644
--- a/object.php
+++ b/object.php
@@ -28,6 +28,11 @@ if (!$contents || (isset($contents[0]) and $contents[0] == "There is no object w
return;
}
+if ($settings['limitToInstitutions'] != [] and !in_array($contents['object_institution']['institution_id'], $settings['limitToInstitutions'])) {
+ echo printErrorPage("This object does not belong to an enabled institution.");
+ return;
+}
+
/*
* Output
*/
diff --git a/themes/default/mdEmbeds.css b/themes/default/mdEmbeds.css
index 86488e7..3eb715b 100644
--- a/themes/default/mdEmbeds.css
+++ b/themes/default/mdEmbeds.css
@@ -24,12 +24,13 @@ a.navicurrent { background: #D6D6D6; }
/**********
* Simple tiles for displaying an object.
+ * This class also builds the base for other tiles.
*/
div.objTile { display: inline-block; width: 200px; border: 1px solid #D6D6D6; text-align: center;
transition: background .4s, box-shadow .4s; }
div.objTile > div { position: relative; padding: .5em .5em 1.5em .5em; }
-div.objTile h4 { margin: 0; padding: 0 .5em; }
+div.objTile h4 { margin: 0; padding: 0 .5em; text-align: center; }
div.objTile img { max-width: 198px; }
div.objTile:hover { background: #F2F2F2; box-shadow: 1px 1px 3px #D6D6D6, -1px -1px 3px #D6D6D6; }
@@ -57,6 +58,12 @@ div.objDetails .objMainImg:hover { max-width: 100vw; max-height: 80vh; float: in
.metadataLine { margin-top: 2.5em; color: #666; border-top: 1px solid #D6D6D6; }
.metadataLine > span { margin-right: 2em; font-size: .95em; font-style: italic; }
+/**********
+ * Collection tiles.
+ */
+
+.objTile.collectionTile { text-align: left; }
+.objTile.collectionTile h4 { padding: 0 0; }
/*****
* Events on object detail page.
*/
diff --git a/themes/default/default.css b/themes/default/theme.css
similarity index 99%
rename from themes/default/default.css
rename to themes/default/theme.css
index 5f62db0..1f11512 100644
--- a/themes/default/default.css
+++ b/themes/default/theme.css
@@ -30,6 +30,8 @@ body { margin: 0; padding: 0; font-family: sourceSansPro;
* { box-sizing: border-box; z-index: 1; }
a { color: inherit; text-decoration: none; }
+h1, h2, h3, h4, h5, h6 { text-align: left; }
+
a.buttonLike { display: inline-block; }
a.buttonLike,