From ac1e0770b199ae69173c71e21bcb40430ee8d591 Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Sun, 15 Sep 2024 21:12:45 +0300 Subject: [PATCH] entities create --- views/pages/Admin/EntityCreate.php | 31 ++++++++++++++++++++++++++++-- views/pages/Register.php | 2 +- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/views/pages/Admin/EntityCreate.php b/views/pages/Admin/EntityCreate.php index 59f3c2e..343358a 100644 --- a/views/pages/Admin/EntityCreate.php +++ b/views/pages/Admin/EntityCreate.php @@ -1,8 +1,34 @@ $value) { + if (strpos($key, 'variable') === 0) { + preg_match('/_(\d+)$/', $key, $matches); + if (isset($matches[1])) { + $index = $matches[1]; + + if (!isset($result[$index])) { + $result[$index] = []; + } + $newKey = preg_replace('/^variable/', '', $key); + $newKey = preg_replace('/_\d+$/', '', $newKey); + + $result[$index][$newKey] = $value; + } + } + } + + $jsonResult = json_encode($result, JSON_PRETTY_PRINT); + + header('Content-Type: application/json'); + echo $jsonResult; +} ?>

Создание сущности

-
+
@@ -45,9 +71,10 @@
+ - +