96 lines
2.3 KiB
PHP
96 lines
2.3 KiB
PHP
<?PHP
|
|
/**
|
|
* This is a simple site offering an overview over the available event types at
|
|
* museum-digital.
|
|
*
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
*/
|
|
declare(strict_types = 1);
|
|
|
|
require __DIR__ . '/../provide_env.php';
|
|
|
|
if (is_numeric($_GET['lang'])) {
|
|
header('Location: /en/' . $_GET['lang']);
|
|
return;
|
|
}
|
|
|
|
error_reporting(E_ALL);
|
|
ini_set("display_errors", "1");
|
|
|
|
if (!empty($_GET['lang']) and is_string($_GET['lang']) and is_dir(__DIR__ . "/../l10n/translation-musdb/{$_GET['lang']}")) {
|
|
$lang = $_GET['lang'];
|
|
}
|
|
else $lang = "en";
|
|
|
|
$tlLoader = new MDTlLoader("ereignis_auswahl", $lang);
|
|
|
|
$eventTypes = [];
|
|
|
|
foreach (MDEventsSet::EVENT_IDS as $j) {
|
|
|
|
$eventTypes[] = [
|
|
'ereignistyp_id' => $j,
|
|
'ereignistyp_name' => $tlLoader->tl("eventtype_name", "eventname", $j),
|
|
'ereignistyp_explica' => $tlLoader->tl("eventtype_explica", "ereignistyp_explica", $j),
|
|
];
|
|
}
|
|
|
|
$availableLangs = MD_STD::scandir(__DIR__ . "/../l10n/translation-musdb");
|
|
|
|
if (!empty($_GET['id']) and !($id = filter_var($_GET['id'], FILTER_VALIDATE_INT))) {
|
|
echo "Error: IDs must be presented in a numeric format.";
|
|
return;
|
|
}
|
|
|
|
echo '
|
|
<style>
|
|
body { font-family: Helvetica, Arial, Calibri; }
|
|
code { font-size: 1.4em; }
|
|
a { padding: .2em; color: #333; text-decoration: none; transition: background .4s, border .4s; }
|
|
a:hover { color: #FFF; background: #000; border-radius: .2em; }
|
|
</style>
|
|
';
|
|
|
|
foreach ($availableLangs as $tLang) {
|
|
echo '
|
|
<a href="/' . $tLang;
|
|
if (!empty($id)) echo '/' . $id;
|
|
echo '">' . $tLang . '</a> ';
|
|
}
|
|
echo '<hr />';
|
|
|
|
if (!empty($id)) {
|
|
|
|
echo '
|
|
<h1>' . $eventTypes[$id]['ereignistyp_name'] . '</h1>
|
|
<dl>
|
|
<dt>ID</dt>
|
|
<dd>' . $id . '</dd>
|
|
<dt>-</dt>
|
|
<dd>' . $eventTypes[$id]['ereignistyp_explica'] . '</dd>
|
|
<dt><label for="permalink">Permalink</label></dt>
|
|
<dd><input type="text" id="permalink" value="https://event-types.museum-digital.org/' . $id . '" /></dd>
|
|
<dl>
|
|
<hr />
|
|
<a href="/' . $lang . '">x</a>
|
|
';
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
echo '
|
|
<h1>Event types</h1>';
|
|
|
|
foreach ($eventTypes as $type) {
|
|
|
|
echo '
|
|
<div>
|
|
<h2><a href="/' . $lang . '/' . $type['ereignistyp_id'] . '"><code>' . $type['ereignistyp_id'] . '</code>: ' . $type['ereignistyp_name'] . '</a></h2>
|
|
<p>' . $type['ereignistyp_explica'] . '</p>
|
|
</div>
|
|
<hr>
|
|
';
|
|
|
|
}
|