示例#1
0
function insertPlaceList($dom, $data)
{
    $placeIndex = makeIndex($data, 'placeName');
    $placeList = $dom->createElement('listPlace');
    foreach ($placeIndex as $entry) {
        $xmlID = $entry->label;
        $xmlID = encodeXMLID($xmlID);
        $keyValue = '';
        if ($entry->authority['id'] != '') {
            $keyValue = $entry->authority['system'] . '_' . $entry->authority['id'];
        }
        $listEntry = $dom->createElement('place');
        $xmlIDAttr = $dom->createAttribute('xml:id');
        $xmlIDAttr->value = $xmlID;
        $listEntry->appendChild($xmlIDAttr);
        $placeName = $dom->createElement('placeName');
        if ($keyValue != '') {
            $key = $dom->createAttribute('key');
            $key->value = $keyValue;
            $placeName->appendChild($key);
        }
        $name = $dom->createTextNode($entry->label);
        $placeName->appendChild($name);
        $listEntry->appendChild($placeName);
        $placeList->appendChild($listEntry);
    }
    $bodyNodeList = $dom->getElementsByTagName('body');
    $body = $bodyNodeList->item(0);
    $body->appendChild($placeList);
    return $dom;
}
示例#2
0
function makeSections($data, $field)
{
    $index = makeIndex($data, $field);
    $structuredData = array();
    foreach ($index as $entry) {
        $section = new section();
        $section->label = $entry->label;
        $section->level = $entry->level;
        $section->authority = $entry->authority;
        $section->geoData = $entry->geoData;
        foreach ($entry->content as $idItem) {
            $section->content[] = $data[$idItem];
        }
        $structuredData[] = $section;
    }
    $structuredData = addHigherLevel($structuredData, $field);
    return $structuredData;
}
示例#3
0
function makeCloudArraysPersons($data)
{
    $index = makeIndex($data, 'persName');
    $count = 0;
    foreach ($index as $entry) {
        $id = $count;
        if ($entry->authority['system'] == 'gnd') {
            $id = $entry->authority['id'];
        }
        $name = prependForename($entry->label);
        $weight = count($entry->content);
        $weightArray[$id] = $weight;
        $nameArray[$id] = $name;
        $count++;
    }
    arsort($weightArray);
    $return = array('weightArray' => $weightArray, 'nameArray' => $nameArray);
    return $return;
}
示例#4
0
function makeGeoDataSheet($data, $folderName, $format)
{
    $ending = strtolower($format);
    // Anlegen eines gemeinsamen Index für Orte und Jahre, so dass beide Kategorien abgerufen werden können.
    $index1 = makeIndex($data, 'placeName');
    $index2 = makeIndex($data, 'year');
    $commonIndex = mergeIndices($index1, $index2);
    $rowArray = array();
    $placeName = '';
    // Durchgehen des Index und Abspeichern von standardisierten Datensätzen der Klasse geoDataRow im Array $rowArray
    foreach ($commonIndex as $entry) {
        // Die im Index mit Level 1 auftretenden Ortseinträge dienen nur zum Speichern von Ortsname und Geodaten
        if ($entry->level == 1) {
            // Der Test dient dem Ausschließen von Einträgen ohne Ortsnamen oder Geodaten
            $test = testEntry($entry);
            $placeName = $entry->label;
            $latitude = cleanCoordinate($entry->geoData['lat']);
            $longitude = cleanCoordinate($entry->geoData['long']);
        }
        //Für jeden Indexeintrag Level 2 (Jahre) werden so viele Einträge gespeichert, wie Datensätze unter content verzeichnet sind.
        if ($entry->level == 2 and $test == 1) {
            foreach ($entry->content as $occurrence) {
                $row = new geoDataRow();
                $row->label = $placeName;
                $row->lat = cleanCoordinate($entry->geoData['lat']);
                $row->long = cleanCoordinate($entry->geoData['long']);
                $row->timeStamp = $entry->label;
                $row->lat = $latitude;
                $row->long = $longitude;
                if ($entry->authority['system'] == 'getty') {
                    $row->getty = $entry->authority['id'];
                } elseif ($entry->authority['system'] == 'geoNames') {
                    $row->geoNames = $entry->authority['id'];
                }
                $rowArray[] = $row;
            }
        }
    }
    // Jetzt werden die Objekte der Klasse geoDataRow in Einträge übersetzt, abhängig vom gewählten Format
    if ($ending == 'csv') {
        // Kopfdaten für CSV-Dateien
        $content = '"Name","Address","Description","Longitude","Latitude","TimeStamp","TimeSpan:begin","TimeSpan:end","GettyID",""
';
        foreach ($rowArray as $row) {
            $content .= makePlaceEntryCSV($row);
        }
    } elseif ($ending == 'kml') {
        // Kopfdaten für KML-Dateien
        $content = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
	<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
		<Folder>';
        foreach ($rowArray as $row) {
            $content .= makePlaceEntryKML($row);
        }
        // Fußdaten für KML-Dateien
        $content .= '
		</Folder>
	</kml>';
    }
    // Abspeichern der im String $content zwischengespeicherten Daten in einer Datei im Projektordner
    $fileName = $folderName . '/printingPlaces.' . $ending;
    $datei = fopen($fileName, "w");
    fwrite($datei, $content, 30000000);
    fclose($datei);
}
示例#5
0
     if (count($roomList) > 0) {
         foreach ($roomList as $i => $room) {
             $roomList[$i]['url'] = makeURL($mod, array('roomid' => $room['roomid']));
             $roomList[$i]['event'] = $db->selectOneRow($tbl_e, '*', 'eventid=' . $room['eventid']);
             $roomList[$i]['free_tables'] = $roomList[$i]['event'] > 0 ? countThisRoomsFreeSeats($room['roomid']) : '&nbsp;';
         }
     }
     $smarty->assign('roomList', $roomList);
     // Room add menu subitem
     if ($isallowed) {
         $menu->addSubElement($mod, $lang->get('room_add'), 'add');
     }
 } else {
     $smarty->assign('show_coordinates', $config->get("room", "show-coordinates"));
     $smarty->assign('rowindex', makeIndex($room['height'], $config->get("room", "y-axis-format")));
     $smarty->assign('columnindex', makeIndex($room['width'], $config->get("room", "x-axis-format")));
     switch ($mode) {
         case 'items':
             if (!$isallowed) {
                 break;
             }
             $smarty->assign('path', $template_dir . "/edit_items.tpl");
             $smarty->assign('mod_dir', $mod_dir);
             $breadcrumbs->addElement($room['title'], makeURL($mod, array('roomid' => $roomid)));
             $breadcrumbs->addElement($lang->get('edit_items'), makeURL($mod, array('roomid' => $roomid, 'mode' => 'items')));
             $smarty->assign('room', $room);
             if (isset($_POST['save'])) {
                 saveItems($room);
             }
             $items = $db->selectList($tbl_i, "*", "`roomid`=" . $roomid);
             $smarty->assign('items', $items);
<?php

include "photos/functions.php";
/* If the script hasn't been told to load an album, it should create an index of
 * all of them.
 * Note this intentionally creates an index when it's been given a photo but 
 * not its album.
 */
if (!isset($_GET['album'])) {
    makeIndex();
} else {
    if (!isset($_GET['image'])) {
        makeAlbumIndex($_GET['album']);
    } else {
        makeImage($_GET['album'], $_GET['image']);
    }
}