diff options
| author | Thomas Hackl <hackl@data-quest.de> | 2026-03-17 08:58:39 +0100 |
|---|---|---|
| committer | Thomas Hackl <hackl@data-quest.de> | 2026-03-17 09:01:06 +0100 |
| commit | 7ab6009e8c6d420803d0ce249f1373bf62c59a5d (patch) | |
| tree | 9815d978be67d3dcf077f23310d3498244a3c849 /lib/classes/StudipController.php | |
| parent | 0062fad070cffd7d38024118939fe5c9d9be79d6 (diff) | |
working form validationwizard
Diffstat (limited to 'lib/classes/StudipController.php')
| -rw-r--r-- | lib/classes/StudipController.php | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/classes/StudipController.php b/lib/classes/StudipController.php index 3ac80e8..00e086e 100644 --- a/lib/classes/StudipController.php +++ b/lib/classes/StudipController.php @@ -14,6 +14,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Csv; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use Studip\WizardPart; +use Studip\Forms\Form; /** * @property StudipResponse $response @@ -608,14 +609,26 @@ abstract class StudipController extends Trails\Controller */ public function render_wizard(array $steps, bool $showAllSteps = true): void { - $this->render_vue_app( - Studip\VueApp::create('StudipWizard') - ->withProps([ - 'steps' => $steps, - 'showAllSteps' => $showAllSteps - ]) - ->withStore('wizardStore', 'useWizardStore') - ); + if (Request::get('step_id', null) !== null && Request::isXhr()) { + $step = array_find($steps, fn ($entry) => $entry->getId() === Request::get('step_id')); + + if ($step && $step->getType() === Form::class) { + $validated = $step->getContent()->validate(true); + $this->render_json($validated); + } else { + $this->set_status(404); + $this->render_nothing(); + } + + } else { + $this->render_vue_app( + Studip\VueApp::create('StudipWizard') + ->withProps([ + 'steps' => $steps, + 'showAllSteps' => $showAllSteps + ]) + ); + } } |
