csvxml/csv_check.php

673 lines
68 KiB
PHP
Raw Normal View History

2019-08-25 21:45:52 +02:00
<?PHP
ob_start();
error_reporting(E_ALL);
2019-08-27 00:31:46 +02:00
ini_set('display_errors', 1);
2019-08-25 21:45:52 +02:00
2019-08-27 00:31:46 +02:00
require 'inc/zeichen.php';
$filename = $_GET['fnam'];
$csv_datei = 'csv/' . $filename;
2019-08-25 21:45:52 +02:00
2019-08-27 00:31:46 +02:00
$allowed = array("institution_name", 'collection_name1', 'collection_name2', 'inventory_number', 'object_type', 'object_title', 'object_description', 'object_material_technique', 'object_dimensions', 'object_publication', 'object_other_title', 'object_other_title_kind_of', 'detailed_description', 'detailed_description_md', 'detailed_description_extern', 'inscription', 'inscription_md', 'inscription_extern', 'material_separate', 'technique_separate', 'dimensions_separate_length_value', 'dimensions_separate_length_unit', 'dimensions_separate_width_value', 'dimensions_separate_width_unit', 'dimensions_separate_height_value', 'dimensions_separate_height_unit', 'dimensions_separate_weight_value', 'dimensions_separate_weight_unit', 'dimensions_separate_diameter_value', 'dimensions_separate_diameter_unit', 'dimensions_separate_wall_thickness_value', 'dimensions_separate_wall_thickness_unit', 'dimensions_separate_show_md', 'dimensions_separate_show_extern', 'number_of_pieces', 'number_of_pages', 'comparable_objects_other_museums', 'comparable_objects_other_museums_show_md', 'comparable_objects_other_museums_show_extern', 'other_object_title', 'other_object_title_in', 'closer_location', 'closer_location_as', 'entry_number', 'other_inventory_number', 'subject_group', 'systematic', 'bundle', 'part_of', 'inclusion_when', 'inclusion_kind_of', 'bought_for', 'bought_for_currency', 'inclusion_who', 'inclusion_where', 'registration_first_who', 'registration_first_when', 'owner_previous', 'object_history', 'worth_determiner', 'worth_when', 'worth_value', 'worth_unit', 'worth_incurance_determiner', 'worth_incurance_when', 'worth_insurance_value', 'worth_insurance_unit', 'state', 'restauration', 'abode_actual', 'abode_regular', 'exhibition', 'on_loan_to', 'on_loan_contact', 'on_loan_when', 'on_loan_insurance_value', 'on_loan_annotation', 'copyright', 'rights_of_use', 'rights_annotation', 'remarks_short', 'remarks_long', 'images_in_museum', 'documents_in_museum', 'link_url1', 'link_show1', 'link_url2', 'link_show2', 'literature_author1', 'literature_year1', 'literature_title1', 'literature_place1', 'literature_abbreviation1', 'literature_gnd1', 'literature_isbn1', 'literature_signature1', 'literature_online1', 'literature_annotation1', 'literature_inlit1', 'literature_author2', 'literature_year2', 'literature_title2', 'literature_place2', 'literature_abbreviation2', 'literature_gnd2', 'literature_isbn2', 'literature_signature2', 'literature_online2', 'literature_annotation2', 'literature_inlit2', 'literature_author3', 'literature_year3', 'literature_title3', 'literature_place3', 'literature_abbreviation3', 'literature_gnd3', 'literature_isbn3', 'literature_signature3', 'literature_online3', 'literature_annotation3', 'literature_inlit3', 'object_group_name1', 'object_group_description1', 'object_group_show1', 'object_group_name2', 'object_group_description2', 'object_group_show2', 'object_group_name3', 'object_group_description3', 'object_group_show3', 'object_group_name4', 'object_group_description4', 'object_group_show4', 'object_group_name5', 'object_group_description5', 'object_group_show5', 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6', 'tag7', 'tag8', 'tag9', 'tag10', 'image_name1', 'image_description1', 'image_owner1', 'image_creator1', 'image_rights1', 'image_visible1', 'image_main1', 'image_name2', 'image_description2', 'image_owner2', 'image_creator2', 'image_rights2', 'image_visible2', 'image_main2', 'image_name3', 'image_description3', 'image_owner3', 'image_creator3', 'image_rights3', 'image_visible3', 'image_main3', 'image_name4', 'image_description4', 'image_owner4', 'image_creator4', 'image_rights4', 'image_visible4', 'image_main4', 'image_name5', 'image_description5', 'image_owner5', 'image_creator5', 'image_rights5', 'image_visible5', 'image_main5', 'image_name6', 'image_description6', 'image_owner6', 'image_creator6', 'image_rights6', 'image_visible6', 'image_main6', 'image_name7', 'image_description7', 'image_owner7', 'image_creator7', 'image_rights7', 'image_visible7', 'image_main7', 'image_name8', 'image_description8',
$allowed_object_other_title_kind_of = array('object_other_title_kind_of', 'Wissenschaft', 'Alltagssprache', 'Umgangssprache', 'Dialekt', 'Tudományos', 'Köznyelvi', 'Nyelvjárás');
$allowed_other_object_title_in = array('other_object_title_in', 'Wissenschaft', 'Alltagssprache', 'Umgangssprache', 'Dialekt', 'Tudományos', 'Köznyelvi', 'Nyelvjárás');
$allowed_closer_location_as = array('closer_location_as', 'Aufnahmeort', 'Fundort', 'Früherer Ort', 'Felvétel késztésének helye','Lelőhely', 'Történelmi elnevezés');
$allowed_inclusion_kind_of = array('inclusion_kind_of', 'Schenkung', 'Kauf', 'Grabung', 'Notbergung', 'Erbschaft', 'Stiftung', 'Enteignung', 'Ursprungsbestand', 'Ajándékozás','Vétel','Feltárás','Hivatalos átadás','Csere','Gyűjtés','Saját előállítás','Törzsanyag','Letét', 'endowment', 'dispossession', 'old stock', '');
$allowed_currency = array('bought_for_currency', 'worth_unit', 'worth_insurance_unit', 'DM', 'Euro', 'Forint', 'Lari', 'Mark', 'Pengő', 'Real', 'RM', 'Rupiah', 'Złoty','US-Dollar');
$allowed_measurements = array('dimensions_separate_length_unit', 'dimensions_separate_width_unit', 'dimensions_separate_height_unit', 'dimensions_separate_diameter_unit', 'dimensions_separate_wall_thickness_unit
2019-08-25 21:45:52 +02:00
', 'm', 'dm', 'cm', 'mm');
2019-08-27 00:31:46 +02:00
$allowed_weight = array('dimensions_separate_weight_unit', 't', 'kg', 'g');
$allowed_yesno = array('detailed_description_md', 'detailed_description_extern', 'inscription_md', 'inscription_extern', 'dimensions_separate_show_md', 'dimensions_separate_show_extern', 'object_group_show1', 'object_group_show2', 'object_group_show3', 'object_group_show4', 'object_group_show5', 'image_visible1', 'image_visible2', 'image_visible3', 'image_visible4', 'image_visible5', 'image_visible6', 'image_visible7', 'image_visible8', 'image_visible9', 'image_visible10', 'image_visible11', 'image_visible12', 'image_visible13', 'image_visible14', 'image_visible15', 'image_visible16', 'image_visible17', 'image_visible18', 'image_visible19', 'image_visible20', 'image_visible21', 'image_visible22', 'image_visible23', 'image_visible24', 'image_visible25', 'image_visible26', 'image_visible27', 'image_visible28', 'image_main1', 'image_main2', 'image_main3', 'image_main4', 'image_main5', 'image_main6', 'image_main7', 'image_main8', 'image_main9', 'image_main10', 'image_main11', 'image_main12', 'image_main13', 'image_main14', 'image_main15', 'image_main16', 'image_main17', 'image_main18', 'image_main19', 'image_main20', 'image_main21', 'image_main22', 'image_main23', 'image_main24', 'image_main25', 'image_main26', 'image_main27', 'image_main28','y', 'n');
$eventpart = array('production_when1','production_who1','production_where1','production_when2','production_who2','production_where2','finding_when1','finding_who1','finding_where1','finding_when2','finding_who2','finding_where2','publication_when1','publication_who1','publication_where1','publication_when2','publication_who2','publication_where2','template_creation_when1','template_creation_who1','template_creation_where1','template_creation_when2','template_creation_who2','template_creation_where2','was_depicted_who1','was_depicted_who2','was_depicted_who3','was_depicted_who4','was_depicted_who5','was_depicted_who6','was_depicted_who7','was_depicted_place1','was_depicted_place2','was_depicted_place3','was_depicted_place4','was_used_when1','was_used_who1','was_used_where1','was_used_when2','was_used_who2','was_used_where2','written_when1','written_who1','written_where1','written_when2','written_who2','written_where2','collected_when1','collected_who1','collected_where1','collected_when2','collected_who2','collected_where2','painted_when1','painted_who1','painted_where1','painted_when2','painted_who2','painted_where2','taken_when1','taken_who1','taken_where1','taken_when2','taken_who2','taken_where2','received_when1','received_who1','received_where1','received_when2','received_who2','received_where2','printing_plate_produced_when1','printing_plate_produced_who1','printing_plate_produced_where1','printing_plate_produced_when2','printing_plate_produced_who2','printing_plate_produced_where2','sent_when1','sent_who1','sent_where1','sent_when2','sent_who2','sent_where2','issued_when1','issued_who1','issued_where1','issued_when2','issued_who2','issued_where2','signed_when1','signed_who1','signed_where1','signed_when2','signed_who2','signed_where2','type_described_when1','type_described_who1','type_described_where1','type_described_when2','type_described_who2','type_described_where2','drawn_when1','drawn_who1','drawn_where1','drawn_when2','drawn_who2','drawn_where2','copied_when1','copied_who1','copied_where1','copied_when2','copied_who2','copied_where2','has_lived_when1','has_lived_where1','has_lived_when2','has_lived_where2','related_place1','related_place2','related_place3','related_place4','related_place5','related_place6','related_place7','related_place8','related_place9','related_actor1','related_actor2','related_actor3','related_actor4','related_actor5','related_time1','related_time2','commissioned_when1','commissioned_who1','commissioned_where1','commissioned_when2','commissioned_who2','commissioned_where2','printed_when1','printed_who1','printed_where1','printed_when2','printed_who2','printed_where2','spoken_when1','spoken_who1','spoken_where1','spoken_when2','spoken_who2','spoken_where2','sung_when1','sung_who1','sung_where1','sung_when2','sung_who2','sung_where2','decor_designed_when1','decor_designed_who1','decor_designed_where1','decor_designed_when2','decor_designed_who2','decor_designed_where2','form_designed_when1','form_designed_who1','form_designed_where1','form_designed_when2','form_designed_who2','form_designed_where2','modelled_when1','modelled_who1','modelled_where1','modelled_when2','modelled_who2','modelled_where2','signed_when1','signed_who1','signed_where1','signed_when2','signed_who2','signed_where2','was_mentioned_when1','was_mentioned_who1','was_mentioned_where1','was_mentioned_when2','was_mentioned_who2','was_mentioned_where2','buried_when1','buried_who1','buried_where1','buried_when2','buried_who2','buried_where2','intellectual_creation_when1','intellectual_creation_who1','intellectual_creation_where1','intellectual_creation_when2','intellectual_creation_who2','intellectual_creation_where2','painted_on_when1','painted_on_who1','painted_on_where1','painted_on_when2','painted_on_who2','painted_on_where2','illustrated_when1','illustrated_who1','illustrated_where1','illustrated_when2','illustrated_who2','illustrated_where2');
$eventpartsure = array('production_when_sure1','production_who_sure1','production_where_sure1','production_when_sure2','production_who_sure2','production_where_sure2','finding_when_sure1','finding_who_sure1','finding_where_sure1','finding_when_sure2','finding_who_sure2','finding_where_sure2','publication_when_sure1','publication_who_sure1','publication_where_sure1','publication_when_sure2','publication_who_sure2','publication_where_sure2','template_creation_when_sure1','template_creation_who_sure1','template_creation_where_sure1','template_creation_when_sure2','template_creation_who_sure2','template_creation_where_sure2','was_depicted_who_sure1','was_depicted_who_sure2','was_depicted_who_sure3','was_depicted_who_sure4','was_depicted_who_sure5','was_depicted_who_sure6','was_depicted_who_sure7','was_depicted_place_sure1','was_depicted_place_sure2','was_depicted_place_sure3','was_depicted_place_sure4','was_used_when_sure1','was_used_who_sure1','was_used_where_sure1','was_used_when_sure2','was_used_who_sure2','was_used_where_sure2','written_when_sure1','written_who_sure1','written_where_sure1','written_when_sure2','written_who_sure2','written_where_sure2','collected_when_sure1','collected_who_sure1','collected_where_sure1','collected_when_sure2','collected_who_sure2','collected_where_sure2','painted_when_sure1','painted_who_sure1','painted_where_sure1','painted_when_sure2','painted_who_sure2','painted_where_sure2','taken_when_sure1','taken_who_sure1','taken_where_sure1','taken_when_sure2','taken_who_sure2','taken_where_sure2','received_when_sure1','received_who_sure1','received_where_sure1','received_when_sure2','received_who_sure2','received_where_sure2','printing_plate_produced_when_sure1','printing_plate_produced_who_sure1','printing_plate_produced_where_sure1','printing_plate_produced_when_sure2','printing_plate_produced_who_sure2','printing_plate_produced_where_sure2','sent_when_sure1','sent_who_sure1','sent_where_sure1','sent_when_sure2','sent_who_sure2','sent_where_sure2','issued_when_sure1','issued_who_sure1','issued_where_sure1','issued_when_sure2','issued_who_sure2','issued_where_sure2','signed_when_sure1','signed_who_sure1','signed_where_sure1','signed_when_sure2','signed_who_sure2','signed_where_sure2','type_described_when_sure1','type_described_who_sure1','type_described_where_sure1','type_described_when_sure2','type_described_who_sure2','type_described_where_sure2','drawn_when_sure1','drawn_who_sure1','drawn_where_sure1','drawn_when_sure2','drawn_who_sure2','drawn_where_sure2','copied_when_sure1','copied_who_sure1','copied_where_sure1','copied_when_sure2','copied_who_sure2','copied_where_sure2','has_lived_when_sure1','has_lived_where_sure1','has_lived_when_sure2','has_lived_where_sure2','related_place_sure1','related_place_sure2','related_place_sure3','related_place_sure4','related_place_sure5','related_place_sure6','related_place_sure7','related_place_sure8','related_place_sure9','related_actor_sure1','related_actor_sure2','related_actor_sure3','related_actor_sure4','related_actor_sure5','related_time_sure1','related_time_sure2','commissioned_when_sure1','commissioned_who_sure1','commissioned_where_sure1','commissioned_when_sure2','commissioned_who_sure2','commissioned_where_sure2','printed_when_sure1','printed_who_sure1','printed_where_sure1','printed_when_sure2','printed_who_sure2','printed_where_sure2','spoken_when_sure1','spoken_who_sure1','spoken_where_sure1','spoken_when_sure2','spoken_who_sure2','spoken_where_sure2','sung_when_sure1','sung_who_sure1','sung_where_sure1','sung_when_sure2','sung_who_sure2','sung_where_sure2','decor_designed_when_sure1','decor_designed_who_sure1','decor_designed_where_sure1','decor_designed_when_sure2','decor_designed_who_sure2','decor_designed_where_sure2','form_designed_when_sure1','form_designed_who_sure1','form_designed_where_sure1','form_designed_when_sure2','form_designed_who_sure2','form_designed_where_sure2','modelled_when_sure1','modelled_who_sure1','modelled_where_sure1','modelled_when_sure2','modelled_who_sure2','modelled_where_sure2','signed_when_sure1','signed
$crosscheck1 = array('object_other_title','detailed_description','detailed_description','inscription','inscription','dimensions_separate_length_value', 'dimensions_separate_width_value', 'dimensions_separate_height_value', 'dimensions_separate_diameter_value', 'dimensions_separate_wall_thickness_value', 'dimensions_separate_weight_value','closer_location','bought_for','worth_value','worth_insurance_value');
$crosscheck2 = array('object_other_title_kind_of','detailed_description_md','detailed_description_extern','inscription_md','inscription_extern','dimensions_separate_length_unit', 'dimensions_separate_width_unit', 'dimensions_separate_height_unit', 'dimensions_separate_diameter_unit', 'dimensions_separate_wall_thickness_unit', 'dimensions_separate_weight_unit','closer_location_as','bought_for_currency','worth_unit','worth_insurance_unit');
$allowed_image_rights = array('CC BY-NC-SA', 'CC BY-NC-ND', ' CC BY-NC', 'CC BY-ND', 'CC BY-SA', 'CC BY', 'CC0', 'RR-F', 'RR-P', 'RR-R', 'Orphan Work', 'Public Domain Mark');
2019-08-25 21:45:52 +02:00
///// Check #1
//echo '<pre>';print_r($allowed);echo '</pre>';
echo '1: Only allowed tags (column names) used?';
$fp = fopen ( $csv_datei, 'r' );
$y = 1;
2019-08-27 00:31:46 +02:00
$error = 0;
2019-08-25 21:45:52 +02:00
$zeile = fgetcsv ( $fp, 100000, ';' );
2019-08-27 00:31:46 +02:00
for ($x = 0; $x < count ( $zeile ); $x++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
$zeile[$x] = str_replace("\xEF\xBB\xBF", "", $zeile[$x]);
$inhalt[$y][$x] = $zeile[$x];
if (!in_array($inhalt[1][$x], $allowed)) {
echo '<br><i style="font-style:normal;color:#990000;">ERROR in column ' . $x . ' created by value: ' . $inhalt[1][$x] . '</i>';
$error = $error + 1;
}
//echo '<br/>';var_dump($inhalt[1][$x]);
2019-08-25 21:45:52 +02:00
}
fclose($fp);
$erstezeile = $zeile;
if ($error != 0) echo '<br><b style="color:#990000;">Not allowed tags found !</b>'; else echo '<br><i style="font-style:normal;color:#009900;">Only allowed tags used !</i>';
//// Check #2
echo '<br><br>2: Not allowed multiple use of tags (column names)?';
2019-08-27 00:31:46 +02:00
$compare = array_unique($zeile);
function identical_values($arrayA, $arrayB)
2019-08-25 21:45:52 +02:00
{
sort( $arrayA );
sort( $arrayB );
return $arrayA == $arrayB;
2019-08-27 00:31:46 +02:00
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
$result = identical_values($zeile, $compare);
if ($result == false) {
echo '<br><b style="color:#990000;">There are dublicate column names !</b>';
$error = $error + 1;
2019-08-25 21:45:52 +02:00
}
else
{
2019-08-27 00:31:46 +02:00
echo '<br><i style="font-style:normal;color:#009900;">No dublicate column names !</i>';
2019-08-25 21:45:52 +02:00
}
//// Get values into memory for following checks
$fp = fopen ( $csv_datei, 'r' );
2019-08-27 00:31:46 +02:00
$y = 0;
2019-08-25 21:45:52 +02:00
while ( $zeile = fgetcsv ( $fp, 100000, ';' ) )
{
2019-08-27 00:31:46 +02:00
$y++;
//echo '<br>';print_r($zeile);
for ($x = 0; $x < count ( $zeile ); $x++)
{
$inhalt[$y][$x] = str_replace("'", "\'", $zeile[$x]);
}
2019-08-25 21:45:52 +02:00
}
fclose($fp);
///// Check #3
echo '<br><br>3: Mandatory tags available and always filled in?';
unset($inv_array);
2019-08-27 00:31:46 +02:00
$inv_error = 0;
function get_duplicates($array)
2019-08-25 21:45:52 +02:00
{
return array_unique( array_diff_assoc( $array, array_unique( $array ) ) );
2019-08-27 00:31:46 +02:00
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
$mandatory = array('inventory_number','object_type','object_title','object_description');
for ($i = 0; $i < count ($mandatory); $i++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if (!in_array($mandatory[$i], $erstezeile)) {
echo '<br><i style="font-style:normal;color:#990000;">Mandatory: Column <b>' . $mandatory[$i] . '</b> missing</i>';
$error = $error + 1;
$inv_error = $inv_error + 1;
}
else
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
$spaltenr = array_search($mandatory[$i], $erstezeile);
for ($j = 0; $j < $y; $j++)
{
if ($inhalt[$j + 1][$spaltenr] == '') {
echo '<br><i style="font-style:normal;color:#990000;">Missing value for <b>' . $mandatory[$i] . '</b> in row ' . ($j + 1) . '</i>';
$error = $error + 1;
$inv_error = $inv_error + 1;
}
if ($mandatory[$i] == 'inventory_number') {
$inv_array[] = $inhalt[$j + 1][$spaltenr];
}
}
2019-08-25 21:45:52 +02:00
}
}
2019-08-27 00:31:46 +02:00
if ($inv_error == 0) echo '<br><i style="font-style:normal;color:#009900;">All mandatory tags available and with values !</i>';
2019-08-25 21:45:52 +02:00
///// Check #4
echo '<br><br>4: Inventory_number unique ?';
2019-08-27 00:31:46 +02:00
if (in_array('inventory_number', $erstezeile)) {
$doppelte_inv = get_duplicates($inv_array);
$doppelte_inv = array_values($doppelte_inv);
if (count($doppelte_inv) > 0) {
for ($i = 0; $i < count($doppelte_inv); $i++)
{
echo '<br><i style="font-style:normal;color:#990000;">Multiple use of inventory_number <b>' . $doppelte_inv[$i] . '</b></i>';
$error = $error + 1;
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
else echo '<br><i style="font-style:normal;color:#009900;">All inventory_numbers are unique !</i>';
2019-08-25 21:45:52 +02:00
}
else
{
2019-08-27 00:31:46 +02:00
echo '<br><b style="font-style:normal;color:#990000;">Aborted, column inventory_number is missing</b>';
$error = $error + 1;
2019-08-25 21:45:52 +02:00
}
///// Check #5
echo '<br><br>5: Dependent colums observed ?<br>';
2019-08-27 00:31:46 +02:00
if (array_search('object_other_title', $erstezeile) !== false) {
if (array_search('object_other_title_kind_of', $erstezeile) === false) {
$depencymessage[] = 'One column of object_other_title, object_other_title_kind_of is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('object_other_title_kind_of', $erstezeile) !== false) {
if (array_search('object_other_title', $erstezeile) === false) {
$depencymessage[] = 'One column of object_other_title, object_other_title_kind_of is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('other_object_title', $erstezeile) !== false) {
if (array_search('other_object_title_in', $erstezeile) === false) {
$depencymessage[] = 'One column of other_object_title, other_object_title_in is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('other_object_title_in', $erstezeile) !== false) {
if (array_search('other_object_title', $erstezeile) === false) {
$depencymessage[] = 'One column of other_object_title, other_object_title_in is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('detailed_description', $erstezeile) !== false) {
if (array_search('detailed_description_md', $erstezeile) === false or array_search('detailed_description_extern', $erstezeile) === false) {
$depencymessage[] = 'One column of detailed_description, detailed_description_md, detailed_description_extern is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('detailed_description_md', $erstezeile) !== false) {
if (array_search('detailed_description', $erstezeile) === false or array_search('detailed_description_extern', $erstezeile) === false) {
$depencymessage[] = 'One column of detailed_description, detailed_description_md, detailed_description_extern is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('detailed_description_extern', $erstezeile) !== false) {
if (array_search('detailed_description', $erstezeile) === false or array_search('detailed_description_md', $erstezeile) === false) {
$depencymessage[] = 'One column of detailed_description, detailed_description_md, detailed_description_extern is missing';
}
2019-08-25 21:45:52 +02:00
}
// dependency of colums: inscription. If one of inscription or inscription_md or inscription_extern is given - all three are necessary
2019-08-27 00:31:46 +02:00
if (array_search('inscription', $erstezeile) !== false) {
if (array_search('inscription_md', $erstezeile) === false or array_search('inscription_extern', $erstezeile) === false) {
$depencymessage[] = 'One column of inscription, inscription_md, inscription_extern is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('inscription_md', $erstezeile) !== false) {
if (array_search('inscription', $erstezeile) === false or array_search('inscription_extern', $erstezeile) === false) {
$depencymessage[] = 'One column of inscription, inscription_md, inscription_extern is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('inscription_extern', $erstezeile) !== false) {
if (array_search('inscription', $erstezeile) === false or array_search('inscription_md', $erstezeile) === false) {
$depencymessage[] = 'One column of inscription, inscription_md, inscription_extern is missing';
}
2019-08-25 21:45:52 +02:00
}
// dependency of colums: object_group1 to 5. If one of object_group_name1 or object_group_description1 or object_group_show1 is given - all three are necessary
2019-08-27 00:31:46 +02:00
for ($og = 1; $og < 6; $og++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if (array_search('object_group_name' . $og, $erstezeile) !== false) {
if (array_search('object_group_description' . $og, $erstezeile) === false or array_search('object_group_show' . $og, $erstezeile) === false) {
$depencymessage[] = 'One column of object_group_name' . $og . ', object_group_description' . $og . ', object_group_show' . $og . ' is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('object_group_description' . $og, $erstezeile) !== false) {
if (array_search('object_group_name' . $og, $erstezeile) === false or array_search('object_group_show' . $og, $erstezeile) === false) {
$depencymessage[] = 'One column of object_group_name' . $og . ', object_group_description' . $og . ', object_group_show' . $og . ' is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('object_group_show' . $og, $erstezeile) !== false) {
if (array_search('object_group_name' . $og, $erstezeile) === false or array_search('object_group_description' . $og, $erstezeile) === false) {
$depencymessage[] = 'One column of object_group_name' . $og . ', object_group_description' . $og . ', object_group_show' . $og . ' is missing';
}
2019-08-25 21:45:52 +02:00
}
}
// dependency of colums: images. If one of image_name1 or image_rights1 or image_visible1 is given - all three are necessary
2019-08-27 00:31:46 +02:00
for ($im = 1; $im < 29; $im++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if (array_search('image_name' . $im, $erstezeile) !== false) {
if (array_search('image_rights' . $im, $erstezeile) === false or array_search('image_visible' . $im, $erstezeile) === false or array_search('image_main' . $im, $erstezeile) === false) {
$depencymessage[] = 'One column of image_name' . $im . ', image_rights' . $im . ', image_visible' . $im . ', image_main' . $im . ' is missing';
}
}
if (array_search('image_rights' . $im, $erstezeile) !== false) {
if (array_search('image_name' . $im, $erstezeile) === false or array_search('image_visible' . $im, $erstezeile) === false or array_search('image_main' . $im, $erstezeile) === false) {
$depencymessage[] = 'One column of image_name' . $im . ', image_rights' . $im . ', image_visible' . $im . ', image_main' . $im . ' is missing';
}
}
if (array_search('image_visible' . $im, $erstezeile) !== false) {
if (array_search('image_name' . $im, $erstezeile) === false or array_search('image_rights' . $im, $erstezeile) === false or array_search('image_main' . $im, $erstezeile) === false) {
$depencymessage[] = 'One column of image_name' . $im . ', image_rights' . $im . ', image_visible' . $im . ', image_main' . $im . ' is missing';
}
}
if (array_search('image_main' . $im, $erstezeile) !== false) {
if (array_search('image_name' . $im, $erstezeile) === false or array_search('image_rights' . $im, $erstezeile) === false or array_search('image_visible' . $im, $erstezeile) === false) {
$depencymessage[] = 'One column of image_name' . $im . ', image_rights' . $im . ', image_visible' . $im . ', image_main' . $im . ' is missing';
}
2019-08-25 21:45:52 +02:00
}
}
// dependency of colums: comparable_objects_other_museums. If one of comparable_objects_other_museums or comparable_objects_other_museums_show_md or comparable_objects_other_museums_show_extern is given - all three are necessary
2019-08-27 00:31:46 +02:00
if (array_search('comparable_objects_other_museums', $erstezeile) !== false) {
if (array_search('comparable_objects_other_museums_show_md', $erstezeile) === false or array_search('comparable_objects_other_museums_show_extern', $erstezeile) === false) {
$depencymessage[] = 'One column of comparable_objects_other_museums, comparable_objects_other_museums_show_md, comparable_objects_other_museums_show_extern is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('comparable_objects_other_museums_show_md', $erstezeile) !== false) {
if (array_search('comparable_objects_other_museums', $erstezeile) === false or array_search('comparable_objects_other_museums_show_extern', $erstezeile) === false) {
$depencymessage[] = 'One column of comparable_objects_other_museums, comparable_objects_other_museums_show_md, comparable_objects_other_museums_show_extern is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('comparable_objects_other_museums_show_extern', $erstezeile) !== false) {
if (array_search('comparable_objects_other_museums', $erstezeile) === false or array_search('comparable_objects_other_museums_show_md', $erstezeile) === false) {
$depencymessage[] = 'One column of comparable_objects_other_museums, comparable_objects_other_museums_show_md, comparable_objects_other_museums_show_extern is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_length_value', $erstezeile) !== false) {
if (array_search('dimensions_separate_length_unit', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_length_value, dimensions_separate_length_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_length_unit', $erstezeile) !== false) {
if (array_search('dimensions_separate_length_value', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_length_value, dimensions_separate_length_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_width_value', $erstezeile) !== false) {
if (array_search('dimensions_separate_width_unit', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_width_value, dimensions_separate_width_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_width_unit', $erstezeile) !== false) {
if (array_search('dimensions_separate_width_value', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_width_value, dimensions_separate_width_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_height_value', $erstezeile) !== false) {
if (array_search('dimensions_separate_height_unit', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_height_value, dimensions_separate_height_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_height_unit', $erstezeile) !== false) {
if (array_search('dimensions_separate_height_value', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_height_value, dimensions_separate_height_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_diameter_value', $erstezeile) !== false) {
if (array_search('dimensions_separate_diameter_unit', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_diameter_value, dimensions_separate_diameter_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_diameter_unit', $erstezeile) !== false) {
if (array_search('dimensions_separate_diameter_value', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_diameter_value, dimensions_separate_diameter_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_wall_thickness_value', $erstezeile) !== false) {
if (array_search('dimensions_separate_wall_thickness_unit', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_wall_thickness_value, dimensions_separate_wall_thickness_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_wall_thickness_unit', $erstezeile) !== false) {
if (array_search('dimensions_separate_wall_thickness_value', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_wall_thickness_value, dimensions_separate_wall_thickness_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_weight_value', $erstezeile) !== false) {
if (array_search('dimensions_separate_weight_unit', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_weight_value, dimensions_separate_weight_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('dimensions_separate_weight_unit', $erstezeile) !== false) {
if (array_search('dimensions_separate_weight_value', $erstezeile) === false) {
$depencymessage[] = 'One column of dimensions_separate_weight_value, dimensions_separate_weight_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('closer_location', $erstezeile) !== false) {
if (array_search('closer_location_as', $erstezeile) === false) {
$depencymessage[] = 'One column of closer_location, closer_location_as is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('closer_location_as', $erstezeile) !== false) {
if (array_search('closer_location', $erstezeile) === false) {
$depencymessage[] = 'One column of closer_location, closer_location_as is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('bought_for', $erstezeile) !== false) {
if (array_search('bought_for_currency', $erstezeile) === false) {
$depencymessage[] = 'One column of bought_for, bought_for_currency is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('bought_for_currency', $erstezeile) !== false) {
if (array_search('bought_for', $erstezeile) === false) {
$depencymessage[] = 'One column of bought_for, bought_for_currency is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('worth_value', $erstezeile) !== false) {
if (array_search('worth_unit', $erstezeile) === false) {
$depencymessage[] = 'One column of worth_value, worth_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('worth_unit', $erstezeile) !== false) {
if (array_search('worth_value', $erstezeile) === false) {
$depencymessage[] = 'One column of worth_value, worth_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('worth_insurance_value', $erstezeile) !== false) {
if (array_search('worth_insurance_unit', $erstezeile) === false) {
$depencymessage[] = 'One column of worth_insurance_value, worth_insurance_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('worth_insurance_unit', $erstezeile) !== false) {
if (array_search('worth_insurance_value', $erstezeile) === false) {
$depencymessage[] = 'One column of worth_insurance_value, worth_insurance_unit is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('link_url1', $erstezeile) !== false) {
if (array_search('link_show1', $erstezeile) === false) {
$depencymessage[] = 'One column of link_url1, link_show1 is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('link_show1', $erstezeile) !== false) {
if (array_search('link_url1', $erstezeile) === false) {
$depencymessage[] = 'One column of link_url1, link_show1 is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('link_url2', $erstezeile) !== false) {
if (array_search('link_show2', $erstezeile) === false) {
$depencymessage[] = 'One column of link_url2, link_show2 is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search('link_show2', $erstezeile) !== false) {
if (array_search('link_url2', $erstezeile) === false) {
$depencymessage[] = 'One column of link_url2, link_show2 is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
for ($i = 0; $i < count($eventpart); $i++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if (array_search($eventpart[$i], $erstezeile) !== false) {
if (array_search($eventpartsure[$i], $erstezeile) === false) {
echo $eventpart[$i];
$depencymessage[] = 'One column of ' . $eventpart[$i] . ', ' . $eventpartsure[$i] . ' is missing';
}
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (array_search($eventpartsure[$i], $erstezeile) !== false) {
if (array_search($eventpart[$i], $erstezeile) === false) {
$depencymessage[] = 'One column of ' . $eventpart[$i] . ', ' . $eventpartsure[$i] . ' is missing';
}
2019-08-25 21:45:52 +02:00
}
}
2019-08-27 00:31:46 +02:00
if (isset($depencymessage) and $depencymessage != '') {
echo '<b style="color:#990000;">Dependent columns were not observed !</b>';
for ($i = 0; $i < count ($depencymessage); $i++)
{
echo '<br>' . $depencymessage[$i];
$error = $error + 1;
}
2019-08-25 21:45:52 +02:00
}
else
{
2019-08-27 00:31:46 +02:00
echo '<i style="font-style:normal;color:#009900;">Dependent columns were observed !</i>';
2019-08-25 21:45:52 +02:00
}
///// Check #6
echo '<br><br>6: Dependency of content observed?';
2019-08-27 00:31:46 +02:00
$depcon_error = 0;
for ($l = 0; $l < count($crosscheck1); $l++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if (in_array($crosscheck1[$l], $erstezeile)) {
for ($j = 1; $j < ($y + 1); $j++)
{
if ($inhalt[$j][array_search($crosscheck2[$l], $erstezeile)] !== '' and $inhalt[$j][array_search($crosscheck1[$l], $erstezeile)] == '') {
echo '<br>Tag <b>' . $crosscheck2[$l] . '</b> given but no entry for <b>' . $crosscheck1[$l] . '</b> (row ' . $j . ')';
$depcon_error = $depcon_error + 1;
}
}
2019-08-25 21:45:52 +02:00
}
}
2019-08-27 00:31:46 +02:00
for ($l = 0; $l < count($eventpart); $l++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if (in_array($eventpart[$l], $erstezeile)) {
for ($j = 1; $j < ($y + 1); $j++)
{
if ($inhalt[$j][array_search($eventpartsure[$l], $erstezeile)] !== '' and $inhalt[$j][array_search($eventpart[$l], $erstezeile)] == '') {
echo '<br>Tag <b>' . $eventpartsure[$l] . '</b> given but no entry for <b>' . $eventpart[$l] . '</b> (row ' . $j . ')';
$depcon_error = $depcon_error + 1;
}
}
2019-08-25 21:45:52 +02:00
}
}
2019-08-27 00:31:46 +02:00
if (in_array('dimensions_separate_show_md', $erstezeile)) {
for ($j = 1; $j < ($y + 1); $j++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if ($inhalt[$j][array_search('dimensions_separate_show_md', $erstezeile)] !== '' and ($inhalt[$j][array_search('dimensions_separate_length_value', $erstezeile)] == '') and $inhalt[$j][array_search('dimensions_separate_width_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_heigt_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_weight_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_diameter_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_wall_thickness_value', $erstezeile)] == '') {
echo '<br>Tag <b>dimensions_separate_show_md</b> given but no separate values available (row ' . $j . ')';
$depcon_error = $depcon_error + 1;
}
2019-08-25 21:45:52 +02:00
}
}
2019-08-27 00:31:46 +02:00
if (in_array('dimensions_separate_show_extern', $erstezeile)) {
for ($j = 1; $j < ($y + 1); $j++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if ($inhalt[$j][array_search('dimensions_separate_show_extern', $erstezeile)] !== '' and ($inhalt[$j][array_search('dimensions_separate_length_value', $erstezeile)] == '') and $inhalt[$j][array_search('dimensions_separate_width_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_heigt_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_weight_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_diameter_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_wall_thickness_value', $erstezeile)] == '') {
echo '<br>Tag <b>dimensions_separate_show_extern</b> given but no separate values available (row ' . $j . ')';
$depcon_error = $depcon_error + 1;
}
2019-08-25 21:45:52 +02:00
}
}
/*
for ($im=1;$im<11;$im++)
{
if (in_array('image_name'.$im,$erstezeile))
{
for ($j=1;$j<($y+1);$j++)
{
if ($inhalt[$j][array_search('image_rights'.$im,$erstezeile)]!=='')
{
echo '<br>TAG <b>image_name'.$im.'</b> given but no value available for image_rights'.$im.' (row '.$j.')';
$depcon_error=$depcon_error+1;
}
if ($inhalt[$j][array_search('image_visible'.$im,$erstezeile)]!=='')
{
echo '<br>TAG <b>image_name'.$im.'</b> given but no value available for image_visible'.$im.' (row '.$j.')';
$depcon_error=$depcon_error+1;
}
2019-08-27 00:31:46 +02:00
}
2019-08-25 21:45:52 +02:00
}
}
*/
2019-08-27 00:31:46 +02:00
if ($depcon_error == 0) echo '<br><i style="font-style:normal;color:#009900;">Dependency of content was observed !</i>';
2019-08-25 21:45:52 +02:00
///// Check #7
echo '<br><br>7: Not allowed values in controlled lists?<br>';
2019-08-27 00:31:46 +02:00
for ($i = 1; $i <= $y; $i++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
for ($j = 0; $j < count ($inhalt[$i]); $j++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if ($inhalt[1][$j] == 'object_other_title_kind_of' and !$inhalt[$i][array_search('object_other_title', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_object_other_title_kind_of)) $errormessage[] = 'Not allowed value in column <b>object_other_title_kind_of</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'other_object_title_in' and !$inhalt[$i][array_search('other_object_title', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_other_object_title_in)) $errormessage[] = 'Not allowed value in column <b>other_object_title_in</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'closer_location_as' and !$inhalt[$i][array_search('closer_location', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_closer_location_as)) $errormessage[] = 'Not allowed value in column <b>closer_location_as</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'inclusion_kind_of') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_inclusion_kind_of)) $errormessage[] = 'Not allowed value in column <b>inclusion_kind_of</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'bought_for_currency' and !$inhalt[$i][array_search('bought_for', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_currency)) $errormessage[] = 'Not allowed value in column <b>bought_for_currency</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'worth_unit' and !$inhalt[$i][array_search('worth_value', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_currency)) $errormessage[] = 'Not allowed value in column <b>worth_unit</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'worth_insurance_unit' and !$inhalt[$i][array_search('worth_insurance_value', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_currency)) $errormessage[] = 'Not allowed value in column <b>worth_insurance_unit</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'detailed_description_md' and !$inhalt[$i][array_search('detailed_description', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column <b>detailed_description_md</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'detailed_description_extern' and !$inhalt[$i][array_search('detailed_description', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column <b>detailed_description_extern</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'inscription_md' and !$inhalt[$i][array_search('inscription', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column <b>inscription_md</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'inscription_extern' and !$inhalt[$i][array_search('inscription', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column <b>inscription_extern</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'dimensions_separate_length_unit' and !$inhalt[$i][array_search('dimensions_separate_length_value', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column <b>dimensions_separate_length_unit</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'dimensions_separate_width_unit' and !$inhalt[$i][array_search('dimensions_separate_width_value', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column <b>dimensions_separate_width_unit</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'dimensions_separate_height_unit' and !$inhalt[$i][array_search('dimensions_separate_height_value', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column <b>dimensions_separate_height_unit</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'dimensions_separate_diameter_unit' and !$inhalt[$i][array_search('dimensions_separate_diameter_value', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column <b>dimensions_separate_diameter_unit</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'dimensions_separate_wall_thickness_unit' and !$inhalt[$i][array_search('dimensions_separate_wall_thickness_value', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column <b>dimensions_separate_wall_thickness_unit</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'dimensions_separate_weight_unit' and !$inhalt[$i][array_search('dimensions_separate_weight_value', $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_weight)) $errormessage[] = 'Not allowed value in column <b>dimensions_separate_weight_unit</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'dimensions_separate_show_md') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column <b>dimensions_separate_show_md</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'dimensions_separate_show_extern') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column <b>dimensions_separate_show_extern</b>: ' . $showvalue . ' (row ' . $i . ')';
}
for ($og = 1; $og < 6; $og++)
{
if ($inhalt[1][$j] == 'object_group_show' . $og and !$inhalt[$i][array_search('object_group_name' . $og, $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column <b>object_group_show' . $og . '</b>: ' . $showvalue . ' (row ' . $i . ')';
}
}
for ($im = 1; $im < 29; $im++)
{
if ($inhalt[1][$j] == 'image_visible' . $im and !$inhalt[$i][array_search('image_name' . $im, $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column <b>image_visible' . $im . '</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'image_main' . $im and !$inhalt[$i][array_search('image_name' . $im, $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column <b>image_main' . $im . '</b>: ' . $showvalue . ' (row ' . $i . ')';
}
if ($inhalt[1][$j] == 'image_rights' . $im and !$inhalt[$i][array_search('image_name' . $im, $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_image_rights)) $errormessage[] = 'Not allowed value in column <b>image_rights' . $im . '</b>: ' . $showvalue . ' (row ' . $i . ')';
}
}
for ($k = 0; $k < count($eventpartsure); $k++)
{
if ($inhalt[1][$j] == $eventpartsure[$k] and !$inhalt[$i][array_search($eventpart[$k], $erstezeile)] == '') {
if ($inhalt[$i][$j] != '') $showvalue = '<b style="color:#990000">' . $inhalt[$i][$j] . '</b>'; else $showvalue = '<b style="color:#990000">[empty]</b>';
if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column <b>' . $eventpartsure[$k] . '</b>: ' . $showvalue . ' (row ' . $i . ')';
}
}
2019-08-25 21:45:52 +02:00
}
}
2019-08-27 00:31:46 +02:00
if (isset($errormessage) and $errormessage != '') {
echo '<b style="color:#990000;">Columns with controlled values contain invalid values !</b>';
for ($i = 0; $i < count ($errormessage); $i++)
{
echo '<br>' . $errormessage[$i];
$error = $error + 1;
}
2019-08-25 21:45:52 +02:00
}
else
{
2019-08-27 00:31:46 +02:00
echo '<i style="font-style:normal;color:#009900;">Values in controlled fields are all valid !</i>';
2019-08-25 21:45:52 +02:00
}
///// Check #8
unset($errormessage);
echo '<br><br>8: Main image or main resource given?<br>';
2019-08-27 00:31:46 +02:00
$hasanyimage = 0;
for ($im = 1; $im < 29; $im++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if (array_search('image_name' . $im, $erstezeile) != '') {$imagemain[$im]['name'] = array_search('image_name' . $im, $erstezeile);$hasanyimage++;
}
if (array_search('image_visible' . $im, $erstezeile) != '') $imagemain[$im]['visible'] = array_search('image_visible' . $im, $erstezeile);
if (array_search('image_main' . $im, $erstezeile) != '') $imagemain[$im]['main'] = array_search('image_main' . $im, $erstezeile);
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if ($hasanyimage > 0) {
$imagemain = array_values($imagemain);
for ($i = 1; $i <= $y; $i++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if ($i > 1) {
$maimg[$i] = 0;
2019-08-25 21:45:52 +02:00
//check if in a row any image_name is given
2019-08-27 00:31:46 +02:00
$hatimg[$i] = 0;
for ($im = 0; $im < count($imagemain); $im++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if ($inhalt[$i][$imagemain[$im]['name']] != '') $hatimg[$i]++;
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if ($hatimg[$i] > 0) {
2019-08-25 21:45:52 +02:00
// first check: how many main-images?
2019-08-27 00:31:46 +02:00
for ($im = 0; $im < count($imagemain); $im++)
2019-08-25 21:45:52 +02:00
{
2019-08-27 00:31:46 +02:00
if ($inhalt[$i][$imagemain[$im]['main']] == 'y') {$maimg[$i]++;$merk = $im;
}
2019-08-25 21:45:52 +02:00
}
// if there is exacly one main-image, is it visible?
2019-08-27 00:31:46 +02:00
if ($maimg[$i] == 1) {
if ($inhalt[$i][$imagemain[$merk]['visible']] == 'n') {
$errormessage[] = '<b style="font-weight:normal;color:#990000">Main image in row ' . $i . ' is not visible</b>';
2019-08-25 21:45:52 +02:00
}
}
}
}
2019-08-27 00:31:46 +02:00
if ($i > 1 and $maimg[$i] == 0 and $hatimg[$i] > 0) $errormessage[] = '<b style="font-weight:normal;color:#990000">There is no visible main image given in row ' . $i . '</b>';
if ($i > 1 and $maimg[$i] > 1 and $hatimg[$i] > 0) $errormessage[] = '<b style="font-weight:normal;color:#990000">There are ' . $maimg[$i] . ' main images given in row ' . $i . '</b>';
2019-08-25 21:45:52 +02:00
}
2019-08-27 00:31:46 +02:00
if (isset($errormessage) and $errormessage != '') {
echo '<b style="color:#990000;">There is not one main image for each object !</b>';
for ($i = 0; $i < count ($errormessage); $i++)
{
echo '<br>' . $errormessage[$i];
$error = $error + 1;
}
2019-08-25 21:45:52 +02:00
}
else
{
2019-08-27 00:31:46 +02:00
echo '<i style="font-style:normal;color:#009900;">For each object that has images attached exactly one main image is given !</i>';
2019-08-25 21:45:52 +02:00
}
}
else
{
echo '<i style="font-style:normal;color:#009900;">No images to be imported !</i>';
}
echo '<hr>';
2019-08-27 00:31:46 +02:00
if ($error + $depcon_error > 0) {
echo 'Error(s) found: ' . ($error + $depcon_error);
2019-08-25 21:45:52 +02:00
}
else
{
2019-08-27 00:31:46 +02:00
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=' . $_GET['fnam'] . '"><img src="img/go.gif"> Create XML for md:import (utf8)</a><br>';
2019-08-25 21:45:52 +02:00
}