Added interpreter for pseudocode for displaying exhibitions, events.

Added basic search.
Added object pages.
This commit is contained in:
2018-06-15 11:26:25 +02:00
committed by Stefan Rohde-Enslin
parent a49746ab10
commit 80485a98ab
19 changed files with 1573 additions and 82 deletions

View File

@ -10,25 +10,30 @@
/**
* Prints the head element of an HTML page in the public frontend.
*
* @param string $page ID of the current page.
* @param string $title Title of the page.
* @param string $icon The icon of the website.
* @param array $settings Settings variable.
* @param string $page ID of the current page.
* @param string $title Title of the page.
* @param string $icon The icon of the website.
* @param string $additional Additional HTML to inject.
*
* @return string
*/
function printPublicHead(string $page = "home", string $title = "Home", string $icon = ""):string {
function printPublicHead(array $settings, string $page = "home", string $title = "Home", string $icon = "", $additional = ""):string {
$output = '<!DOCTYPE html>
<html lang="en" id="' . $page . '">
<head>
<!-- Content Security policies -->
<meta http-equiv="Content-Security-Policy" content="default-src \'none\'; script-src \'self\'; connect-src \'self\'; img-src \'self\'; style-src \'self\' \'unsafe-inline\'; font-src \'self\';" />
<meta http-equiv="Content-Security-Policy" content="default-src \'none\'; script-src \'self\'; connect-src \'self\' ' . $settings['mdVersion'] . '; img-src \'self\' ' . $settings['mdVersion'] . '; style-src \'self\' \'unsafe-inline\'; font-src \'self\';" />
<title>' . $title . '</title>
<link rel="stylesheet" type="text/css" href="themes/default/default.css">
<link rel="stylesheet" type="text/css" href="themes/imports.css">
<meta http-equiv="content-type" content="text/html;charset=utf-8">';
$output .= $additional;
if ($icon) {
$output .= '
<link rel="shortcut icon" sizes="16x16 32x32" href="' . $icon . '" />
@ -39,6 +44,7 @@ function printPublicHead(string $page = "home", string $title = "Home", string $
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script type="text/javascript" src="./js/main.js"></script>
<script type="text/javascript" src="./js/mdCalendar.js" defer></script>
</head>
<body>
@ -151,4 +157,37 @@ function printErrorPage(string $content):string {
}
/**
* Function for generating the standard navigation of the public parts of the page.
*
* @param array $pages List of all pages.
*
* @return string
*/
function generatePublicNav($pages):string {
$output = '<nav>';
$output .= buildPageOrder(
$pages,
function() {
return "<ul>";
},
function() {
return "</ul>";
},
function($inputs, string $toAdd) {
$output = "
<li";
if (!$inputs['public']) $output .= " class='notPublic'";
$output .= ">
<a href='./?id=" . $inputs['id'] . "'>" . $inputs['title'] . "</a>
$toAdd
</li>
";
return $output;
}
);
$output .= '</nav>';
return $output;
}
?>