function makeNavigation($nameCat, $tocs, $type) { /*$tocs is an associative array of arrays created by the function makeToC, the index of which is the field the function makeIndex used to create the index categories $type is the field used for the actual page */ $nameCat = fileNameTrans($nameCat); $result = '<ul class="nav navbar-nav">'; foreach ($tocs as $field => $toc) { $classLiTop = 'download'; if ($field == $type) { $classLiTop = 'active'; } $listItems = makeULContent($toc, $nameCat, $field); $fieldGer = translateFieldNames($field); $result .= ' <li class="' . $classLiTop . '"> <a class="dropdown-toggle" data-toggle="dropdown" href="' . $nameCat . '-' . $field . '.html">nach ' . $fieldGer . '<span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="' . $nameCat . '-' . $field . '.html">Seitenanfang</a></li> ' . $listItems . ' </ul> </li>'; } $result .= '</ul>'; return $result; }
function makeHead($thisCatalogue, $navigation, $field) { $fileName = fileNameTrans($thisCatalogue->heading); if ($thisCatalogue->year) { $title = $thisCatalogue->heading . ' (' . $thisCatalogue->year . ')'; } else { $title = $thisCatalogue->heading; } $transcriptionLink = '<br /> <span id="switchLink"><a href="javascript:switchToOriginal()">Transkription des Katalogs</a></span><br/> </p>'; $classLi = 'download'; if ($field == 'jqcloud' or $field == 'doughnut') { $classLi = 'active'; $transcriptionLink = ''; } $chart = ''; if ($field == 'doughnut') { $chart = ' <script type="text/javascript" src="chart.js"></script>'; } $frontMatter = '<!DOCTYPE html> <html lang="en"> <head> <title>' . $thisCatalogue->heading . '</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <script type="text/javascript" src="proprietary.js"></script>' . $chart . ' <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="proprietary.css"> <script type="text/javascript"> window.addEventListener("load", function() { scrollBy(0, -65) }) window.addEventListener("hashchange", function() { scrollBy(0, -65) }) </script> </head> <body> <div class="container"> <div class="container-fluid"> <h1>' . $title . '</h1> <p>' . $thisCatalogue->title . $transcriptionLink . ' </div> <nav class="navbar navbar-default" data-spy="affix" data-offset-top="197">' . $navigation . ' <ul class="nav navbar-nav navbar-right" style="padding-right:15px"> <li class="' . $classLi . '"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-picture"></span> Visualisierungen<span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="' . $fileName . '-wordCloud.html" title="Wortwolken"><span class="glyphicon glyphicon-cloud"></span> Word Clouds</a></li> <li><a href="' . $fileName . '-doughnut.html" title="Kreisdiagramme"><span class="glyphicon glyphicon-adjust"></span> Kreisdiagramme</a></li> <li><a href="https://geobrowser.de.dariah.eu/?csv1=http://geobrowser.de.dariah.eu./storage/' . $thisCatalogue->GeoBrowserStorageID . '¤tStatus=mapChanged=Historical+Map+of+1650" target="_blank" title="Druckorte in Kartenansicht"><span class="glyphicon glyphicon-globe"></span> GeoBrowser</a></li> </ul> </li> </ul> </nav> <div class="container-fluid">'; return $frontMatter; }
function makeList($structuredData, $thisCatalogue) { $folderName = fileNameTrans($thisCatalogue->heading); $count = 1; $content = ''; foreach ($structuredData as $section) { $info = ''; $anchor = ''; if ($section->authority['system'] == 'gnd') { $info = makeCollapseBeacon($section->authority['id'], $folderName, $thisCatalogue->key); $anchor = 'person' . $section->authority['id']; } $content .= makeHeadline($section->level, $section->label, $info, $anchor); foreach ($section->content as $item) { if (get_class($item) == 'item') { $content .= ' <div class="entry">' . makeEntry($item, $thisCatalogue, $count) . ' </div>'; } elseif (get_class($item) == 'volume') { $content .= ' <div class="entry">Sammelband <ul>'; foreach ($item->content as $itemInVol) { $content .= ' <li>' . makeEntry($itemInVol, $thisCatalogue, $count) . ' </li>'; $count++; } $content .= ' </ul> </div>'; } $count++; } } return $content; }
geschrieben. Diese Datensammlung wird abschließend im Projektverzeichnis unter dem Dateinamen data-{projektspezifische Endung} serialisiert. */ include 'classDefinition.php'; include 'makeEntry.php'; include 'ingest.php'; include 'encode.php'; include 'makeIndex.php'; //include('makeSection.php'); include 'makeNavigation.php'; include 'makeHead.php'; include 'makeGeoDataSheet.php'; include 'storeBeacon.php'; include 'setConfiguration.php'; //$thisCatalogue = setConfiguration('bahn'); $thisCatalogue = setConfiguration('rehl'); $facets = $thisCatalogue->facets; // Erstelle ein Verzeichnis für das Projekt $folderName = fileNameTrans($thisCatalogue->heading); if (is_dir($folderName) == FALSE) { mkdir($folderName, 0700); } // Lade die Daten aus der Datenbank in die Variable $data $data = load_data_mysql('localhost', 'root', '', $thisCatalogue->database, 'zusammenfassung'); // Suche in BEACON-Dateien nach Einträgen zu den erwähnten Personen und füge diese den Daten hinzu //storeBeacon($data, $folderName, $thisCatalogue->key); $data = addBeacon($data, $folderName, $thisCatalogue->key); // Speichere die Daten im Projektverzeichnis $serialize = serialize($data); file_put_contents($folderName . '/data-' . $thisCatalogue->key, $serialize); var_dump($data);
$navigation = makeNavigation($thisCatalogue->heading, $tocs, $facet); $content = makeHead($thisCatalogue, $navigation, $facet); $content .= makeList($structure, $thisCatalogue); $content .= $foot; $fileName = fileNameTrans($folderName . '/' . $thisCatalogue->heading) . '-' . $facet . '.html'; $datei = fopen($fileName, "w"); fwrite($datei, $content, 3000000); fclose($datei); $count++; } unset($structures); // Erzeugen der Seite mit den Word Clouds $navigation = makeNavigation($thisCatalogue->heading, $tocs, 'jqcloud'); $content = makeHead($thisCatalogue, $navigation, 'jqcloud'); $content .= makeCloudPageContent($data, $facets, $folderName); $content .= $foot; $fileName = fileNameTrans($folderName . '/' . $thisCatalogue->heading) . '-wordCloud.html'; $datei = fopen($fileName, "w"); fwrite($datei, $content, 3000000); fclose($datei); // Erzeugen der Seite mit den Doughnut Charts $navigation = makeNavigation($thisCatalogue->heading, $tocs, 'doughnut'); $content = makeHead($thisCatalogue, $navigation, 'doughnut'); $content .= makeDoughnutPageContent($data, $facets, $folderName); $content .= $foot; $fileName = fileNameTrans($folderName . '/' . $thisCatalogue->heading) . '-doughnut.html'; $datei = fopen($fileName, "w"); fwrite($datei, $content, 3000000); fclose($datei); // Lösche die von storeBeacon erzeugte temporäre Datei //unlink($folderName.'/beaconStore-'.$thisCatalogue->key);
$content .= $foot; $fileName = fileNameTrans($_SESSION['folderName'] . '/' . $catalogue->fileName) . '-wordCloud.html'; $datei = fopen($fileName, "w"); fwrite($datei, $content, 3000000); fclose($datei); if (file_exists($fileName)) { echo 'Datei ' . $fileName . ' wurde erstellt.<br/>'; } } // Erzeugen der Seite mit den Doughnut Charts if ($catalogue->doughnutFacets != array()) { $navigation = makeNavigation($catalogue->fileName, $tocs, 'doughnut'); $content = makeHead($catalogue, $navigation, 'doughnut'); $content .= makeDoughnutPageContent($data, $catalogue->doughnutFacets, $_SESSION['folderName']); $content .= $foot; $fileName = fileNameTrans($_SESSION['folderName'] . '/' . $catalogue->fileName) . '-doughnut.html'; $datei = fopen($fileName, "w"); fwrite($datei, $content, 3000000); fclose($datei); if (file_exists($fileName)) { echo 'Datei ' . $fileName . ' wurde erstellt.<br/> '; } } zipFolderContent($_SESSION['folderName'], $catalogue->fileName); if (file_exists($_SESSION['folderName'] . '/' . $catalogue->fileName . '.zip')) { echo 'Zip-Archiv ' . $_SESSION['folderName'] . '/' . $catalogue->fileName . '.zip wurde erstellt.<br/>'; } echo '</p>'; echo '<p><a href="' . $firstFileName . '" target="_blank">Website aufrufen</a><br /> <a href="' . $_SESSION['folderName'] . '/' . $catalogue->fileName . '.zip">Download als ZIP-Datei</a></p>';
function makeHead($thisCatalogue, $navigation, $field) { $fileName = fileNameTrans($thisCatalogue->fileName); if ($thisCatalogue->year) { $title = $thisCatalogue->heading . ' (' . $thisCatalogue->year . ')'; } else { $title = $thisCatalogue->heading; } $metadata = displayCatalogueMetadata($thisCatalogue, $field); $classLi = 'download'; if ($field == 'jqcloud' or $field == 'doughnut') { $classLi = 'active'; $transcriptionLink = ''; } $chart = ''; if ($field == 'doughnut') { $chart = ' <script type="text/javascript" src="chart.js"></script>'; } $cloudEntry = ''; if ($thisCatalogue->cloudFacets != array()) { $cloudEntry = '<li><a href="' . $fileName . '-wordCloud.html" title="Wortwolken">Word Clouds</a></li>'; } $doughnutEntry = ''; if ($thisCatalogue->doughnutFacets != array()) { $doughnutEntry = '<li><a href="' . $fileName . '-doughnut.html" title="Kreisdiagramme">Kreisdiagramme</a></li>'; } $geoBrowserLink = makeGeoBrowserLink($thisCatalogue->GeoBrowserStorageID, $thisCatalogue->year); $frontMatter = '<!DOCTYPE html> <html lang="en"> <head> <title>' . $thisCatalogue->heading . '</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <script type="text/javascript" src="proprietary.js"></script>' . $chart . ' <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="proprietary.css"> </head> <body onload="javascript:x = getNavBarHeight();scrollNav(x);"> <div class="container"> <div class="container-fluid"> <h1>' . $title . '</h1> ' . $metadata . ' </div> <nav class="navbar navbar-default" data-spy="affix" data-offset-top="197">' . $navigation . ' <ul class="nav navbar-nav navbar-right" style="padding-right:15px"> <li class="' . $classLi . '"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-picture"></span> Visualisierung<span class="caret"></span></a> <ul class="dropdown-menu"> ' . $cloudEntry . ' ' . $doughnutEntry . ' <li><a href="' . $geoBrowserLink . '" target="_blank" title="Druckorte in Kartenansicht">GeoBrowser</a></li> </ul> </li> </ul> </nav> <div class="container-fluid">'; return $frontMatter; }