Loading src/UnicaenAutoform/Entity/Db/FormulaireInstance.php +37 −1 Original line number Diff line number Diff line Loading @@ -108,8 +108,44 @@ class FormulaireInstance implements HistoriqueAwareInterface { public function fetchChampReponseByMotsClefs(array $mots) : string { $a =1; foreach ($this->getReponses() as $reponse) { if ($reponse->getChamp()->hasMotsClefs($mots) AND $reponse->estNonHistorise()) { $champ = $reponse?->getChamp(); if ($champ?->hasMotsClefs($mots) AND $reponse->estNonHistorise()) { $type = $champ?->getType(); if ($type?->getCode() === Champ::TYPE_PLUS_CUSTOM) { $fields = explode(';',$champ->getOptions()); $nbFields = count($fields); $libelles = []; foreach ($fields as $field) { $liste = explode('|',$field); $libelles[] = $liste[1]??"Aucun·e"; } $reponses = explode(Champ::SEPARATOR_PLUS_CUSTOM_GROUP, (string) $reponse->getReponse()); $texte = $champ->getLibelle(); if (empty($reponses) OR str_replace(";","",$reponses[0]) === "") { $texte .= 'aucun·e'; } else { foreach ($reponses as $item) { $splits = explode(Champ::SEPARATOR_PLUS_CUSTOM_FIELD, $item); $position = 0; $texte .= "<ul style='margin-bottom: 0.5rem;'>"; foreach ($splits as $split) { if ($split !== '') { $tLibelle = str_replace(["\'"],["'"],$libelles[$position]); $texte .= '<li>' . $tLibelle . ' : '. $split . '</li>'; } $position++; } $texte .= "</ul>"; } } return $texte; } if ($reponse->getChamp()->getType()->getCode() !== 'Multiple') return $reponse->getReponse(); else { return str_replace('on_','',$reponse->getReponse()); Loading src/UnicaenAutoform/Form/Categorie/CategorieForm.php +2 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ class CategorieForm extends Form { 'type' => Text::class, 'name' => 'libelle', 'options' => [ 'label' => "Libelle* :", 'label' => "Libellé <span class='icon icon-obligatoire'></span> :", 'label_options' => [ 'disable_html_escape' => true, ], ], 'attributes' => [ 'id' => 'libelle', Loading src/UnicaenAutoform/View/Helper/InstanceAsTextHelper.php +7 −5 Original line number Diff line number Diff line Loading @@ -54,11 +54,11 @@ class InstanceAsTextHelper extends AbstractHelper $results = []; /** @var Champ $champ */ foreach ($champs as $champ) { if (isset($reponses[$champ->getId()]) && $reponses[$champ->getId()]) $results[] = $reponses[$champ->getId()]; } // foreach ($champs as $champ) { // if (isset($reponses[$champ->getId()]) && $reponses[$champ->getId()]) $results[] = $reponses[$champ->getId()]; // } if (!empty($champs) && !(empty($results))) { // if (!empty($champs) && !(empty($results))) { $text .= '<h3 class="categorie">' . $categorie->getLibelle() . '</h3>'; $text .= '<ul>'; /** @var Champ $champ */ Loading @@ -66,10 +66,12 @@ class InstanceAsTextHelper extends AbstractHelper if (isset($reponses[$champ->getId()])) { // var_dump($reponses[$champ->getId()]->getReponse()); $text .= $this->getView()->champAsResult()->render($champ, $reponses[$champ->getId()]->getReponse(), $date); } else { $text .= $this->getView()->champAsResult()->render($champ, "<span class='missing-data'>Aucune réponse</span>", $date); } } $text .= '</ul>'; } // } } } Loading src/UnicaenAutoform/View/Helper/partial/instance-as-text.phtml 0 → 100644 +0 −0 Empty file added. src/UnicaenAutoform/View/Helper/partial/result/plus_custom.phtml +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ $reponses = explode(Champ::SEPARATOR_PLUS_CUSTOM_GROUP, (string) $data); ?> <?php echo $champ->getLibelle(); ?> : <?php if (empty($reponses) OR str_replace(";","",$reponses[0]) === "") : ?> aucun·e Loading Loading
src/UnicaenAutoform/Entity/Db/FormulaireInstance.php +37 −1 Original line number Diff line number Diff line Loading @@ -108,8 +108,44 @@ class FormulaireInstance implements HistoriqueAwareInterface { public function fetchChampReponseByMotsClefs(array $mots) : string { $a =1; foreach ($this->getReponses() as $reponse) { if ($reponse->getChamp()->hasMotsClefs($mots) AND $reponse->estNonHistorise()) { $champ = $reponse?->getChamp(); if ($champ?->hasMotsClefs($mots) AND $reponse->estNonHistorise()) { $type = $champ?->getType(); if ($type?->getCode() === Champ::TYPE_PLUS_CUSTOM) { $fields = explode(';',$champ->getOptions()); $nbFields = count($fields); $libelles = []; foreach ($fields as $field) { $liste = explode('|',$field); $libelles[] = $liste[1]??"Aucun·e"; } $reponses = explode(Champ::SEPARATOR_PLUS_CUSTOM_GROUP, (string) $reponse->getReponse()); $texte = $champ->getLibelle(); if (empty($reponses) OR str_replace(";","",$reponses[0]) === "") { $texte .= 'aucun·e'; } else { foreach ($reponses as $item) { $splits = explode(Champ::SEPARATOR_PLUS_CUSTOM_FIELD, $item); $position = 0; $texte .= "<ul style='margin-bottom: 0.5rem;'>"; foreach ($splits as $split) { if ($split !== '') { $tLibelle = str_replace(["\'"],["'"],$libelles[$position]); $texte .= '<li>' . $tLibelle . ' : '. $split . '</li>'; } $position++; } $texte .= "</ul>"; } } return $texte; } if ($reponse->getChamp()->getType()->getCode() !== 'Multiple') return $reponse->getReponse(); else { return str_replace('on_','',$reponse->getReponse()); Loading
src/UnicaenAutoform/Form/Categorie/CategorieForm.php +2 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ class CategorieForm extends Form { 'type' => Text::class, 'name' => 'libelle', 'options' => [ 'label' => "Libelle* :", 'label' => "Libellé <span class='icon icon-obligatoire'></span> :", 'label_options' => [ 'disable_html_escape' => true, ], ], 'attributes' => [ 'id' => 'libelle', Loading
src/UnicaenAutoform/View/Helper/InstanceAsTextHelper.php +7 −5 Original line number Diff line number Diff line Loading @@ -54,11 +54,11 @@ class InstanceAsTextHelper extends AbstractHelper $results = []; /** @var Champ $champ */ foreach ($champs as $champ) { if (isset($reponses[$champ->getId()]) && $reponses[$champ->getId()]) $results[] = $reponses[$champ->getId()]; } // foreach ($champs as $champ) { // if (isset($reponses[$champ->getId()]) && $reponses[$champ->getId()]) $results[] = $reponses[$champ->getId()]; // } if (!empty($champs) && !(empty($results))) { // if (!empty($champs) && !(empty($results))) { $text .= '<h3 class="categorie">' . $categorie->getLibelle() . '</h3>'; $text .= '<ul>'; /** @var Champ $champ */ Loading @@ -66,10 +66,12 @@ class InstanceAsTextHelper extends AbstractHelper if (isset($reponses[$champ->getId()])) { // var_dump($reponses[$champ->getId()]->getReponse()); $text .= $this->getView()->champAsResult()->render($champ, $reponses[$champ->getId()]->getReponse(), $date); } else { $text .= $this->getView()->champAsResult()->render($champ, "<span class='missing-data'>Aucune réponse</span>", $date); } } $text .= '</ul>'; } // } } } Loading
src/UnicaenAutoform/View/Helper/partial/result/plus_custom.phtml +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ $reponses = explode(Champ::SEPARATOR_PLUS_CUSTOM_GROUP, (string) $data); ?> <?php echo $champ->getLibelle(); ?> : <?php if (empty($reponses) OR str_replace(";","",$reponses[0]) === "") : ?> aucun·e Loading