Loading src/UnicaenApp/Controller/Plugin/MultipageFormPlugin.php +4 −3 Changes for src/UnicaenApp/Controller/Plugin/MultipageFormPlugin.php: 4 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -214,9 +214,10 @@ class MultipageFormPlugin extends AbstractPlugin $postData = $this->getPostDataForCurrentFieldset(); $submitAction = $this->getSubmitAction($postData); $currentFieldset = $this->getCurrentFieldset(); $currentFieldset->populateValues($this->getSessionValues($currentFieldset->getName())); if ($submitAction === false) { $currentFieldset->populateValues($this->getSessionValues($currentFieldset->getName())); return [ 'fieldset' => $currentFieldset, 'stepIndex' => $this->getCurrentStepIndex(), Loading Loading @@ -651,8 +652,8 @@ class MultipageFormPlugin extends AbstractPlugin { $formData = []; foreach ($this->fieldsetActions as $formName => $action) { $formData[$formName] = $this->getSessionValues($formName); foreach ($this->fieldsetActions as $fieldsetName => $action) { $formData[$fieldsetName] = $this->getSessionValues($fieldsetName); } return $formData; Loading src/UnicaenApp/Form/MultipageForm.php +1 −1 Changes for src/UnicaenApp/Form/MultipageForm.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -478,7 +478,7 @@ abstract class MultipageForm extends Form $valueToString = $value; if ($element instanceof SearchAndSelect) { $valueToString = $value['label'] ?? $value['id'] ?? implode(' - ', $value); $valueToString = $value['label'] ?? $value['id'] ?? implode(' - ', (array)$value); } elseif ($element instanceof DoctrineObjectSelect) { foreach ($element->getValueOptions() as $key => $optionArray) { Loading src/UnicaenApp/Form/View/Helper/MultipageFormFieldset.php +54 −22 Changes for src/UnicaenApp/Form/View/Helper/MultipageFormFieldset.php: 54 added lines, 22 removed lines. Original line number Diff line number Diff line Loading @@ -84,29 +84,24 @@ class MultipageFormFieldset extends AbstractHelper } /** * Génère le code HTML. * Génère le code HTML du fieldset à l'intérieur d'une balise "form". * * @return string * @return string */ public function render() { $fieldset = $this->fieldset; $template = '<form method="POST"><fieldset><legend>%s</legend>%s</fieldset></form>'; $label = $fieldset->getLabel(); $step = "Étape"; $on = "sur"; $template = <<<EOS <form method="POST"> %s </form> EOS; if (($translator = $this->getTranslator()) !== null) { $label = $translator->translate($label, $this->getTranslatorTextDomain()); $step = $translator->translate($step, $this->getTranslatorTextDomain()); $on = $translator->translate($on, $this->getTranslatorTextDomain()); } $step = $this->translate("Étape"); $on = $this->translate("sur"); $html = sprintf($template, $label, $this->renderFieldset($fieldset)); $html = sprintf($template, $this->renderFieldset($fieldset)); if ($stepIndex = $this->view->get('stepIndex')) { $step .= " " . $stepIndex; Loading @@ -120,26 +115,50 @@ class MultipageFormFieldset extends AbstractHelper } /** * Génère le code HTML du fieldset seul. * Si un partial est fourni, il est utilisé. * * @param Fieldset $fieldset * @return string */ private function renderFieldset(Fieldset $fieldset) { $html = ''; if ($this->partial) { // fieldset $html .= $this->view->partial($this->partial); // navigation $navElement = $this->getNavigationElement(); $html .= $this->view->multipageFormNav($navElement); } else { return $this->renderFieldsetPartial(); } $template = <<<EOS <fieldset> <legend>%s</legend> %s </fieldset> EOS; /** @var Element $element */ $html = ''; foreach ($fieldset->getIterator() as $element) { $html .= $this->view->multipageFormRow($element); } $legend = $this->translate($fieldset->getLabel()); return sprintf($template, $legend, $html); } /** * Génère le code HTML du fieldset à l'aide du partial fourni. * * @return string */ protected function renderFieldsetPartial() { // fieldset $html = $this->view->partial($this->partial); // navigation $navElement = $this->getNavigationElement(); $html .= $this->view->multipageFormNav($navElement); return $html; } Loading @@ -155,4 +174,17 @@ class MultipageFormFieldset extends AbstractHelper return $element; } /** * @param string $text * @return string */ protected function translate(string $text) { if (($translator = $this->getTranslator()) !== null) { return $translator->translate($text, $this->getTranslatorTextDomain()); } return $text; } } No newline at end of file src/UnicaenApp/Form/View/Helper/MultipageFormRow.php +4 −1 Changes for src/UnicaenApp/Form/View/Helper/MultipageFormRow.php: 4 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -54,7 +54,10 @@ class MultipageFormRow extends FormRow return $this->view->formRowDateInfSup($element); } return parent::render($element); return '<div class="form-group">' . PHP_EOL . parent::render($element). PHP_EOL . '</div>' . PHP_EOL ; } } No newline at end of file Loading
src/UnicaenApp/Controller/Plugin/MultipageFormPlugin.php +4 −3 Changes for src/UnicaenApp/Controller/Plugin/MultipageFormPlugin.php: 4 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -214,9 +214,10 @@ class MultipageFormPlugin extends AbstractPlugin $postData = $this->getPostDataForCurrentFieldset(); $submitAction = $this->getSubmitAction($postData); $currentFieldset = $this->getCurrentFieldset(); $currentFieldset->populateValues($this->getSessionValues($currentFieldset->getName())); if ($submitAction === false) { $currentFieldset->populateValues($this->getSessionValues($currentFieldset->getName())); return [ 'fieldset' => $currentFieldset, 'stepIndex' => $this->getCurrentStepIndex(), Loading Loading @@ -651,8 +652,8 @@ class MultipageFormPlugin extends AbstractPlugin { $formData = []; foreach ($this->fieldsetActions as $formName => $action) { $formData[$formName] = $this->getSessionValues($formName); foreach ($this->fieldsetActions as $fieldsetName => $action) { $formData[$fieldsetName] = $this->getSessionValues($fieldsetName); } return $formData; Loading
src/UnicaenApp/Form/MultipageForm.php +1 −1 Changes for src/UnicaenApp/Form/MultipageForm.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -478,7 +478,7 @@ abstract class MultipageForm extends Form $valueToString = $value; if ($element instanceof SearchAndSelect) { $valueToString = $value['label'] ?? $value['id'] ?? implode(' - ', $value); $valueToString = $value['label'] ?? $value['id'] ?? implode(' - ', (array)$value); } elseif ($element instanceof DoctrineObjectSelect) { foreach ($element->getValueOptions() as $key => $optionArray) { Loading
src/UnicaenApp/Form/View/Helper/MultipageFormFieldset.php +54 −22 Changes for src/UnicaenApp/Form/View/Helper/MultipageFormFieldset.php: 54 added lines, 22 removed lines. Original line number Diff line number Diff line Loading @@ -84,29 +84,24 @@ class MultipageFormFieldset extends AbstractHelper } /** * Génère le code HTML. * Génère le code HTML du fieldset à l'intérieur d'une balise "form". * * @return string * @return string */ public function render() { $fieldset = $this->fieldset; $template = '<form method="POST"><fieldset><legend>%s</legend>%s</fieldset></form>'; $label = $fieldset->getLabel(); $step = "Étape"; $on = "sur"; $template = <<<EOS <form method="POST"> %s </form> EOS; if (($translator = $this->getTranslator()) !== null) { $label = $translator->translate($label, $this->getTranslatorTextDomain()); $step = $translator->translate($step, $this->getTranslatorTextDomain()); $on = $translator->translate($on, $this->getTranslatorTextDomain()); } $step = $this->translate("Étape"); $on = $this->translate("sur"); $html = sprintf($template, $label, $this->renderFieldset($fieldset)); $html = sprintf($template, $this->renderFieldset($fieldset)); if ($stepIndex = $this->view->get('stepIndex')) { $step .= " " . $stepIndex; Loading @@ -120,26 +115,50 @@ class MultipageFormFieldset extends AbstractHelper } /** * Génère le code HTML du fieldset seul. * Si un partial est fourni, il est utilisé. * * @param Fieldset $fieldset * @return string */ private function renderFieldset(Fieldset $fieldset) { $html = ''; if ($this->partial) { // fieldset $html .= $this->view->partial($this->partial); // navigation $navElement = $this->getNavigationElement(); $html .= $this->view->multipageFormNav($navElement); } else { return $this->renderFieldsetPartial(); } $template = <<<EOS <fieldset> <legend>%s</legend> %s </fieldset> EOS; /** @var Element $element */ $html = ''; foreach ($fieldset->getIterator() as $element) { $html .= $this->view->multipageFormRow($element); } $legend = $this->translate($fieldset->getLabel()); return sprintf($template, $legend, $html); } /** * Génère le code HTML du fieldset à l'aide du partial fourni. * * @return string */ protected function renderFieldsetPartial() { // fieldset $html = $this->view->partial($this->partial); // navigation $navElement = $this->getNavigationElement(); $html .= $this->view->multipageFormNav($navElement); return $html; } Loading @@ -155,4 +174,17 @@ class MultipageFormFieldset extends AbstractHelper return $element; } /** * @param string $text * @return string */ protected function translate(string $text) { if (($translator = $this->getTranslator()) !== null) { return $translator->translate($text, $this->getTranslatorTextDomain()); } return $text; } } No newline at end of file
src/UnicaenApp/Form/View/Helper/MultipageFormRow.php +4 −1 Changes for src/UnicaenApp/Form/View/Helper/MultipageFormRow.php: 4 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -54,7 +54,10 @@ class MultipageFormRow extends FormRow return $this->view->formRowDateInfSup($element); } return parent::render($element); return '<div class="form-group">' . PHP_EOL . parent::render($element). PHP_EOL . '</div>' . PHP_EOL ; } } No newline at end of file