diff --git a/.gitignore b/.gitignore index 29128a2..5112f1d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ *.swp *.swo commonservices +/xml diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..dcea89f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "mdAvailableLicenses"] + path = mdAvailableLicenses + url = /var/www/vhosts/museum-digital.de/git-base/mdAvailableLicenses diff --git a/assets/css/csvxml.css b/assets/css/csvxml.css index b041558..2ffaeea 100644 --- a/assets/css/csvxml.css +++ b/assets/css/csvxml.css @@ -81,11 +81,6 @@ th { padding: .3em .5em; text-align: left; border-bottom: 2px solid #424242; } tbody > tr:nth-child(2n + 1) { background: #F2F2F2; } td { padding: .3em .5em; border-bottom: 1px solid #D6D6D6; } -@media screen and (min-width:1100px) { - textarea, - body > div > table { width: 1000px; margin-left: -200px; } -} - body > div.uploader { background: #F2F2F2; border: 2px solid #EEE; padding: 1em 1em; } ul.fieldList { display: block; margin: .5em 0; padding: 0 0; list-style: none; } diff --git a/csv.php b/csv.php index dcf0c6b..c4a1592 100644 --- a/csv.php +++ b/csv.php @@ -38,10 +38,10 @@ require __DIR__ . "/values/availableFields.php"; $line1 = $line2 = $line3 = $line4 = []; -$tLine1 = $tLine2 = $tLine3 = $tLine4 = []; foreach ($availableFields as $headline => $fields) { $i = 0; + $tLine1 = $tLine2 = $tLine3 = $tLine4 = []; $tLine1[] = $headline; foreach($fields as $fieldName => $field) { @@ -53,11 +53,14 @@ foreach ($availableFields as $headline => $fields) { if ($i !== 0) $tLine1[] = ""; $tLine2[] = $fieldName; $tLine3[] = $field['name_human_readable']; - $tLine4[] = $field['remark']; + # $tLine4[] = $field['remark']; + if (!empty($field['allowedValues'])) $tLine4[] = end($field['allowedValues']); + else $tLine4[] = $field['name_human_readable']; + $i++; } - if (empty($tLine2)) continue; + if (empty($tLine2) or count($tLine2) === 0) continue; for ($i = 1; $i <= 4; $i++) { ${"line$i"} = array_merge(${"line$i"}, ${"tLine$i"}); @@ -65,12 +68,12 @@ foreach ($availableFields as $headline => $fields) { } -header('Content-Type: text/csv'); +header('Content-Type: text/csv; charset=utf-8'); if ($selectionActive === true) header("Content-Disposition: attachment; filename=csvxml_museum-digital_template-{$lang}_selection.csv"); else header("Content-Disposition: attachment; filename=csvxml_museum-digital_template-{$lang}.csv"); -for ($i = 1; $i <= 4; $i++) { - echo '"' . implode("\";\"", ${"line$i"}) . '"' . PHP_EOL; +for ($i = 2; $i <= 4; $i++) { + echo mb_convert_encoding('"' . implode("\";\"", ${"line$i"}) . '"' . PHP_EOL, 'utf-16','utf-8');; } diff --git a/csv_check.php b/csv_check.php index ff39aea..97759e7 100644 --- a/csv_check.php +++ b/csv_check.php @@ -1,12 +1,59 @@ $fieldCategory) { + $allowed = array_merge($allowed, array_keys($fieldCategory)); + + // Extended operations for events + if (strpos($categoryName, $basis['event']) !== false) { + foreach ($fieldCategory as $key => $value) { + if (strpos($key, "_annotation") !== false) continue; + if (strpos($key, "_sure") !== false) $eventpartsure[] = $key; + else $eventpart[] = $key; + } + } + + foreach ($fieldCategory as $key => $value) { + if (!empty($value["dependsOn"])) { + $fieldsWithDependency[$key] = $value['dependsOn']; + } + if (!empty($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_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'); @@ -16,11 +63,8 @@ $allowed_measurements = array('dimensions_separate_length_unit', 'dimensions_sep ', 'm', 'dm', 'cm', 'mm'); $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_who_sure1','signed_where_sure1','signed_when_sure2','signed_who_sure2','signed_where_sure2','was_mentioned_when_sure1','was_mentioned_who_sure1','was_mentioned_where_sure1','was_mentioned_when_sure2','was_mentioned_who_sure2','was_mentioned_where_sure2','buried_when_sure1','buried_who_sure1','buried_where_sure1','buried_when_sure2','buried_who_sure2','buried_where_sure2','intellectual_creation_when_sure1','intellectual_creation_who_sure1','intellectual_creation_where_sure1','intellectual_creation_when_sure2','intellectual_creation_who_sure2','intellectual_creation_where_sure2', 'painted_on_when_sure1','painted_on_who_sure1','painted_on_where_sure1', 'painted_on_when_sure2','painted_on_who_sure2','painted_on_where_sure2', 'illustrated_when_sure1','illustrated_who_sure1','illustrated_where_sure1', 'illustrated_when_sure2','illustrated_who_sure2','illustrated_where_sure2'); $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'); ///// Check #1 //echo '
';print_r($allowed);echo '
'; @@ -47,10 +91,9 @@ if ($error != 0) echo '
Not allowed tags found !
2: Not allowed multiple use of tags (column names)?'; $compare = array_unique($zeile); -function identical_values($arrayA, $arrayB) -{ - sort( $arrayA ); - sort( $arrayB ); +function identical_values($arrayA, $arrayB) { + sort($arrayA); + sort($arrayB); return $arrayA == $arrayB; } @@ -140,255 +183,19 @@ else ///// Check #5 echo '

5: Dependent colums observed ?
'; -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -// dependency of colums: inscription. If one of inscription or inscription_md or inscription_extern is given - all three are necessary -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'; - } -} -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'; - } -} -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'; - } -} -// 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 -for ($og = 1; $og < 6; $og++) -{ - 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'; - } - } - 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'; - } - } - 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'; - } - } -} - -// dependency of colums: images. If one of image_name1 or image_rights1 or image_visible1 is given - all three are necessary -for ($im = 1; $im < 29; $im++) -{ - 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'; - } - } -} - -// 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 -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'; - } -} -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'; - } -} -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'; - } -} - -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -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'; - } -} -if (array_search('worth_value', $erstezeile) !== false) { - if (array_search('worth_unit', $erstezeile) === false) { - $depencymessage[] = 'One column of worth_value, worth_unit is missing'; - } -} -if (array_search('worth_unit', $erstezeile) !== false) { - if (array_search('worth_value', $erstezeile) === false) { - $depencymessage[] = 'One column of worth_value, worth_unit is missing'; - } -} -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'; - } -} -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'; - } -} -if (array_search('link_url1', $erstezeile) !== false) { - if (array_search('link_show1', $erstezeile) === false) { - $depencymessage[] = 'One column of link_url1, link_show1 is missing'; - } -} -if (array_search('link_show1', $erstezeile) !== false) { - if (array_search('link_url1', $erstezeile) === false) { - $depencymessage[] = 'One column of link_url1, link_show1 is missing'; - } -} -if (array_search('link_url2', $erstezeile) !== false) { - if (array_search('link_show2', $erstezeile) === false) { - $depencymessage[] = 'One column of link_url2, link_show2 is missing'; - } -} -if (array_search('link_show2', $erstezeile) !== false) { - if (array_search('link_url2', $erstezeile) === false) { - $depencymessage[] = 'One column of link_url2, link_show2 is missing'; - } -} - -for ($i = 0; $i < count($eventpart); $i++) -{ - 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'; - } - } - if (array_search($eventpartsure[$i], $erstezeile) !== false) { - if (array_search($eventpart[$i], $erstezeile) === false) { - $depencymessage[] = 'One column of ' . $eventpart[$i] . ', ' . $eventpartsure[$i] . ' is missing'; +// Check for correct handling of dependent fields +foreach ($fieldsWithDependency as $tField => $tDependentFields) { + + if (array_search($tField, $erstezeile) === false) continue; + + foreach ($tDependentFields as $tDependentField) { + if (array_search($tDependentField, $erstezeile) === false) { + $depencymessage[] = "Dependency issue at column $tField: Corresponding column $tDependentField is missing"; } } + } if (isset($depencymessage) and $depencymessage != '') { @@ -399,8 +206,7 @@ if (isset($depencymessage) and $depencymessage != '') { $error = $error + 1; } } -else -{ +else { echo 'Dependent columns were observed !'; } @@ -474,115 +280,19 @@ if ($depcon_error == 0) echo '
De ///// Check #7 echo '

7: Not allowed values in controlled lists?
'; -for ($i = 1; $i <= $y; $i++) -{ - for ($j = 0; $j < count ($inhalt[$i]); $j++) - { - if ($inhalt[1][$j] == 'object_other_title_kind_of' and !$inhalt[$i][array_search('object_other_title', $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_object_other_title_kind_of)) $errormessage[] = 'Not allowed value in column object_other_title_kind_of: ' . $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 = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_other_object_title_in)) $errormessage[] = 'Not allowed value in column other_object_title_in: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'closer_location_as' and !$inhalt[$i][array_search('closer_location', $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_closer_location_as)) $errormessage[] = 'Not allowed value in column closer_location_as: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'inclusion_kind_of') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_inclusion_kind_of)) $errormessage[] = 'Not allowed value in column inclusion_kind_of: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'bought_for_currency' and !$inhalt[$i][array_search('bought_for', $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_currency)) $errormessage[] = 'Not allowed value in column bought_for_currency: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'worth_unit' and !$inhalt[$i][array_search('worth_value', $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_currency)) $errormessage[] = 'Not allowed value in column worth_unit: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'worth_insurance_unit' and !$inhalt[$i][array_search('worth_insurance_value', $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_currency)) $errormessage[] = 'Not allowed value in column worth_insurance_unit: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'detailed_description_md' and !$inhalt[$i][array_search('detailed_description', $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column detailed_description_md: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'detailed_description_extern' and !$inhalt[$i][array_search('detailed_description', $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column detailed_description_extern: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'inscription_md' and !$inhalt[$i][array_search('inscription', $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column inscription_md: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'inscription_extern' and !$inhalt[$i][array_search('inscription', $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column inscription_extern: ' . $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 = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column dimensions_separate_length_unit: ' . $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 = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column dimensions_separate_width_unit: ' . $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 = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column dimensions_separate_height_unit: ' . $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 = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column dimensions_separate_diameter_unit: ' . $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 = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column dimensions_separate_wall_thickness_unit: ' . $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 = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_weight)) $errormessage[] = 'Not allowed value in column dimensions_separate_weight_unit: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'dimensions_separate_show_md') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column dimensions_separate_show_md: ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'dimensions_separate_show_extern') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column dimensions_separate_show_extern: ' . $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 = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column object_group_show' . $og . ': ' . $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 = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column image_visible' . $im . ': ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'image_main' . $im and !$inhalt[$i][array_search('image_name' . $im, $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column image_main' . $im . ': ' . $showvalue . ' (row ' . $i . ')'; - } - if ($inhalt[1][$j] == 'image_rights' . $im and !$inhalt[$i][array_search('image_name' . $im, $erstezeile)] == '') { - if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_image_rights)) $errormessage[] = 'Not allowed value in column image_rights' . $im . ': ' . $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 = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; - if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column ' . $eventpartsure[$k] . ': ' . $showvalue . ' (row ' . $i . ')'; - } +for ($i = 2; $i <= $y; $i++) { + + foreach ($inhalt[$i] as $key => $value) { + + $columnName = $inhalt[1][$key]; + // If the field is not restricted, then continue + if (!isset($fieldsWithAllowedValueSet[$columnName])) continue; + + // For others: check if the value is from the list of allowed values. + if (!in_array($value, $fieldsWithAllowedValueSet[$columnName])) { + $errormessage[] = "Disallowed value in column {$columnName} on row {$i}: " . $value . " (allowed values: " . implode(", ", $fieldsWithAllowedValueSet[$columnName]) . ")"; } + } } @@ -647,11 +357,10 @@ if ($hasanyimage > 0) { for ($i = 0; $i < count ($errormessage); $i++) { echo '
' . $errormessage[$i]; - $error = $error + 1; + $error++; } } - else - { + else { echo 'For each object that has images attached exactly one main image is given !'; } } diff --git a/functions/functions.php b/functions/functions.php index 54cde44..5a4f906 100644 --- a/functions/functions.php +++ b/functions/functions.php @@ -157,3 +157,64 @@ function generateHelpTooltip(string $identifier, string $title, string $explica, return [$output, $outputTag]; } + +/** + * Outputs a DOMDocument with correct header and then aborts. + * Used mainly for debugging. + * + * @param DOMDocument $xmlDoc XML object. + * + * @return void + */ +function printDOMDocToXML(DOMDocument $xmlDoc) { + + return '' . $xmlDoc->saveXML($xmlDoc->documentElement); + +} + +/** + * Function for creating a DOMElement with a text node inside. + * + * @param DOMDocument $xmlDoc XML document. + * @param string $tag Tag. + * @param string $content Text content. + * + * @return DOMElement + */ +function createTextDomElement(DOMDocument $xmlDoc, string $tag, string $content):DOMElement { + + $element = $xmlDoc->createElement($tag); + $element->appendChild($xmlDoc->createTextNode($content)); + + return $element; + +} + +/** + * Function for creating a DOMDocument record channel. + * + * @return array + */ +function getBlankRecordChannel():array { + + $xmlDoc = new DOMDocument("1.0", "UTF-8"); + $xmlMainElem = $xmlDoc->createElement("record"); + $record_node = $xmlDoc->appendChild($xmlMainElem); //add RSS element to XML node + + return [$xmlDoc, $record_node]; + +} + +function rrmdir($dir) { + if (is_dir($dir)) { + $objects = scandir($dir); + foreach ($objects as $object) { + if ($object != "." && $object != "..") { + if (filetype($dir . "/" . $object) == "dir") rrmdir($dir . "/" . $object); else unlink($dir . "/" . $object); + } + } + reset($objects); + rmdir($dir); + } + +} diff --git a/index2.php b/index2.php index 94d3e42..662a174 100644 --- a/index2.php +++ b/index2.php @@ -1,9 +1,32 @@ '; -echo '
'; -echo 'museum-digital CSV to XML converter'; -echo '
'; +declare(strict_types = 1); +error_reporting(E_ALL); +ini_set('display_errors', "1"); + +require_once __DIR__ . "/functions/functions.php"; + +if (session_status() != PHP_SESSION_ACTIVE) { + session_start(); +} + +// This array contains all available languages +$allowed_langs = ['ar', 'de', 'en', 'hu', 'id', 'it', 'pl','pt']; + +// Some languages are in translation. They will only be available for logged in users. + +if (isset($_GET['navlang'])) { + $_SESSION['lang'] = $_GET['navlang']; + if (!in_array($_SESSION['lang'], $allowed_langs)) $_SESSION['lang'] = 'de'; +} +else if (!isset($_SESSION['lang'])) { + $_SESSION['lang'] = lang_getfrombrowser($allowed_langs, 'en', "", false); +} +$lang = $_SESSION['lang']; + +require __DIR__ . "/translation-importer/$lang/csvxml-overview.php"; + +echo printHTMLHead(); + echo '
'; echo ''; echo ''; @@ -13,11 +36,11 @@ require_once 'inc/zeichen.php'; $filename = $_GET['fnam']; $csv_datei = 'csv/' . $filename; -mkdir("xml", 0777); +mkdir("xml", 0755); $fp = fopen ( $csv_datei, 'r' ); $y = 0; -while ( $zeile = fgetcsv ( $fp, 100000, ';' ) ) -{ +while ($zeile = fgetcsv($fp, 100000, ';')) { + $y++; $zieldatei = 'xml/' . $y . '.xml'; if (!$handle = fopen($zieldatei, 'w')) { @@ -26,8 +49,7 @@ while ( $zeile = fgetcsv ( $fp, 100000, ';' ) ) $somecontent = '' . "\n"; // normal $somecontent = $somecontent . '' . "\n"; - for ($x = 0; $x < count ( $zeile ); $x++) - { + for ($x = 0; $x < count ($zeile); $x++) { $inhalt[$y][$x] = $zeile[$x]; //if ($inhalt[$y][$x]=='') $inhalt[$y][$x]='ERSATZ'; $somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . transform($inhalt[$y][$x]) . '' . "\n"; //normaleinstellung @@ -45,3 +67,9 @@ echo ''; echo ''; echo '
'; echo '
'; + +echo ' + + + +'; diff --git a/index4.php b/index4.php index 9118083..df738c8 100644 --- a/index4.php +++ b/index4.php @@ -1,27 +1,41 @@ '; -echo '
'; -echo 'museum-digital CSV to XML converter'; -echo '
'; -echo '
'; -echo ''; -echo ''; -echo ''; -echo ''; -echo '
'; -echo 'Please wait ... (transforming)
'; -ob_start(); -echo ''; // für ungarn sonst weg ////////////////////// +declare(strict_types = 1); +error_reporting(E_ALL); +ini_set('display_errors', "1"); + +require_once __DIR__ . "/functions/functions.php"; + +if (session_status() != PHP_SESSION_ACTIVE) { + session_start(); +} + +// This array contains all available languages +$allowed_langs = ['ar', 'de', 'en', 'hu', 'id', 'it', 'pl','pt']; + +// Some languages are in translation. They will only be available for logged in users. + +if (isset($_GET['navlang'])) { + $_SESSION['lang'] = $_GET['navlang']; + if (!in_array($_SESSION['lang'], $allowed_langs)) $_SESSION['lang'] = 'de'; +} +else if (!isset($_SESSION['lang'])) { + $_SESSION['lang'] = lang_getfrombrowser($allowed_langs, 'en', "", false); +} +$lang = $_SESSION['lang']; + +require __DIR__ . "/translation-importer/$lang/csvxml-overview.php"; + require 'inc/zeichen.php'; $filename = $_GET['fnam']; $csv_datei = 'csv/' . $filename; -mkdir("xml", 0777); -$fp = fopen ( $csv_datei, 'r' ); +if (is_dir(__DIR__ . "/xml")) rrmdir(__DIR__ . '/xml'); +mkdir("xml", 0755); + +$fp = fopen ($csv_datei, 'r'); $y = 0; -while ( $zeile = fgetcsv ( $fp, 100000, ';' ) ) -{ +while ($zeile = fgetcsv($fp, 100000, ';')) { + $y++; $zieldatei = 'xml/' . $y . '.xml'; if (!$handle = fopen($zieldatei, 'w')) { @@ -35,6 +49,7 @@ while ( $zeile = fgetcsv ( $fp, 100000, ';' ) ) $inhalt[$y][$x] = $zeile[$x]; $inhalt[$y][$x] = preg_replace('/[\x00-\x1F\x7F]/u', '', $inhalt[$y][$x]); $inhalt[$y][$x] = str_replace('>', ']', str_replace('<', '[', $inhalt[$y][$x])); + if (empty($inhalt[$y][$x])) continue; //if ($y!=1) $inhalt[$y][$x] = ''; $somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . (($inhalt[$y][$x])) . '' . "\n"; //für ungarn sonst weg } } @@ -43,11 +58,25 @@ while ( $zeile = fgetcsv ( $fp, 100000, ';' ) ) echo "Cannot write to file ($filename)";exit; } fclose($handle); + } fclose($fp); -echo ($y - 1) . ' files created'; -echo '
Download as zip'; -echo '
'; -echo '
'; + +echo printHTMLHead(); + +echo ' +
+ Please wait ... (transforming) +
+ + ' . ($y - 1) . ' files created +
+ Download as zip + +
'; + +echo ' + + + +'; diff --git a/mdAvailableLicenses b/mdAvailableLicenses new file mode 160000 index 0000000..1a1f237 --- /dev/null +++ b/mdAvailableLicenses @@ -0,0 +1 @@ +Subproject commit 1a1f237024dfda63108f1ff84a8d6b4d137642a4 diff --git a/values/availableFields.php b/values/availableFields.php index ad82185..32781ad 100644 --- a/values/availableFields.php +++ b/values/availableFields.php @@ -7,6 +7,9 @@ 4: dependent fields 5: remarks */ +declare(strict_types = 1); + +require __DIR__ . "/../mdAvailableLicenses/licenses.php"; require __DIR__ . "/../translation-importer/$lang/csvxml-overview.php"; foreach (array_diff(scandir(__DIR__ . "/langfiles/$lang/"), ['.', '..']) as $fileName) { @@ -15,6 +18,7 @@ foreach (array_diff(scandir(__DIR__ . "/langfiles/$lang/"), ['.', '..']) as $fil } require __DIR__ . "/commonservices/$lang/search_all_fields.php"; +require __DIR__ . "/commonservices/units.php"; require __DIR__ . "/commonservices/$lang/eventtype_name.php"; @@ -23,8 +27,7 @@ $availableFields = [ $csvxml_overview['object_base_data'] => [ "inventory_number" => [ "required" => true, - "format" => 'text/utf8', - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => [], "remark" => 'Only unique values allowed', "name_human_readable" => $object_basis['inventory_number'], @@ -32,8 +35,7 @@ $availableFields = [ ], "object_type" => [ "required" => true, - "format" => 'text/utf8', - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => [], "remark" => 'Keep it short! Field is needed to create valid LIDO from museum-digital entries', "name_human_readable" => $object_basis['object_type'], @@ -41,8 +43,8 @@ $availableFields = [ ], "object_title" => [ "required" => true, - "format" => 'text/utf8', - "allowedValues" => 'freetext', + + "allowedValues" => [], "dependsOn" => [], "remark" => 'Best is not to repeat the title again and again for many objects, e.g. vase, vase, vase ... better: Green vase, Blue vase, Yellow vase, ...', "name_human_readable" => $object_basis['object_name'], @@ -50,8 +52,7 @@ $availableFields = [ ], "object_description" => [ "required" => true, - "format" => 'text/utf8', - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => [], "remark" => 'A good description of the objects is fundamental to make the objects searchable in the internet', "name_human_readable" => $object_basis['description'], @@ -59,8 +60,8 @@ $availableFields = [ ], "object_material_technique" => [ "required" => false, - "format" => 'text/utf8', - "allowedValues" => 'freetext', + + "allowedValues" => [], "dependsOn" => [], "remark" => 'This is a cummulative field for material and technique. It is also possible to additionally save the information separate in the fields: material_separate and technique_separate', "name_human_readable" => $object_basis['mattech'], @@ -68,8 +69,7 @@ $availableFields = [ ], "object_dimensions" => [ "required" => false, - "format" => 'text/utf8', - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => [], "remark" => 'This is a cummulative field for dimensions (values and units). It is also possible to additionally save the information separate. See the block: separate dimensions', "name_human_readable" => $object_basis['measurements'], @@ -77,8 +77,7 @@ $availableFields = [ ], "object_publication" => [ "required" => false, - "format" => 'text/utf8', - "allowedValues" => 'One letter only, y or n', + "allowedValues" => ["y", "n"], "dependsOn" => [], "remark" => 'Shall the object be visible directly after import?', "name_human_readable" => $objekt['visibility'], @@ -86,8 +85,7 @@ $availableFields = [ ], "institution_name" => [ "required" => false, - "format" => 'text/utf8', - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => [], "remark" => 'If name of institution is given it has to be exactly the same as already known in museum-digital', "name_human_readable" => $museum['museum_name'], @@ -95,20 +93,18 @@ $availableFields = [ ], ], $searchvar[0][0] => [ - "other_object_title" => [ + "object_other_title" => [ "required" => false, - "format" => 'text/utf8', - "allowedValues" => 'freetext', - "dependsOn" => 'object_other_title_kind_of', + "allowedValues" => [], + "dependsOn" => ['object_other_title_kind_of'], "remark" => 'If the field object_other_title is used. It has to be specified where this alternative title is used. Specification should be done within the field: object_other_title_kind_of', "name_human_readable" => $searchvar[0][0], "explica" => '', ], "object_other_title_kind_of" => [ "required" => false, - "format" => 'text/utf8', - "allowedValues" => 'de: "Wissenschaft", "Alltagssprache", "Umgangssprache", "Dialekt"
hu: "Tudományos", "Köznyelvi", "Nyelvjárás"', - "dependsOn" => 'object_other_title', + "allowedValues" => array_values($titelart), + "dependsOn" => ['object_other_title'], "remark" => 'This field has to be used togehter with object_other_title', "name_human_readable" => $searchvar[0][0] . ', in: ', "explica" => '', @@ -117,7 +113,7 @@ $availableFields = [ $searchvar[46][0] => [ "detailed_description" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => ['detailed_description_md', 'detailed_description_extern'], "remark" => 'If detailed_desription is made available for an object, detailed_description_md and detailed_description_extern have to have values too', "name_human_readable" => $searchvar[46][0], @@ -125,7 +121,7 @@ $availableFields = [ ], "detailed_description_md" => [ "required" => false, - "allowedValues" => '"y","n"', + "allowedValues" => ["y", "n"], "dependsOn" => ['detailed_description', 'detailed_description_extern'], "remark" => 'Shall detailed description be visible at museum-digital? If detailed_desription is available for an object, detailed_description_md and detailed_description_extern have to have values too', "name_human_readable" => $object_add['ddesc_visibility_md'], @@ -133,8 +129,8 @@ $availableFields = [ ], "detailed_description_extern" => [ "required" => false, - "allowedValues" => '"y","n"', - "dependsOn" => ['detailed_description_md and detailed_description'], + "allowedValues" => ["y", "n"], + "dependsOn" => ['detailed_description_md', 'detailed_description'], "remark" => 'Shall later exports from museum-digital include the detailed_description?
If detailed_desription is available for an object, detailed_description_md and detailed_description_extern have to have values too', "name_human_readable" => $object_add['ddesc_visibility_extern'], "explica" => "", @@ -143,7 +139,7 @@ $availableFields = [ $searchvar[2][0] => [ "inscription" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => ['inscription_md', 'inscription_extern'], "remark" => 'If inscription is made available for an object, inscription_md> and inscription_extern have to have values too', "name_human_readable" => $searchvar[2][0], @@ -151,16 +147,16 @@ $availableFields = [ ], "inscription_md" => [ "required" => false, - "allowedValues" => '"y","n"', - "dependsOn" => ['inscription_md and inscription_extern'], + "allowedValues" => ["y", "n"], + "dependsOn" => ['inscription_md', 'inscription_extern'], "remark" => 'Shall a given inscription be displayed at museum-digital? If inscription is available for an object, inscription_md> and inscription_extern have to have values too', "name_human_readable" => $object_add['besch_visibility_md'], "explica" => "", ], "inscription_extern" => [ "required" => false, - "allowedValues" => '"y","n"', - "dependsOn" => ['inscription_md and inscription_extern'], + "allowedValues" => ["y", "n"], + "dependsOn" => ['inscription_md', 'inscription_extern'], "remark" => 'Shall later exports from museum-digital inlude inscription? If inscription is available for an object, inscription_md> and inscription_extern have to have values too', "name_human_readable" => $object_add['besch_visibility_extern'], "explica" => "", @@ -169,14 +165,14 @@ $availableFields = [ "{$searchvar[52][0]} / {$searchvar[53][0]}" => [ "material_separate" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "remark" => 'Additional to collecting material and technique in a combined field (see above), the material(s) can be given here separately', "name_human_readable" => $searchvar[52][0], "explica" => "", ], "technique_separate" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "remark" => 'Additional to collecting material and technique in a combined field (see above), the technique(s) can be given here separately', "name_human_readable" => $searchvar[53][0], "explica" => "", @@ -185,134 +181,144 @@ $availableFields = [ $object_add['separated_measurements'] => [ "dimensions_separate_length_value" => [ "required" => false, - "allowedValues" => 'number', - "dependsOn" => ['dimensions_separate_length_unit, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => [], + "dependsOn" => ['dimensions_separate_length_unit', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_length_value'], "explica" => "", ], "dimensions_separate_length_unit" => [ "required" => false, - "allowedValues" => '"m","dm","cm","mm"', - "dependsOn" => ['dimensions_separate_length_value, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => $laengeneinheit, + "dependsOn" => ['dimensions_separate_length_value', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_length_unit'], "explica" => "", ], "dimensions_separate_width_value" => [ "required" => false, - "allowedValues" => 'number', - "dependsOn" => ['dimensions_separate_width_unit, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => [], + "dependsOn" => ['dimensions_separate_width_unit', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_width_value'], "explica" => "", ], "dimensions_separate_width_unit" => [ "required" => false, - "allowedValues" => '"m","dm","cm","mm"', - "dependsOn" => ['dimensions_separate_width_value, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => $laengeneinheit, + "dependsOn" => ['dimensions_separate_width_value', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_width_unit'], "explica" => "", + "required" => false, ], "dimensions_separate_height_value" => [ - "required" => false, - "allowedValues" => 'number', - "dependsOn" => ['dimensions_separate_height_unit, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => [], + "dependsOn" => ['dimensions_separate_height_unit', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_height_value'], "explica" => "", ], "dimensions_separate_height_unit" => [ "required" => false, - "allowedValues" => '"m","dm","cm","mm"', - "dependsOn" => ['dimensions_separate_height_value, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => $laengeneinheit, + "dependsOn" => ['dimensions_separate_height_value', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_height_unit'], "explica" => "", ], "dimensions_separate_weight_value" => [ "required" => false, - "allowedValues" => 'number', - "dependsOn" => ['dimensions_separate_weight_unit, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => [], + "dependsOn" => ['dimensions_separate_weight_unit', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_weight_value'], "explica" => "", ], "dimensions_separate_weight_unit" => [ "required" => false, - "allowedValues" => '"m","dm","cm","mm"', - "dependsOn" => ['dimensions_separate_width_value, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => $gewichteinheit, + "dependsOn" => ['dimensions_separate_width_value', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_weight_unit'], "explica" => $object_basis['inv_explica'], ], "dimensions_separate_diameter_value" => [ "required" => false, - "allowedValues" => 'number', - "dependsOn" => ['dimensions_separate_diameter_unit, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => [], + "dependsOn" => ['dimensions_separate_diameter_unit', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_diameter_value'], "explica" => "", ], "dimensions_separate_diameter_unit" => [ "required" => false, - "allowedValues" => '"m","dm","cm","mm"', - "dependsOn" => ['dimensions_separate_diameter_value, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => $laengeneinheit, + "dependsOn" => ['dimensions_separate_diameter_value', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_diameter_unit'], "explica" => "", ], "dimensions_separate_wall_thickness_value" => [ "required" => false, - "allowedValues" => 'number', - "dependsOn" => ['dimensions_separate_thickness_unit, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => [], + "dependsOn" => ['dimensions_separate_wall_thickness_unit', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_wall_size_value'], "explica" => "", ], "dimensions_separate_wall_thickness_unit" => [ "required" => false, - "allowedValues" => '"m","dm","cm","mm"', - "dependsOn" => ['dimensions_separate_thickness_value, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => $laengeneinheit, + "dependsOn" => ['dimensions_separate_wall_thickness_value', 'dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => 'If a separated value is given an entry for the respective unit is necessary. If a separated dimension entry is given, dimensions_separate_show_md and dimensions_separate_show_extern need to be filled in, too.', "name_human_readable" => $export['exact_measurements_wall_size_unit'], "explica" => "", ], "dimensions_separate_show_md" => [ "required" => false, - "allowedValues" => '"y","n"', - "dependsOn" => ['Any field named dimensions_separate ...'], + "allowedValues" => ["y", "n"], + "dependsOn" => [ + "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" + ], "remark" => 'If one or more separate dimension-value (and -unit) is given it has to be specified if the separated entries should be made visible at museum-digital', "name_human_readable" => $object_basis['inventory_number'], "explica" => "", ], "dimensions_separate_show_extern" => [ "required" => false, - "allowedValues" => '"y","n"', - "dependsOn" => ['Any field named dimensions_separate ...'], + "allowedValues" => ["y", "n"], + "dependsOn" => [ + "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" + ], "remark" => 'If one or more separate dimension-value (and -unit) is given it has to be specified if the separated entries should be included in a later export from museum-digital', "name_human_readable" => $object_basis['inventory_number'], "explica" => "", ], "number_of_pieces" => [ "required" => false, - "allowedValues" => 'number', + "allowedValues" => [], "remark" => 'Only to be given if more than one copies of an object are available and catalogued with the same inventory number', "name_human_readable" => $export['exact_measurements_number_pieces'], "explica" => "", ], "number_of_pages" => [ "required" => false, - "allowedValues" => 'number', + "allowedValues" => [], "remark" => 'Only to be given for books (etc.)', "name_human_readable" => $export['exact_measurements_number_pages'], "explica" => "", ], "dimensions_separate_stamp_position" => [ "required" => false, - "allowedValues" => 'number', - "dependsOn" => ['dimensions_separate_thickness_unit, dimensions_separate_show_md, dimensions_separate_show_extern'], + "allowedValues" => [], + "dependsOn" => ['dimensions_separate_show_md', 'dimensions_separate_show_extern'], "remark" => '', "name_human_readable" => $export['exact_measurements_stamp_position'], "explica" => "", @@ -321,24 +327,24 @@ $availableFields = [ $searchvar[11][0] => [ "comparable_objects_other_museums" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => ['comparable_objects_other_museums_show_md, comparable_objects_other_museums_show_extern'], + "allowedValues" => [], + "dependsOn" => ['comparable_objects_other_museums_show_md', 'comparable_objects_other_museums_show_extern'], "remark" => 'Name of other museum and if available the inventory number of the respective object. If comparable_objects_other_museums is given comparable_objects_other_museums_show_md and comparable_objects_other_museums_show_extern have to be given too', "name_human_readable" => $searchvar[11][0], "explica" => $object_add['vergl_inhalt'], ], "comparable_objects_other_museums_show_md" => [ "required" => false, - "allowedValues" => '"y","n"', - "dependsOn" => ['comparable_objects_other_museums'], + "allowedValues" => ["y", "n"], + "dependsOn" => ['comparable_objects_other_museums', 'comparable_objects_other_museums_show_extern'], "remark" => 'Necessary if comparable_objects_other_museums is given. Should the information about comparable objects be displayed at museum-digital?', "name_human_readable" => $object_add['vergl_visibility_md'], "explica" => "", ], "comparable_objects_other_museums_show_extern" => [ "required" => false, - "allowedValues" => '"y","n"', - "dependsOn" => ['comparable_objects_other_museums'], + "allowedValues" => ["y", "n"], + "dependsOn" => ['comparable_objects_other_museums', 'comparable_objects_other_museums_show_md'], "remark" => 'Necessary if comparable_objects_other_museums is given. Should the information about comparable objects be part of later exports from museum-digital?', "name_human_readable" => $object_add['vergl_visibility_extern'], "explica" => "", @@ -347,7 +353,7 @@ $availableFields = [ $searchvar[1][0] => [ "closer_location" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => ['closer_location_as'], "remark" => 'A place in a special relation to the object. The kind of relation has to specified in closer_location_as', "name_human_readable" => $searchvar[1][0], @@ -355,7 +361,7 @@ $availableFields = [ ], "closer_location_as" => [ "required" => false, - "allowedValues" => 'de: "Aufnahmeort", "Fundort", "Früherer Ort" hu: "Felvétel késztésének helye","Lelőhely","Történelmi elnevezés"', + "allowedValues" => array_values($ortart), "dependsOn" => ['closer_location'], "remark" => 'A place in a special relation to the object can be given in closer_location. Here the kind of relation between object and place has to specified', "name_human_readable" => "{$searchvar[1][0]}, {$object_add['as']}", @@ -365,42 +371,42 @@ $availableFields = [ $object_add['classification'] => [ "entry_number" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "remark" => 'The entry number of the object if available', "name_human_readable" => $searchvar[12][0], "explica" => $object_add['einu_inhalt'], ], "other_inventory_number" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "remark" => 'All other inventory numbers (older ones presumably) in one field', "name_human_readable" => $searchvar[13][0], "explica" => $object_add['invp_inhalt'], ], "subject_group" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "remark" => 'If the object is part of an subject group this information should be given here', "name_human_readable" => $searchvar[16][0], "explica" => "", ], "systematic" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "remark" => 'If the object is put into a museum-systematic the place it has there', "name_human_readable" => $searchvar[17][0], "explica" => "", ], "bundle" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "remark" => 'The bundle the object belongs to', "name_human_readable" => $searchvar[14][0], "explica" => "", ], "part_of" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "remark" => 'If the object is part of something it can be given here', "name_human_readable" => $searchvar[15][0], "explica" => "", @@ -416,9 +422,9 @@ $availableFields = [ ], "inclusion_kind_of" => [ "required" => false, - "allowedValues" => '', + "allowedValues" => array_values($zugangsart), "remark" => '', - "name_human_readable" => "{$object_basis['inv_explica']}, {$object_add['as']}", + "name_human_readable" => "{$searchvar[19][0]}, {$object_add['as']}", "explica" => "", ], "inclusion_who" => [ @@ -468,15 +474,17 @@ $availableFields = [ "bought_for" => [ "required" => false, "allowedValues" => '', + "dependsOn" => ["bought_for_currency"], "remark" => '', "name_human_readable" => "{$searchvar[19][0]}, {$object_add['for']}", "explica" => $object_basis['inv_explica'], ], "bought_for_currency" => [ "required" => false, - "allowedValues" => '', + "allowedValues" => $currencies, + "dependsOn" => ["bought_for"], "remark" => '', - "name_human_readable" => "{$searchvar[19][0]}, {$object_add['for']}", // TODO + "name_human_readable" => "{$searchvar[19][0]}, {$object_add['for']}", "explica" => "", ], ], @@ -504,9 +512,9 @@ $availableFields = [ ], "worth_unit" => [ "required" => false, - "allowedValues" => '', + "allowedValues" => $currencies, "remark" => '', - "name_human_readable" => "{$searchvar[23][0]}; Currency", // TODO + "name_human_readable" => "{$searchvar[23][0]}; Currency", "explica" => "", ], "worth_incurance_determiner" => [ @@ -532,9 +540,9 @@ $availableFields = [ ], "worth_insurance_unit" => [ "required" => false, - "allowedValues" => '', + "allowedValues" => $currencies, "remark" => '', - "name_human_readable" => "{$searchvar[26][0]}; Currency", // TODO + "name_human_readable" => "{$searchvar[26][0]}; Currency", "explica" => "", ], ], @@ -696,7 +704,7 @@ $availableFields = [ $basis['event'] . ": " . $eventname[21] => [], $basis['event'] . ": " . $eventname[25] => [], $basis['event'] . ": " . $eventname[26] => [], - $basis['event'] . ": spoken" => [], // TODO: 27? + $basis['event'] . ": " . $eventname[27] => [], $basis['event'] . ": " . $eventname[28] => [], $basis['event'] . ": " . $eventname[29] => [], $basis['event'] . ": " . $eventname[30] => [], @@ -720,16 +728,16 @@ for ($i = 1; $i <= 2; $i++) { [ "link_url{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["link_show{$i}"], "remark" => '', "name_human_readable" => $link['url'], "explica" => $link['linklink_explica'], ], "link_show{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["link_url{$i}"], "remark" => '', "name_human_readable" => $link['text'], "explica" => $link['linkname_explica'], @@ -744,23 +752,23 @@ for ($i = 1; $i <= 2; $i++) { [ "literature_author{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["literature_title{$i}"], "remark" => '', "name_human_readable" => $literature['author'], "explica" => $literature['autor_explica'], ], "literature_year{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["literature_title{$i}"], "remark" => '', "name_human_readable" => $literature['year'], "explica" => $literature['jahr_explica'], ], "literature_title{$i}" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => [], "remark" => '', "name_human_readable" => $literature['title'], @@ -768,64 +776,64 @@ for ($i = 1; $i <= 2; $i++) { ], "literature_place{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["literature_title{$i}"], "remark" => '', "name_human_readable" => $literature['place'], "explica" => $literature['ort_explica'], ], "literature_abbreviation{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["literature_title{$i}"], "remark" => '', "name_human_readable" => $literature['abbr'], "explica" => $literature['abbr_explica'], ], "literature_gnd{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["literature_title{$i}"], "remark" => '', "name_human_readable" => $literature['gnd'], "explica" => $literature['gnd_explica'], ], "literature_isbn{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["literature_title{$i}"], "remark" => '', "name_human_readable" => $literature['isbn'], "explica" => $literature['isbn_explica'], ], "literature_signature{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["literature_title{$i}"], "remark" => '', "name_human_readable" => $literature['id_in_museum'], "explica" => $literature['id_in_museum_explica'], ], "literature_online{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["literature_title{$i}"], "remark" => '', "name_human_readable" => $literature['online'], "explica" => $literature['online_explica'], ], "literature_annotation{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["literature_title{$i}"], "remark" => '', "name_human_readable" => $literature['annotation'], "explica" => $literature['annotation_explica'], ], "literature_inlit{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["literature_title{$i}"], "remark" => '', "name_human_readable" => $literature['where_inside'], "explica" => $literature['where_in_explica'], @@ -840,7 +848,7 @@ for ($i = 1; $i <= 2; $i++) { $availableFields[$csvxml_overview['object_base_data']]["collection_name{$i}"] = [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => [], "remark" => 'Use if object belongs to a collection. If collection is already in museum-digital, please use exactly the same name', "name_human_readable" => $collection['name'], @@ -855,7 +863,7 @@ for ($i = 1; $i <= 5; $i++) { [ "object_group_name{$i}" => [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "dependsOn" => [], "remark" => '', "name_human_readable" => $link['series_name'], @@ -863,16 +871,16 @@ for ($i = 1; $i <= 5; $i++) { ], "object_group_description{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["object_group_name{$i}"], "remark" => '', "name_human_readable" => $link['series_description'], "explica" => $link['series_description'], ], "object_group_show{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => ["object_group_name{$i}"], "remark" => '', "name_human_readable" => $link['hide_objectgroup'], "explica" => "", @@ -885,7 +893,7 @@ for ($i = 1; $i <= 10; $i++) { $availableFields[$overview['tags']]["tag{$i}"] = [ "required" => false, - "allowedValues" => 'freetext', + "allowedValues" => [], "remark" => '', "name_human_readable" => $overview['tags'], "explica" => "", @@ -899,18 +907,18 @@ for ($i = 1; $i <= 2; $i++) { [ "related_place{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["related_place_sure{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], + "name_human_readable" => $event['where'], "explica" => "", ], "related_place_sure{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => ["related_place{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], + "name_human_readable" => $event['where'] . " [{$csvxml_overview['certainty']}]", "explica" => "", ], ]); @@ -923,18 +931,18 @@ for ($i = 1; $i <= 2; $i++) { [ "related_actor{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["related_actor_sure{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], + "name_human_readable" => $event['who'], "explica" => "", ], "related_actor_sure{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => ["related_actor{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], + "name_human_readable" => $event['who'] . " [{$csvxml_overview['certainty']}]", "explica" => "", ], ]); @@ -947,18 +955,18 @@ for ($i = 1; $i <= 2; $i++) { [ "related_time{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["related_time_sure{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], + "name_human_readable" => $event['when'], "explica" => "", ], "related_time_sure{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => ["related_time{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], + "name_human_readable" => $event['when'] . " [{$csvxml_overview['certainty']}]", "explica" => "", ], ]); @@ -971,59 +979,73 @@ for ($i = 1; $i <= 5; $i++) { [ "image_name{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "image_owner{$i}", "image_rights{$i}", "image_visible{$i}", "image_main{$i}" + ], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $csvxml_overview['image_filename'], + "explica" => "", ], "image_description{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "image_name{$i}", "image_owner{$i}", "image_rights{$i}", "image_visible{$i}", "image_main{$i}" + ], "remark" => '', "name_human_readable" => $image_incha['image_description'], "explica" => $image_incha['bildbesch_explica'], ], "image_owner{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "image_name{$i}", "image_rights{$i}", "image_visible{$i}", "image_main{$i}" + ], "remark" => '', "name_human_readable" => $image_incha['image_rightsholder'], "explica" => $image_incha['owner_explica'], ], "image_creator{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "image_name{$i}", "image_owner{$i}", "image_rights{$i}", "image_visible{$i}", "image_main{$i}" + ], "remark" => '', "name_human_readable" => $image_incha['photographer'], "explica" => $image_incha['creator_explica'], ], "image_rights{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => array_keys($availableLicenses), + "dependsOn" => [ + "image_name{$i}", "image_owner{$i}", "image_visible{$i}", "image_main{$i}" + ], "remark" => '', "name_human_readable" => $image_incha['rights_status'], "explica" => $image_incha['rechte_explica'], ], "image_visible{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => [ + "image_name{$i}", "image_owner{$i}", "image_rights{$i}", "image_main{$i}" + ], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => "{$basis['image']}: {$objekt['visibility']}", + "explica" => "", ], "image_main{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => [ + "image_name{$i}", "image_owner{$i}", "image_rights{$i}", "image_visible{$i}" + ], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $object['main_image'], + "explica" => "", ], ]); @@ -1035,75 +1057,93 @@ for ($i = 1; $i <= 5; $i++) { [ "resource_media_type{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "resource_fileformat{$i}", "resource_location{$i}", "resource_name{$i}", "resource_owner{$i}", "resource_rights{$i}", "resource_visible{$i}", + ], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $basis['resource'] . ', ' . $tlSources['type'], + "explica" => "", ], "resource_fileformat{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "resource_media_type{$i}", "resource_location{$i}", "resource_name{$i}", "resource_owner{$i}", "resource_rights{$i}", "resource_visible{$i}", + ], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $csvxml_overview['file_format'], + "explica" => "", ], "resource_location{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "resource_media_type{$i}", "resource_fileformat{$i}", "resource_name{$i}", "resource_owner{$i}", "resource_rights{$i}", "resource_visible{$i}", + ], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $resource_incha['image_filename'], + "explica" => "", ], "resource_name{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "resource_media_type{$i}", "resource_fileformat{$i}", "resource_location{$i}", "resource_owner{$i}", "resource_rights{$i}", "resource_visible{$i}", + ], "remark" => '', "name_human_readable" => $resource_incha['resource_name'], "explica" => $resource_incha['bildname_explica'], ], "resource_description{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "resource_media_type{$i}", "resource_fileformat{$i}", "resource_location{$i}", "resource_name{$i}", "resource_owner{$i}", "resource_rights{$i}", "resource_visible{$i}", + ], "remark" => '', "name_human_readable" => $resource_incha['resource_description'], "explica" => $resource_incha['bildbesch_explica'], ], "resource_owner{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "resource_media_type{$i}", "resource_fileformat{$i}", "resource_location{$i}", "resource_name{$i}", "resource_rights{$i}", "resource_visible{$i}", + ], "remark" => '', "name_human_readable" => $resource_incha['resource_rightsholder'], "explica" => $resource_incha['owner_explica'], ], "resource_creator{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => [ + "resource_media_type{$i}", "resource_fileformat{$i}", "resource_location{$i}", "resource_name{$i}", "resource_owner{$i}", "resource_rights{$i}", "resource_visible{$i}", + ], "remark" => '', "name_human_readable" => $resource_incha['creator'], "explica" => $resource_incha['creator_explica'], ], "resource_rights{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => array_keys($availableLicenses), + "dependsOn" => [ + "resource_media_type{$i}", "resource_fileformat{$i}", "resource_location{$i}", "resource_name{$i}", "resource_owner{$i}", "resource_visible{$i}", + ], "remark" => '', "name_human_readable" => $resource_incha['rights_status'], "explica" => $resource_incha['rechte_explica'], ], "resource_visible{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => [ + "resource_media_type{$i}", "resource_fileformat{$i}", "resource_location{$i}", "resource_name{$i}", "resource_owner{$i}", "resource_rights{$i}", + ], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => "{$basis['resource']}: {$objekt['visibility']}", + "explica" => "", ], ]); @@ -1114,15 +1154,17 @@ for ($i = 1; $i <= 5; $i++) { * * @param string $nameTL Translation of the field name. Optional. * @param string $explica Explanation of the field (from musdb). Optional. - * @param string $allowedValues Allowed values. Optional. + * @param array $dependsOn Dependent fields. Optional. + * @param array $allowedValues Allowed values. Optional. * @param string $remark Explanation of the field (for importer). Optional. * @param boolean $required Determines whether the field is required. Defaults to false. */ -function getSimpleAvailableFieldEntry($nameTL = "", $explica = "", $allowedValues = "", $remark = "", $required = false):array { +function getSimpleAvailableFieldEntry(string $nameTL = "", string $explica = "", array $dependsOn = [], array $allowedValues = [], string $remark = "", bool $required = false):array { return [ "required" => $required, "allowedValues" => $allowedValues, + "dependsOn" => $dependsOn, "remark" => $remark, "name_human_readable" => $nameTL, "explica" => $explica, @@ -1132,21 +1174,24 @@ function getSimpleAvailableFieldEntry($nameTL = "", $explica = "", $allowedValue /** * Function for building a generic event type definition. * - * @param string $type Event type name (e.g. production). - * @param integer $number Number of event of this type. + * @param string[] $event Translation variable. + * @param string[] $csvxml_overview Translation variable. + * @param string $typeName Translated name of event type. + * @param string $type Event type name (e.g. production). + * @param integer $number Number of event of this type. * * @return array */ -function generateGenericFullEvent(string $type, int $number):array { +function generateGenericFullEvent(array $event, array $csvxml_overview, string $typeName, string $type, int $number):array { return [ - "{$type}_when{$number}" => getSimpleAvailableFieldEntry("Hallo", "hi"), - "{$type}_when_sure{$number}" => getSimpleAvailableFieldEntry("", "", '"y" / "n"'), - "{$type}_who{$number}" => getSimpleAvailableFieldEntry("Hallo", "hi"), - "{$type}_who_sure{$number}" => getSimpleAvailableFieldEntry("", "", '"y" / "n"'), - "{$type}_where{$number}" => getSimpleAvailableFieldEntry("Hallo", "hi"), - "{$type}_where_sure{$number}" => getSimpleAvailableFieldEntry("", "", '"y" / "n"'), - "{$type}_annotation{$number}" => getSimpleAvailableFieldEntry("Hallo", "hi"), + "{$type}_when{$number}" => getSimpleAvailableFieldEntry($typeName . ": " . $event['when'], "", ["{$type}_when_sure{$number}"]), + "{$type}_when_sure{$number}" => getSimpleAvailableFieldEntry($typeName . ": " . $event['when'] . " [{$csvxml_overview['certainty']}]", "", ["{$type}_when{$number}"], ["y", "n"]), + "{$type}_who{$number}" => getSimpleAvailableFieldEntry($typeName . ": " . $event['who'], "", ["{$type}_who_sure{$number}"]), + "{$type}_who_sure{$number}" => getSimpleAvailableFieldEntry($typeName . ": " . $event['who'] . " [{$csvxml_overview['certainty']}]", "", ["{$type}_who{$number}"], ["y", "n"]), + "{$type}_where{$number}" => getSimpleAvailableFieldEntry($typeName . ": " . $event['where'], "", ["{$type}_where_sure{$number}"]), + "{$type}_where_sure{$number}" => getSimpleAvailableFieldEntry($typeName . ": " . $event['where'] . " [{$csvxml_overview['certainty']}]", "", ["{$type}_where{$number}"], ["y", "n"]), + "{$type}_annotation{$number}" => getSimpleAvailableFieldEntry($typeName . ": " . $event['classic_annotation_intro'], ""), ]; @@ -1155,28 +1200,28 @@ function generateGenericFullEvent(string $type, int $number):array { for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[1]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[1]], - generateGenericFullEvent("production", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[1], "production", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[2]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[2]], - generateGenericFullEvent("finding", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[2], "finding", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[3]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[3]], - generateGenericFullEvent("publication", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[3], "publication", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[4]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[4]], - generateGenericFullEvent("template_creation", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[4], "template_creation", $i) ); } @@ -1186,19 +1231,19 @@ for ($i = 1; $i <= 2; $i++) { [ "was_depicted_who{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["was_depicted_who_sure{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $event['who'], + "explica" => "", ], "was_depicted_who_sure{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => ["was_depicted_who{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $event['who'] . " [{$csvxml_overview['certainty']}]", + "explica" => "", ], ]); @@ -1210,19 +1255,19 @@ for ($i = 1; $i <= 2; $i++) { [ "was_depicted_place{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["was_depicted_place_sure{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $event['where'], + "explica" => "", ], "was_depicted_place_sure{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => ["was_depicted_place{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $event['where'] . " [{$csvxml_overview['certainty']}]", + "explica" => "", ], ]); @@ -1231,182 +1276,182 @@ for ($i = 1; $i <= 2; $i++) { for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[6]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[6]], - generateGenericFullEvent("was_used", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[6], "was_used", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[7]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[7]], - generateGenericFullEvent("written", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[7], "written", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[8]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[8]], - generateGenericFullEvent("collected", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[8], "collected", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[9]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[9]], - generateGenericFullEvent("painted", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[9], "painted", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[10]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[10]], - generateGenericFullEvent("taken", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[10], "taken", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[11]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[11]], - generateGenericFullEvent("received", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[11], "received", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[12]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[12]], - generateGenericFullEvent("printing_plate_produced", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[12], "printing_plate_produced", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[13]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[13]], - generateGenericFullEvent("sent", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[13], "sent", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[14]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[14]], - generateGenericFullEvent("issued", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[14], "issued", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[15]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[15]], - generateGenericFullEvent("signed", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[15], "signed", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[16]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[16]], - generateGenericFullEvent("type_described", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[16], "type_described", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[19]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[19]], - generateGenericFullEvent("drawn", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[19], "drawn", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[20]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[20]], - generateGenericFullEvent("copied", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[20], "copied", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[25]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[25]], - generateGenericFullEvent("commissioned", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[25], "commissioned", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[26]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[26]], - generateGenericFullEvent("printed", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[26], "printed", $i) ); } for ($i = 1; $i <= 2; $i++) { - $availableFields[$basis['event'] . ': spoken'] = array_merge( - $availableFields[$basis['event'] . ': spoken'], - generateGenericFullEvent("spoken", $i) + $availableFields[$basis['event'] . ': ' . $eventname[27]] = array_merge( + $availableFields[$basis['event'] . ': ' . $eventname[27]], + generateGenericFullEvent($event, $csvxml_overview, $eventname[27], "spoken", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[28]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[28]], - generateGenericFullEvent("sung", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[28], "sung", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[29]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[29]], - generateGenericFullEvent("decor_designed", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[29], "decor_designed", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[30]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[30]], - generateGenericFullEvent("form_designed", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[30], "form_designed", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[31]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[31]], - generateGenericFullEvent("modelled", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[31], "modelled", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[32]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[32]], - generateGenericFullEvent("signed", $i) // TODO: Falsch + generateGenericFullEvent($event, $csvxml_overview, $eventname[32], "signed_artwork", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[33]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[33]], - generateGenericFullEvent("was_mentioned", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[33], "was_mentioned", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[34]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[34]], - generateGenericFullEvent("buried", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[34], "buried", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[35]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[35]], - generateGenericFullEvent("intellectual_creation", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[35], "intellectual_creation", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[37]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[37]], - generateGenericFullEvent("painted_on", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[37], "painted_on", $i) ); } for ($i = 1; $i <= 2; $i++) { $availableFields[$basis['event'] . ': ' . $eventname[38]] = array_merge( $availableFields[$basis['event'] . ': ' . $eventname[38]], - generateGenericFullEvent("illustrated", $i) + generateGenericFullEvent($event, $csvxml_overview, $eventname[38], "illustrated", $i) ); } @@ -1416,43 +1461,43 @@ for ($i = 1; $i <= 2; $i++) { [ "has_lived_when{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["has_lived_when_sure{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $event['when'], + "explica" => "", ], "has_lived_when_sure{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => ["has_lived_when{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $event['when'] . " [{$csvxml_overview['certainty']}]", + "explica" => "", ], "has_lived_where{$i}" => [ "required" => false, - "allowedValues" => 'freetext', - "dependsOn" => [], + "allowedValues" => [], + "dependsOn" => ["has_lived_where_sure{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $event['where'], + "explica" => "", ], "has_lived_where_sure{$i}" => [ "required" => false, - "allowedValues" => '"y" / "n"', - "dependsOn" => [], + "allowedValues" => ["y", "n"], + "dependsOn" => ["has_lived_where{$i}"], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $event['where'] . " [{$csvxml_overview['certainty']}]", + "explica" => "", ], "has_lived_annotation{$i}" => [ "required" => false, "allowedValues" => '', "dependsOn" => [], "remark" => '', - "name_human_readable" => $museum['museum_name'], - "explica" => $museum['musnam_explica'], + "name_human_readable" => $event['classic_annotation_intro'], + "explica" => "", ], ]); diff --git a/zipit.php b/zipit.php index a0b47f5..6807977 100644 --- a/zipit.php +++ b/zipit.php @@ -1,5 +1,8 @@