-';
-
- return $output;
-
-}
-
-/**
- * Function generateHelpTooltip returns a tooltip for hovering over using the common settings.
- *
- * @param string $identifier ID attribute of the tooltip.
- * @param string $title Title of the tooltip.
- * @param string $explica More in-depth explanation: body of the tooltip.
- * @param boolean $setParagraph If set to true (default), the content of the tooltip will be put into a
5: Dependent colums observed ? ';
-
-
-// Check for correct handling of dependent fields
-foreach ($fieldsWithDependency as $tField => $tDependentFields) {
- if (array_search($tField, $erstezeile) !== false) {
- foreach ($tDependentFields as $tDependentField) {
- if (array_search($tDependentField, $erstezeile) === false) {
- $depencymessage[] = "Dependency issue at column $tField: Corresponding column $tDependentField is missing";
- }
- }
- }
-}
-
-if (!empty($depencymessage)) {
- echo 'Dependent columns were not observed !';
- foreach ($depencymessage as $tDepMsg) {
- $validator->addError(' ' . $tDepMsg);
- }
-} else {
- echo 'Dependent columns were observed !';
-}
-
-///// Check #6
-echo '
6: Dependency of content observed?';
-
-//TODO: get the values for these arrays dynamically?
-// JRE: Maybe we can merge them into availablefields
-$crosscheck1 = ['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 = ['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'];
-
-foreach ($crosscheck1 as $l => $tCrossCheck) {
-
- if (in_array($tCrossCheck, $erstezeile)) {
-
- for ($j = 1; $j < ($y + 1); $j++) {
- if ($inhalt[$j][array_search($crosscheck2[$l], $erstezeile)] !== '' and $inhalt[$j][array_search($tCrossCheck, $erstezeile)] == '') {
- $validator->addDepconError(
- ' Tag ' . $crosscheck2[$l] . ' given but no entry for '
- . $tCrossCheck . ' (row ' . $j . ')'
- );
- }
- }
-
- }
-
-}
-
-foreach ($eventpart as $l => $tEventPart) {
- if (in_array($tEventPart, $erstezeile)) {
- for ($j = 1; $j < ($y + 1); $j++) {
- if ($inhalt[$j][array_search($eventpartsure[$l], $erstezeile)] !== '' and $inhalt[$j][array_search($tEventPart, $erstezeile)] == '') {
- $validator->addDepconError(
- ' Tag ' . $eventpartsure[$l] . ' given but no entry for '
- . $tEventPart . ' (row ' . $j . ')'
- );
- }
- }
- }
-}
-
-if (in_array('dimensions_separate_show_md', $erstezeile)) {
- for ($j = 1; $j < ($y + 1); $j++) {
- if ($inhalt[$j][array_search('dimensions_separate_show_md', $erstezeile)] !== '' and ($inhalt[$j][array_search('dimensions_separate_length_value', $erstezeile)] == '') and $inhalt[$j][array_search('dimensions_separate_width_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_heigt_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_weight_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_diameter_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_wall_thickness_value', $erstezeile)] == '') {
- $validator->addDepconError(
- ' Tag dimensions_separate_show_md given but no separate values available (row '
- . $j . ')'
- );
- }
- }
-}
-
-if (in_array('dimensions_separate_show_extern', $erstezeile)) {
- for ($j = 1; $j < ($y + 1); $j++) {
- if ($inhalt[$j][array_search('dimensions_separate_show_extern', $erstezeile)] !== '' and ($inhalt[$j][array_search('dimensions_separate_length_value', $erstezeile)] == '') and $inhalt[$j][array_search('dimensions_separate_width_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_heigt_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_weight_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_diameter_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_wall_thickness_value', $erstezeile)] == '') {
- $validator->addDepconError(
- ' Tag dimensions_separate_show_extern given but no separate values available (row '
- . $j . ')'
- );
- }
- }
-}
-/*
-for ($im=1;$im<11;$im++)
-{
- if (in_array('image_name'.$im,$erstezeile))
- {
- for ($j=1;$j<($y+1);$j++)
- {
- if ($inhalt[$j][array_search('image_rights'.$im,$erstezeile)]!=='')
- {
- echo ' TAG image_name'.$im.' given but no value available for image_rights'.$im.' (row '.$j.')';
- $depcon_error=$depcon_error+1;
- }
- if ($inhalt[$j][array_search('image_visible'.$im,$erstezeile)]!=='')
- {
- echo ' TAG image_name'.$im.' given but no value available for image_visible'.$im.' (row '.$j.')';
- $depcon_error=$depcon_error+1;
- }
- }
- }
-}
-*/
-if (count($validator->depcon_errors) == 0) {
- echo ' Dependency of content was observed !';
-}
-
-///// Check #7
-echo '
7: Not allowed values in controlled lists? ';
-for ($i = 2; $i <= $y; $i++) {
-
- foreach ($inhalt[$i] as $key => $value) {
-
- $columnName = $inhalt[1][$key];
- // Only do the check if the field is not restricted
- if (isset($fieldsWithAllowedValueSet[$columnName])) {
-
- // For others: check if the value is from the list of allowed values.
- if (!in_array($value, $fieldsWithAllowedValueSet[$columnName])) {
-
- // It may be that the value is empty together with all dependent fields,
- // because it's in a repeat field that was needed earlier.
- if (empty($value) && !empty($fieldsWithDependency[$columnName])) {
-
- $allDependentsEmpty = true;
- foreach ($fieldsWithDependency[$columnName] as $depField) {
- // Find keys of dependent field
- $depFieldKey = array_search($depField, $inhalt[1]);
- if (!empty($inhalt[$i][$depFieldKey])) {
- $allDependentsEmpty = false;
- break;
- }
- }
-
- if ($allDependentsEmpty !== true) {
- $errormessage[] = "Disallowed value in column {$columnName} on row {$i}: "
- . $value . " (allowed values: "
- . implode(", ", $fieldsWithAllowedValueSet[$columnName])
- . ")";
- }
-
- }
-
- }
-
- }
- }
-}
-
-if (!empty($errormessage)) {
- echo 'Columns with controlled values contain invalid values !';
- foreach ($errormessage as $tMsg) {
- $validator->addError(' ' . $tMsg);
- }
-} else {
- echo 'Values in controlled fields are all valid !';
-}
-
-///// Check #8
-unset($errormessage);
-echo '
8: Main image or main resource given? ';
-$hasanyimage = 0;
-for ($im = 1; $im < 29; $im++) {
- if (array_search('image_name' . $im, $erstezeile) != '') {
- $imagemain[$im]['name'] = array_search('image_name' . $im, $erstezeile);$hasanyimage++;
- }
- if (array_search('image_visible' . $im, $erstezeile) != '') {
- $imagemain[$im]['visible'] = array_search('image_visible' . $im, $erstezeile);
- }
- if (array_search('image_main' . $im, $erstezeile) != '') {
- $imagemain[$im]['main'] = array_search('image_main' . $im, $erstezeile);
- }
-}
-
-if ($hasanyimage > 0) {
- $imagemain = array_values($imagemain);
- for ($i = 1; $i <= $y; $i++) {
- if ($i > 1) {
- //check if in a row any image_name is given
- $maimg = $hatimg = 0;
- foreach ($imagemain as $im => $tMainImage) {
- if ($inhalt[$i][$tMainImage["name"]] != '') $hatimg++;
- }
- if ($hatimg > 0) {
- // first check: how many main-images?
- foreach ($imagemain as $im => $tMainImage) {
- if ($inhalt[$i][$imagemain[$im]['main']] == 'y') {
- $maimg++;
- $merk = $im;
- }
- }
- // if there is exacly one main-image, is it visible?
- if ($maimg == 1) {
- if ($inhalt[$i][$imagemain[$merk]['visible']] == 'n') {
- $errormessage[] = 'Main image in row ' . $i . ' is not visible';
- }
- }
- }
- if ($maimg == 0 and $hatimg > 0) {
- $errormessage[] = 'There is no visible main image given in row ' . $i . '';
- }
- if ($maimg > 1 and $hatimg > 0) {
- $errormessage[] = 'There are ' . $maimg . ' main images given in row ' . $i . '';
- }
- }
- }
-
- if (!empty($errormessage)) {
- echo 'There is not one main image for each object !';
- foreach ($errormessage as $tMsg) {
- $validator->addError(' ' . $tMsg);
- }
- } else {
- echo 'For each object that has images attached exactly one main image is given !';
- }
-} else {
- echo 'No images to be imported !';
-}
-
-echo '';
-
-if ($validator->overallErrorCount() > 0) {
- echo '
-