Remove obsolete files for generating iso8859 XML files
This commit is contained in:
parent
13395387a0
commit
1f766c7eca
4
csv.php
4
csv.php
|
@ -56,7 +56,7 @@ foreach ($availableFields as $headline => $fields) {
|
||||||
# $tLine4[] = $field['remark'];
|
# $tLine4[] = $field['remark'];
|
||||||
if (!empty($field['allowedValues'])) $tLine4[] = end($field['allowedValues']);
|
if (!empty($field['allowedValues'])) $tLine4[] = end($field['allowedValues']);
|
||||||
else $tLine4[] = $field['name_human_readable'];
|
else $tLine4[] = $field['name_human_readable'];
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,5 +75,5 @@ else
|
||||||
header("Content-Disposition: attachment; filename=csvxml_museum-digital_template-{$lang}.csv");
|
header("Content-Disposition: attachment; filename=csvxml_museum-digital_template-{$lang}.csv");
|
||||||
|
|
||||||
for ($i = 2; $i <= 4; $i++) {
|
for ($i = 2; $i <= 4; $i++) {
|
||||||
echo mb_convert_encoding('"' . implode("\";\"", ${"line$i"}) . '"' . PHP_EOL, 'utf-16','utf-8');;
|
echo mb_convert_encoding('"' . implode("\";\"", ${"line$i"}) . '"' . PHP_EOL, 'utf-16', 'utf-8');;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ $allowed = $eventpart = $eventpartsure = $fieldsWithDependency = $fieldsWithAllo
|
||||||
|
|
||||||
foreach ($availableFields as $categoryName => $fieldCategory) {
|
foreach ($availableFields as $categoryName => $fieldCategory) {
|
||||||
$allowed = array_merge($allowed, array_keys($fieldCategory));
|
$allowed = array_merge($allowed, array_keys($fieldCategory));
|
||||||
|
|
||||||
// Extended operations for events
|
// Extended operations for events
|
||||||
if (strpos($categoryName, $basis['event']) !== false) {
|
if (strpos($categoryName, $basis['event']) !== false) {
|
||||||
foreach ($fieldCategory as $key => $value) {
|
foreach ($fieldCategory as $key => $value) {
|
||||||
|
@ -42,7 +42,7 @@ foreach ($availableFields as $categoryName => $fieldCategory) {
|
||||||
else $eventpart[] = $key;
|
else $eventpart[] = $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($fieldCategory as $key => $value) {
|
foreach ($fieldCategory as $key => $value) {
|
||||||
if (!empty($value["dependsOn"])) {
|
if (!empty($value["dependsOn"])) {
|
||||||
$fieldsWithDependency[$key] = $value['dependsOn'];
|
$fieldsWithDependency[$key] = $value['dependsOn'];
|
||||||
|
@ -51,7 +51,7 @@ foreach ($availableFields as $categoryName => $fieldCategory) {
|
||||||
$fieldsWithAllowedValueSet[$key] = $value['allowedValues'];
|
$fieldsWithAllowedValueSet[$key] = $value['allowedValues'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$allowed_object_other_title_kind_of = array('object_other_title_kind_of', 'Wissenschaft', 'Alltagssprache', 'Umgangssprache', 'Dialekt', 'Tudományos', 'Köznyelvi', 'Nyelvjárás');
|
$allowed_object_other_title_kind_of = array('object_other_title_kind_of', 'Wissenschaft', 'Alltagssprache', 'Umgangssprache', 'Dialekt', 'Tudományos', 'Köznyelvi', 'Nyelvjárás');
|
||||||
|
@ -73,8 +73,8 @@ $fp = fopen ( $csv_datei, 'r' );
|
||||||
$y = 1;
|
$y = 1;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$zeile = fgetcsv ( $fp, 100000, ';' );
|
$zeile = fgetcsv ( $fp, 100000, ';' );
|
||||||
for ($x = 0; $x < count ( $zeile ); $x++)
|
for ($x = 0; $x < count($zeile); $x++) {
|
||||||
{
|
|
||||||
$zeile[$x] = str_replace("\xEF\xBB\xBF", "", $zeile[$x]);
|
$zeile[$x] = str_replace("\xEF\xBB\xBF", "", $zeile[$x]);
|
||||||
$inhalt[$y][$x] = $zeile[$x];
|
$inhalt[$y][$x] = $zeile[$x];
|
||||||
if (!in_array($inhalt[1][$x], $allowed)) {
|
if (!in_array($inhalt[1][$x], $allowed)) {
|
||||||
|
@ -187,15 +187,15 @@ echo '<br><br>5: Dependent colums observed ?<br>';
|
||||||
|
|
||||||
// Check for correct handling of dependent fields
|
// Check for correct handling of dependent fields
|
||||||
foreach ($fieldsWithDependency as $tField => $tDependentFields) {
|
foreach ($fieldsWithDependency as $tField => $tDependentFields) {
|
||||||
|
|
||||||
if (array_search($tField, $erstezeile) === false) continue;
|
if (array_search($tField, $erstezeile) === false) continue;
|
||||||
|
|
||||||
foreach ($tDependentFields as $tDependentField) {
|
foreach ($tDependentFields as $tDependentField) {
|
||||||
if (array_search($tDependentField, $erstezeile) === false) {
|
if (array_search($tDependentField, $erstezeile) === false) {
|
||||||
$depencymessage[] = "Dependency issue at column $tField: Corresponding column $tDependentField is missing";
|
$depencymessage[] = "Dependency issue at column $tField: Corresponding column $tDependentField is missing";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($depencymessage) and $depencymessage != '') {
|
if (isset($depencymessage) and $depencymessage != '') {
|
||||||
|
@ -281,18 +281,18 @@ if ($depcon_error == 0) echo '<br><i style="font-style:normal;color:#009900;">De
|
||||||
///// Check #7
|
///// Check #7
|
||||||
echo '<br><br>7: Not allowed values in controlled lists?<br>';
|
echo '<br><br>7: Not allowed values in controlled lists?<br>';
|
||||||
for ($i = 2; $i <= $y; $i++) {
|
for ($i = 2; $i <= $y; $i++) {
|
||||||
|
|
||||||
foreach ($inhalt[$i] as $key => $value) {
|
foreach ($inhalt[$i] as $key => $value) {
|
||||||
|
|
||||||
$columnName = $inhalt[1][$key];
|
$columnName = $inhalt[1][$key];
|
||||||
// If the field is not restricted, then continue
|
// If the field is not restricted, then continue
|
||||||
if (!isset($fieldsWithAllowedValueSet[$columnName])) continue;
|
if (!isset($fieldsWithAllowedValueSet[$columnName])) continue;
|
||||||
|
|
||||||
// For others: check if the value is from the list of allowed values.
|
// For others: check if the value is from the list of allowed values.
|
||||||
if (!in_array($value, $fieldsWithAllowedValueSet[$columnName])) {
|
if (!in_array($value, $fieldsWithAllowedValueSet[$columnName])) {
|
||||||
$errormessage[] = "Disallowed value in column <code>{$columnName}</code> on row <code>{$i}</code>: <em>" . $value . "</em> (allowed values: <small>" . implode(", ", $fieldsWithAllowedValueSet[$columnName]) . "</small>)";
|
$errormessage[] = "Disallowed value in column <code>{$columnName}</code> on row <code>{$i}</code>: <em>" . $value . "</em> (allowed values: <small>" . implode(", ", $fieldsWithAllowedValueSet[$columnName]) . "</small>)";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,8 +354,7 @@ if ($hasanyimage > 0) {
|
||||||
|
|
||||||
if (isset($errormessage) and $errormessage != '') {
|
if (isset($errormessage) and $errormessage != '') {
|
||||||
echo '<b style="color:#990000;">There is not one main image for each object !</b>';
|
echo '<b style="color:#990000;">There is not one main image for each object !</b>';
|
||||||
for ($i = 0; $i < count ($errormessage); $i++)
|
for ($i = 0; $i < count($errormessage); $i++) {
|
||||||
{
|
|
||||||
echo '<br>' . $errormessage[$i];
|
echo '<br>' . $errormessage[$i];
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
@ -364,8 +363,7 @@ if ($hasanyimage > 0) {
|
||||||
echo '<i style="font-style:normal;color:#009900;">For each object that has images attached exactly one main image is given !</i>';
|
echo '<i style="font-style:normal;color:#009900;">For each object that has images attached exactly one main image is given !</i>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
echo '<i style="font-style:normal;color:#009900;">No images to be imported !</i>';
|
echo '<i style="font-style:normal;color:#009900;">No images to be imported !</i>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,6 +373,5 @@ if ($error + $depcon_error > 0) {
|
||||||
<p>Error(s) found: ' . ($error + $depcon_error) . '</p>';
|
<p>Error(s) found: ' . ($error + $depcon_error) . '</p>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo '<a href="index5.php?fnam=' . $_GET['fnam'] . '"><img src="img/go.gif"> Create XML for md:import (iso 8859-1)</a><br>';
|
echo '<a href="index6.php?fnam=' . htmlspecialchars($_GET['fnam']) . '" class="buttonLike">Create XML for md:import (utf8)</a><br>';
|
||||||
echo '<a href="index6.php?fnam=' . $_GET['fnam'] . '"><img src="img/go.gif"> Create XML for md:import (utf8)</a><br>';
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
<?php
|
|
||||||
ob_start();
|
|
||||||
require_once 'inc/zeichen.php';
|
|
||||||
$filename = $_GET['fnam'];
|
|
||||||
$csv_datei = 'csv/' . $filename;
|
|
||||||
|
|
||||||
mkdir("xml", 0777);
|
|
||||||
$fp = fopen ( $csv_datei, 'r' );
|
|
||||||
$y = 0;
|
|
||||||
while ( $zeile = fgetcsv ( $fp, 100000, ';' ) )
|
|
||||||
{
|
|
||||||
$y++;
|
|
||||||
//echo '<b>Zeile='.$y.' Anzahl in Zeile: '.count ( $zeile ).'</b><br>';
|
|
||||||
$zieldatei = 'xml/' . $y . '.xml';
|
|
||||||
if (!$handle = fopen($zieldatei, 'w')) {
|
|
||||||
echo "Cannot open file ($zieldatei)";exit;
|
|
||||||
}
|
|
||||||
$somecontent = '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n"; // normal
|
|
||||||
$somecontent = $somecontent . '<record>' . "\n";
|
|
||||||
|
|
||||||
for ($x = 0; $x < count ( $zeile ); $x++)
|
|
||||||
{
|
|
||||||
$inhalt[$y][$x] = $zeile[$x];
|
|
||||||
//echo '<b>'.$inhalt[1][$x].'</b> --> '.$zeile[$x].'<br>';
|
|
||||||
if ($inhalt[$y][$x] == '') $inhalt[$y][$x] = 'ERSATZ';
|
|
||||||
//$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.utf8_decode(transform($inhalt[$y][$x])).'</'.tagify(transform($inhalt[1][$x])).'>'."\n"; // für utf8
|
|
||||||
//$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.(($inhalt[$y][$x])).'</'.tagify(transform($inhalt[1][$x])).'>'."\n"; //für ungarn sonst weg //////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
$somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . transform($inhalt[$y][$x]) . '</' . tagify(transform($inhalt[1][$x])) . '>' . "\n"; //normaleinstellung
|
|
||||||
}
|
|
||||||
$somecontent = $somecontent . '</record>';
|
|
||||||
//if ($y>1)
|
|
||||||
//{
|
|
||||||
if (fwrite($handle, $somecontent) === FALSE) {
|
|
||||||
echo "Cannot write to file ($filename)";exit;
|
|
||||||
}
|
|
||||||
// echo "Success, wrote to file ($filename)<br><br>";
|
|
||||||
//}
|
|
||||||
fclose($handle);
|
|
||||||
}
|
|
||||||
fclose($fp);
|
|
||||||
echo ($y - 1) . ' files created';
|
|
||||||
echo '<br><a href="zipit.php"><img src="img/go.gif"> Download as zip</a>';
|
|
|
@ -40,7 +40,7 @@ mkdir("xml", 0755);
|
||||||
$fp = fopen ( $csv_datei, 'r' );
|
$fp = fopen ( $csv_datei, 'r' );
|
||||||
$y = 0;
|
$y = 0;
|
||||||
while ($zeile = fgetcsv($fp, 100000, ';')) {
|
while ($zeile = fgetcsv($fp, 100000, ';')) {
|
||||||
|
|
||||||
$y++;
|
$y++;
|
||||||
$zieldatei = 'xml/' . $y . '.xml';
|
$zieldatei = 'xml/' . $y . '.xml';
|
||||||
if (!$handle = fopen($zieldatei, 'w')) {
|
if (!$handle = fopen($zieldatei, 'w')) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ mkdir("xml", 0755);
|
||||||
$fp = fopen ($csv_datei, 'r');
|
$fp = fopen ($csv_datei, 'r');
|
||||||
$y = 0;
|
$y = 0;
|
||||||
while ($zeile = fgetcsv($fp, 100000, ';')) {
|
while ($zeile = fgetcsv($fp, 100000, ';')) {
|
||||||
|
|
||||||
$y++;
|
$y++;
|
||||||
$zieldatei = 'xml/' . $y . '.xml';
|
$zieldatei = 'xml/' . $y . '.xml';
|
||||||
if (!$handle = fopen($zieldatei, 'w')) {
|
if (!$handle = fopen($zieldatei, 'w')) {
|
||||||
|
@ -58,7 +58,7 @@ while ($zeile = fgetcsv($fp, 100000, ';')) {
|
||||||
echo "Cannot write to file ($filename)";exit;
|
echo "Cannot write to file ($filename)";exit;
|
||||||
}
|
}
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
|
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
|
|
16
index5.php
16
index5.php
|
@ -1,16 +0,0 @@
|
||||||
<?PHP
|
|
||||||
echo '<link rel="stylesheet" type="text/css" href="css/main.css">';
|
|
||||||
echo '<div class="title">';
|
|
||||||
echo 'museum-digital CSV to XML converter';
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div class="maincontent">';
|
|
||||||
$semikoma = $_GET['semikoma'];
|
|
||||||
echo '<table border="0" cellpadding="0" cellspacing="0" summary="" width="100%">';
|
|
||||||
echo '<tr>';
|
|
||||||
echo '<td width="50%">';
|
|
||||||
echo 'Please wait ... (transforming)<hr>';
|
|
||||||
require 'csv_laden.php';
|
|
||||||
echo '</td>';
|
|
||||||
echo '</tr>';
|
|
||||||
echo '</table>';
|
|
||||||
echo '</div>';
|
|
Loading…
Reference in New Issue
Block a user