2019-08-25 21:45:52 +02:00
|
|
|
<?PHP
|
2019-08-30 23:13:46 +02:00
|
|
|
declare(strict_types = 1);
|
2020-10-31 00:00:26 +01:00
|
|
|
require_once __DIR__ . "/../functions/functions.php";
|
2019-08-30 23:13:46 +02:00
|
|
|
|
2020-07-21 23:48:39 +02:00
|
|
|
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';
|
2021-05-26 01:08:52 +02:00
|
|
|
} else if (!isset($_SESSION['lang'])) {
|
2020-08-10 20:13:16 +02:00
|
|
|
$_SESSION['lang'] = MD_STD::lang_getfrombrowser($allowed_langs, 'en', "", false);
|
2020-07-21 23:48:39 +02:00
|
|
|
}
|
|
|
|
$lang = $_SESSION['lang'];
|
2020-11-08 14:44:06 +01:00
|
|
|
$tlLoader = new MDTlLoader("csxml_evaluate", $lang);
|
2020-07-21 23:48:39 +02:00
|
|
|
|
|
|
|
$filename = $_GET['fnam'];
|
2020-10-31 00:00:26 +01:00
|
|
|
$csv_datei = MD_STD::realpath(__DIR__ . '/../csv/' . $filename);
|
2020-07-21 23:48:39 +02:00
|
|
|
|
|
|
|
// Get allowed values * $fieldNoMultiplicator
|
|
|
|
$fieldNoMultiplicator = 10;
|
2020-10-31 01:28:03 +01:00
|
|
|
$fieldsGetter = new CsvxmlAvailableFields($lang);
|
|
|
|
$availableFields = $fieldsGetter->getFields();
|
2020-07-21 23:48:39 +02:00
|
|
|
|
|
|
|
$allowed = $eventpart = $eventpartsure = $fieldsWithDependency = $fieldsWithAllowedValueSet = [];
|
|
|
|
|
|
|
|
foreach ($availableFields as $categoryName => $fieldCategory) {
|
|
|
|
$allowed = array_merge($allowed, array_keys($fieldCategory));
|
|
|
|
|
|
|
|
// Extended operations for events
|
2020-11-08 14:44:06 +01:00
|
|
|
if (strpos($categoryName, $tlLoader->tl("basis", "basis", 'event')) !== false) {
|
2020-07-21 23:48:39 +02:00
|
|
|
foreach ($fieldCategory as $key => $value) {
|
|
|
|
if (strpos($key, "_annotation") !== false or strpos($key, "_gnd") !== 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_inclusion_kind_of = ['inclusion_kind_of', 'Schenkung', 'Kauf', 'Grabung', 'Notbergung', 'Erbschaft', 'Stiftung', 'Enteignung', 'Ursprungsbestand', 'Ajándékozás','Vétel','Feltárás','Hivatalos átadás','Csere','Gyűjtés','Saját előállítás','Törzsanyag','Letét', 'endowment', 'dispossession', 'old stock', ''];
|
|
|
|
|
2019-08-30 23:13:46 +02:00
|
|
|
echo printHTMLHead();
|
|
|
|
|
2019-08-25 21:45:52 +02:00
|
|
|
echo '<div class="maincontent">';
|
2020-07-21 23:48:39 +02:00
|
|
|
echo 'Please wait ... (checking validity)';
|
|
|
|
echo '<form action="index.php" style="margin:0px;padding:0px;">';
|
|
|
|
echo '<input type="submit" value="Reload" />';
|
2019-08-25 21:45:52 +02:00
|
|
|
echo '</form>';
|
2020-07-21 23:48:39 +02:00
|
|
|
|
|
|
|
///// Check #1
|
|
|
|
//echo '<pre>';print_r($allowed);echo '</pre>';
|
|
|
|
echo '1: Only allowed tags (column names) used?';
|
2021-06-13 23:00:36 +02:00
|
|
|
$fp = fopen($csv_datei, 'r');
|
2020-07-21 23:48:39 +02:00
|
|
|
$y = 1;
|
|
|
|
$error = 0;
|
2021-06-13 23:00:36 +02:00
|
|
|
$zeile = fgetcsv($fp, 100000, ';');
|
2020-07-21 23:48:39 +02:00
|
|
|
$maxLoopLen = count($zeile);
|
|
|
|
for ($x = 0; $x < $maxLoopLen; $x++) {
|
|
|
|
|
|
|
|
$zeile[$x] = str_replace("\xEF\xBB\xBF", "", $zeile[$x]);
|
|
|
|
$inhalt[$y][$x] = $zeile[$x];
|
|
|
|
if (!in_array($inhalt[1][$x], $allowed)) {
|
|
|
|
echo '<br><i style="font-style:normal;color:#990000;">ERROR in column ' . $x . ' created by value: ' . $inhalt[1][$x] . '</i>';
|
|
|
|
$error = $error + 1;
|
|
|
|
}
|
|
|
|
//echo '<br/>';var_dump($inhalt[1][$x]);
|
|
|
|
}
|
|
|
|
fclose($fp);
|
|
|
|
$erstezeile = $zeile;
|
|
|
|
if ($error != 0) echo '<br><b style="color:#990000;">Not allowed tags found !</b>'; else echo '<br><i style="font-style:normal;color:#009900;">Only allowed tags used !</i>';
|
|
|
|
|
|
|
|
//// Check #2
|
|
|
|
echo '<br><br>2: Not allowed multiple use of tags (column names)?';
|
|
|
|
$compare = array_unique($zeile);
|
|
|
|
|
2021-06-13 23:00:36 +02:00
|
|
|
if (count($zeile) != count($compare)) {
|
|
|
|
echo '<br><b style="color:#990000;">There are duplicate column names !</b>';
|
2020-07-21 23:48:39 +02:00
|
|
|
$error = $error + 1;
|
2021-05-26 01:08:52 +02:00
|
|
|
} else {
|
2021-06-13 23:00:36 +02:00
|
|
|
echo '<br><i style="font-style:normal;color:#009900;">No duplicate column names !</i>';
|
2020-07-21 23:48:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//// Get values into memory for following checks
|
2021-05-26 01:08:52 +02:00
|
|
|
//TODO: Merge with loop on line 74
|
2020-10-31 00:00:26 +01:00
|
|
|
$fp = fopen($csv_datei, 'r');
|
2020-07-21 23:48:39 +02:00
|
|
|
$y = 0;
|
|
|
|
while ($zeile = fgetcsv($fp, 100000, ';')) {
|
|
|
|
|
|
|
|
$y++;
|
|
|
|
$maxLoopLen = count($zeile);
|
|
|
|
for ($x = 0; $x < $maxLoopLen; $x++) {
|
|
|
|
$inhalt[$y][$x] = str_replace("'", "\'", $zeile[$x]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose($fp);
|
|
|
|
|
|
|
|
///// Check #3
|
|
|
|
echo '<br><br>3: Mandatory tags available and always filled in?';
|
|
|
|
unset($inv_array);
|
|
|
|
$inv_error = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function for finding duplicates?.
|
|
|
|
*
|
|
|
|
* @param array $array Input array.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2021-06-13 23:00:36 +02:00
|
|
|
function Get_duplicates(array $array):array
|
2021-05-26 01:08:52 +02:00
|
|
|
{
|
2020-07-21 23:48:39 +02:00
|
|
|
return array_unique(array_diff_assoc($array, array_unique($array)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-05-26 01:08:52 +02:00
|
|
|
//TODO: function for returning the error strings & counting errors
|
2020-07-21 23:48:39 +02:00
|
|
|
$mandatory = ['inventory_number','object_type','object_title','object_description'];
|
|
|
|
foreach ($mandatory as $tMandatoryField) {
|
|
|
|
if (!in_array($tMandatoryField, $erstezeile)) {
|
|
|
|
echo '<br><i style="font-style:normal;color:#990000;">Mandatory: Column <b>' . $tMandatoryField . '</b> missing</i>';
|
|
|
|
$error = $error + 1;
|
|
|
|
$inv_error = $inv_error + 1;
|
2021-05-26 01:08:52 +02:00
|
|
|
} else {
|
2020-07-21 23:48:39 +02:00
|
|
|
$spaltenr = array_search($tMandatoryField, $erstezeile);
|
|
|
|
for ($j = 0; $j < $y; $j++) {
|
|
|
|
if ($inhalt[$j + 1][$spaltenr] == '') {
|
|
|
|
echo '<br><i style="font-style:normal;color:#990000;">Missing value for <b>' . $tMandatoryField . '</b> in row ' . ($j + 1) . '</i>';
|
|
|
|
$error = $error + 1;
|
|
|
|
$inv_error = $inv_error + 1;
|
|
|
|
}
|
|
|
|
if ($tMandatoryField == 'inventory_number') {
|
|
|
|
$inv_array[] = $inhalt[$j + 1][$spaltenr];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-26 01:08:52 +02:00
|
|
|
|
|
|
|
if ($inv_error == 0) {
|
|
|
|
echo '<br><i style="font-style:normal;color:#009900;">All mandatory tags available and with values !</i>';
|
|
|
|
}
|
2020-07-21 23:48:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
///// Check #4
|
|
|
|
echo '<br><br>4: Inventory_number unique ?';
|
|
|
|
if (in_array('inventory_number', $erstezeile)) {
|
2021-06-13 23:00:36 +02:00
|
|
|
$doppelte_inv = Get_duplicates($inv_array);
|
2020-07-21 23:48:39 +02:00
|
|
|
$doppelte_inv = array_values($doppelte_inv);
|
|
|
|
if (!empty($doppelte_inv)) {
|
|
|
|
foreach ($doppelte_inv as $tDublicateInvNo) {
|
|
|
|
echo '<br><i style="font-style:normal;color:#990000;">Multiple use of inventory_number <b>' . $tDublicateInvNo . '</b></i>';
|
|
|
|
$error = $error + 1;
|
|
|
|
}
|
2021-05-26 01:08:52 +02:00
|
|
|
} else {
|
|
|
|
echo '<br><i style="font-style:normal;color:#009900;">All inventory_numbers are unique !</i>';
|
2020-07-21 23:48:39 +02:00
|
|
|
}
|
2021-05-26 01:08:52 +02:00
|
|
|
} else {
|
2020-07-21 23:48:39 +02:00
|
|
|
echo '<br><b style="font-style:normal;color:#990000;">Aborted, column inventory_number is missing</b>';
|
|
|
|
$error = $error + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
///// Check #5
|
|
|
|
echo '<br><br>5: Dependent colums observed ?<br>';
|
|
|
|
|
|
|
|
|
|
|
|
// Check for correct handling of dependent fields
|
|
|
|
foreach ($fieldsWithDependency as $tField => $tDependentFields) {
|
2021-06-13 23:00:36 +02:00
|
|
|
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";
|
|
|
|
}
|
2020-07-21 23:48:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($depencymessage)) {
|
|
|
|
echo '<b style="color:#990000;">Dependent columns were not observed !</b>';
|
|
|
|
foreach ($depencymessage as $tDepMsg) {
|
|
|
|
echo '<br>' . $tDepMsg;
|
|
|
|
$error = $error + 1;
|
|
|
|
}
|
2021-05-26 01:08:52 +02:00
|
|
|
} else {
|
2020-07-21 23:48:39 +02:00
|
|
|
echo '<i style="font-style:normal;color:#009900;">Dependent columns were observed !</i>';
|
|
|
|
}
|
|
|
|
|
|
|
|
///// Check #6
|
|
|
|
echo '<br><br>6: Dependency of content observed?';
|
|
|
|
|
2021-05-26 01:08:52 +02:00
|
|
|
//TODO: get the values for these arrays dynamically?
|
2021-06-13 23:00:36 +02:00
|
|
|
// JRE: Maybe we can merge them into availablefields
|
2020-07-21 23:48:39 +02:00
|
|
|
$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'];
|
|
|
|
|
|
|
|
$depcon_error = 0;
|
|
|
|
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)] == '') {
|
|
|
|
echo '<br>Tag <b>' . $crosscheck2[$l] . '</b> given but no entry for <b>' . $tCrossCheck . '</b> (row ' . $j . ')';
|
|
|
|
$depcon_error++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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)] == '') {
|
|
|
|
echo '<br>Tag <b>' . $eventpartsure[$l] . '</b> given but no entry for <b>' . $tEventPart . '</b> (row ' . $j . ')';
|
|
|
|
$depcon_error++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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)] == '') {
|
|
|
|
echo '<br>Tag <b>dimensions_separate_show_md</b> given but no separate values available (row ' . $j . ')';
|
|
|
|
$depcon_error = $depcon_error + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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)] == '') {
|
|
|
|
echo '<br>Tag <b>dimensions_separate_show_extern</b> given but no separate values available (row ' . $j . ')';
|
|
|
|
$depcon_error = $depcon_error + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
for ($im=1;$im<11;$im++)
|
|
|
|
{
|
|
|
|
if (in_array('image_name'.$im,$erstezeile))
|
|
|
|
{
|
|
|
|
for ($j=1;$j<($y+1);$j++)
|
|
|
|
{
|
|
|
|
if ($inhalt[$j][array_search('image_rights'.$im,$erstezeile)]!=='')
|
|
|
|
{
|
|
|
|
echo '<br>TAG <b>image_name'.$im.'</b> given but no value available for image_rights'.$im.' (row '.$j.')';
|
|
|
|
$depcon_error=$depcon_error+1;
|
|
|
|
}
|
|
|
|
if ($inhalt[$j][array_search('image_visible'.$im,$erstezeile)]!=='')
|
|
|
|
{
|
|
|
|
echo '<br>TAG <b>image_name'.$im.'</b> given but no value available for image_visible'.$im.' (row '.$j.')';
|
|
|
|
$depcon_error=$depcon_error+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
if ($depcon_error == 0) echo '<br><i style="font-style:normal;color:#009900;">Dependency of content was observed !</i>';
|
|
|
|
|
|
|
|
///// Check #7
|
|
|
|
echo '<br><br>7: Not allowed values in controlled lists?<br>';
|
|
|
|
for ($i = 2; $i <= $y; $i++) {
|
|
|
|
|
|
|
|
foreach ($inhalt[$i] as $key => $value) {
|
|
|
|
|
|
|
|
$columnName = $inhalt[1][$key];
|
2021-06-13 23:00:36 +02:00
|
|
|
// 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;
|
|
|
|
}
|
2020-07-21 23:48:39 +02:00
|
|
|
}
|
2021-05-26 01:08:52 +02:00
|
|
|
|
2021-06-13 23:00:36 +02:00
|
|
|
if ($allDependentsEmpty !== true) {
|
|
|
|
$errormessage[] = "Disallowed value in column <code>{$columnName}</code> on row <code>{$i}</code>: <em>"
|
|
|
|
. $value . "</em> (allowed values: <small>"
|
|
|
|
. implode(", ", $fieldsWithAllowedValueSet[$columnName])
|
|
|
|
. "</small>)";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-07-21 23:48:39 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($errormessage) and $errormessage != '') {
|
|
|
|
echo '<b style="color:#990000;">Columns with controlled values contain invalid values !</b>';
|
|
|
|
foreach ($errormessage as $tMsg) {
|
|
|
|
echo '<br>' . $tMsg;
|
|
|
|
$error++;
|
|
|
|
}
|
2021-05-26 01:08:52 +02:00
|
|
|
} else {
|
2020-07-21 23:48:39 +02:00
|
|
|
echo '<i style="font-style:normal;color:#009900;">Values in controlled fields are all valid !</i>';
|
|
|
|
}
|
|
|
|
|
|
|
|
///// Check #8
|
|
|
|
unset($errormessage);
|
|
|
|
echo '<br><br>8: Main image or main resource given?<br>';
|
|
|
|
$hasanyimage = 0;
|
2021-05-26 01:08:52 +02:00
|
|
|
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);
|
2020-07-21 23:48:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($hasanyimage > 0) {
|
|
|
|
$imagemain = array_values($imagemain);
|
2021-05-26 01:08:52 +02:00
|
|
|
for ($i = 1; $i <= $y; $i++) {
|
2020-07-21 23:48:39 +02:00
|
|
|
if ($i > 1) {
|
|
|
|
//check if in a row any image_name is given
|
|
|
|
$maimg = $hatimg = 0;
|
|
|
|
foreach ($imagemain as $im => $tMainImage) {
|
2020-11-08 14:44:06 +01:00
|
|
|
if ($inhalt[$i][$tMainImage["name"]] != '') $hatimg++;
|
2020-07-21 23:48:39 +02:00
|
|
|
}
|
|
|
|
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[] = '<b style="font-weight:normal;color:#990000">Main image in row ' . $i . ' is not visible</b>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-26 01:08:52 +02:00
|
|
|
if ($maimg == 0 and $hatimg > 0) {
|
|
|
|
$errormessage[] = '<b style="font-weight:normal;color:#990000">There is no visible main image given in row ' . $i . '</b>';
|
|
|
|
}
|
|
|
|
if ($maimg > 1 and $hatimg > 0) {
|
|
|
|
$errormessage[] = '<b style="font-weight:normal;color:#990000">There are ' . $maimg . ' main images given in row ' . $i . '</b>';
|
|
|
|
}
|
2020-07-21 23:48:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($errormessage)) {
|
|
|
|
echo '<b style="color:#990000;">There is not one main image for each object !</b>';
|
|
|
|
foreach ($errormessage as $tMsg) {
|
|
|
|
echo '<br>' . $tMsg;
|
|
|
|
$error++;
|
|
|
|
}
|
2021-05-26 01:08:52 +02:00
|
|
|
} else {
|
2020-07-21 23:48:39 +02:00
|
|
|
echo '<i style="font-style:normal;color:#009900;">For each object that has images attached exactly one main image is given !</i>';
|
|
|
|
}
|
2021-05-26 01:08:52 +02:00
|
|
|
} else {
|
2020-07-21 23:48:39 +02:00
|
|
|
echo '<i style="font-style:normal;color:#009900;">No images to be imported !</i>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '<hr>';
|
|
|
|
if ($error + $depcon_error > 0) {
|
|
|
|
echo '
|
|
|
|
<p>Error(s) found: ' . ($error + $depcon_error) . '</p>';
|
2020-12-10 00:49:46 +01:00
|
|
|
echo '<a href="index6.php?fnam=' . htmlspecialchars($_GET['fnam']) . '" class="buttonLike">Create XML for md:import (utf8)</a><br>';
|
2021-05-26 01:08:52 +02:00
|
|
|
} else {
|
2020-07-21 23:48:39 +02:00
|
|
|
echo '<a href="index6.php?fnam=' . htmlspecialchars($_GET['fnam']) . '" class="buttonLike">Create XML for md:import (utf8)</a><br>';
|
|
|
|
}
|
2019-08-25 21:45:52 +02:00
|
|
|
echo '</div>';
|
2019-08-30 23:13:46 +02:00
|
|
|
echo '
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
';
|