From 69d10cf8d0a32bcdf9570310d685ee0c96f1a818 Mon Sep 17 00:00:00 2001
From: Nathan Eikermann
Date: Fri, 7 May 2021 20:34:45 +0200
Subject: [PATCH] using oop instead of array access
---
public/csv.php | 10 +++++-----
public/index.php | 14 +++++++-------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/public/csv.php b/public/csv.php
index a2010fd..cbfe60c 100644
--- a/public/csv.php
+++ b/public/csv.php
@@ -53,10 +53,10 @@ foreach ($availableFields as $headline => $fields) {
if ($i !== 0) $tLine1[] = "";
$tLine2[] = $fieldName;
- $tLine3[] = $field['name_human_readable'];
- # $tLine4[] = $field['remark'];
- if (!empty($field['allowedValues'])) $tLine4[] = end($field['allowedValues']);
- else $tLine4[] = $field['name_human_readable'];
+ $tLine3[] = $field->name_human_readable;
+ # $tLine4[] = $field->remark;
+ if (!empty($field->allowedValues)) $tLine4[] = end($field->allowedValues);
+ else $tLine4[] = $field->name_human_readable;
$i++;
}
@@ -76,5 +76,5 @@ else
header("Content-Disposition: attachment; filename=csvxml_museum-digital_template-{$lang}.csv");
for ($i = 2; $i <= 4; $i++) {
- echo mb_convert_encoding('"' . implode("\";\"", ${"line$i"}) . '"' . PHP_EOL, 'utf-16', 'utf-8');;
+ echo mb_convert_encoding('"' . implode("\";\"", ${"line$i"}) . '"' . PHP_EOL, 'utf-16', 'utf-8');
}
diff --git a/public/index.php b/public/index.php
index bcd674b..6bc2d6c 100644
--- a/public/index.php
+++ b/public/index.php
@@ -84,22 +84,22 @@ foreach ($availableFields as $headline => $fields) {
foreach($fields as $fieldName => $field) {
- if (!empty($field['remark']) or !empty($field['explica'])) $hasTooltip = true;
+ if (!empty($field->remark) or !empty($field->explica)) $hasTooltip = true;
else $hasTooltip = false;
echo "
- required) and $field->required === true) echo " requiredField";
echo "'";
- if (!empty($field['dependsOn'])) {
- echo " data-dependencies='" . htmlspecialchars(implode(";", $field['dependsOn'])) . "'";
+ if (!empty($field->dependsOn)) {
+ echo " data-dependencies='" . htmlspecialchars(implode(";", $field->dependsOn)) . "'";
}
echo ">{$fieldName}";
- if (!empty($field['explica'])) $toolTipExplica = "
General
" . $field['explica'];
+ if (!empty($field->explica)) $toolTipExplica = "
General
" . $field->explica;
else $toolTipExplica = "";
- $toolTip = generateHelpTooltip($fieldName, $field['name_human_readable'], "{$field['remark']}{$toolTipExplica}");
+ $toolTip = generateHelpTooltip($fieldName, "{$field->name_human_readable}", "{$field->remark}{$toolTipExplica}");
if ($hasTooltip) $tooltips[] = $toolTip[0];
echo "";
}