From 8d40af4972f31568b5f0a08e3d7383ea127b3449 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 9 Jun 2023 17:39:31 +0000 Subject: [PATCH] continue implementation --- Theme/Backend/Components/AttributeView.php | 69 +++++++++ Theme/Backend/Components/attributes.tpl.php | 146 ++++++++++++++++++++ Theme/Backend/Components/list.tpl.php | 0 Theme/Backend/Lang/en.lang.php | 4 + 4 files changed, 219 insertions(+) create mode 100644 Theme/Backend/Components/AttributeView.php create mode 100644 Theme/Backend/Components/attributes.tpl.php create mode 100644 Theme/Backend/Components/list.tpl.php diff --git a/Theme/Backend/Components/AttributeView.php b/Theme/Backend/Components/AttributeView.php new file mode 100644 index 0000000..fb34a0d --- /dev/null +++ b/Theme/Backend/Components/AttributeView.php @@ -0,0 +1,69 @@ +setTemplate('/Modules/Attribute/Theme/Backend/Components/attributes'); + } + + /** + * {@inheritdoc} + */ + public function render(mixed ...$data) : string + { + /** @var array{0:\Modules\Attribute\Models\Attribute[]} $data */ + $this->attributes = $data[0]; + $this->attributeTypes = $data[1]; + $this->units = $data[2]; + $this->apiUri = $data[3]; + + return parent::render(); + } +} diff --git a/Theme/Backend/Components/attributes.tpl.php b/Theme/Backend/Components/attributes.tpl.php new file mode 100644 index 0000000..0898e44 --- /dev/null +++ b/Theme/Backend/Components/attributes.tpl.php @@ -0,0 +1,146 @@ +attributes; +$languages = ISO639Enum::getConstants(); +$types = $this->attributeTypes; +$units = $this->units; + +/** @var \phpOMS\Localization\Localization $l11n */ +$l11n = $this->data['defaultlocalization'] ?? new NullLocalization(); +?> + +
+
+
+
getHtml('Attribute', 'Attribute', 'Backend'); ?>
+
+
+ + +
+ + + +
+ + +
+ +
+ + +
+ +
+ +

+                
+
+
+ + + +
+
+
+
+ +
+
+
getHtml('Attributes', 'Attribute', 'Backend'); ?>
+
+ + + + + + $value) : ++$c; ?> + + +
+ getHtml('ID', '0', '0'); ?> + getHtml('Name', 'Attribute', 'Backend'); ?> + getHtml('Value', 'Attribute', 'Backend'); ?> + getHtml('Unit', 'Attribute', 'Backend'); ?> +
+ + type->isRequired) : ?> + + + + + + + + id; ?> + printHtml($value->type->getL11n()); ?> + value->getValue() instanceof \DateTime ? $value->value->getValue()->format('Y-m-d') : $this->printHtml((string) $value->value->getValue()); ?> + printHtml($value->value->unit); ?> + + +
getHtml('Empty', '0', '0'); ?> + +
+
+
+
diff --git a/Theme/Backend/Components/list.tpl.php b/Theme/Backend/Components/list.tpl.php new file mode 100644 index 0000000..e69de29 diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 0711d22..667d6f8 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -15,10 +15,14 @@ declare(strict_types=1); return ['Attribute' => [ 'AttributeTypes' => 'Attribute Types', 'Attribute' => 'Attribute', + 'Attributes' => 'Attributes', 'Name' => 'Name', 'Title' => 'Title', 'Datatype' => 'Datatype', 'Status' => 'Status', + 'Type' => 'Type', + 'Unit' => 'Unit', + 'Value' => 'Value', 'DefaultValues' => 'Default Values', 'Pattern' => 'Pattern', 'IsRequired' => 'Is required?',