Loading src/UnicaenAutoform/Entity/Db/FormulaireInstance.php +23 −3 Original line number Diff line number Diff line Loading @@ -125,12 +125,32 @@ class FormulaireInstance implements HistoriqueAwareInterface { $responses = $this->getReponses(); usort($responses, function (FormulaireReponse $a, FormulaireReponse $b) { return $a->getChamp()->getOrdre() <=> $b->getChamp()->getOrdre();}); //TODO :: faire mieux voir comment appeler le partial qui va bien ... foreach ($responses as $reponse) { if ($reponse->getChamp()->hasMotsClefs($mots) AND $reponse->estNonHistorise()) { if ($reponse->getChamp()->hasMotsClefs($mots) and $reponse->estNonHistorise()) { if ($reponse->getChamp()->getType()->getCode() === Champ::TYPE_PLUS_CUSTOM) { $texte .= $reponse->getChamp()->getLibelle() . " : "; if (str_replace([Champ::SEPARATOR_PLUS_CUSTOM_FIELD, Champ::SEPARATOR_PLUS_CUSTOM_GROUP], ['', ''], $reponse->getReponse()) === '') $texte .= "aucun·e" . "<br>"; else { $items = explode(Champ::SEPARATOR_PLUS_CUSTOM_GROUP, $reponse->getReponse()); $texte .= "<ol>"; foreach ($items as $item) { $texte .= "<br>"; $elements = explode(Champ::SEPARATOR_PLUS_CUSTOM_FIELD, $item); foreach ($elements as $element) { $texte .= $element . "<br>"; } } $texte .= "</ol>"; } } else { // $texte .= $reponse->getChamp()->getType()."<br>"; if ($texte !== "") $texte .= "<br/>"; $texte .= $reponse->getReponse(); } } } return $texte; } Loading src/UnicaenAutoform/Entity/HasMotsClefsAwareTrait.php +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ trait HasMotsClefsAwareTrait { public function hasMotsClefs(array $mots) : bool { if ($this->getMotsClefs() === null) return false; $motsClefs = explode(';', $this->getMotsClefs()); foreach ($mots as $mot) { if (!in_array($mot, $motsClefs)) return false; Loading Loading
src/UnicaenAutoform/Entity/Db/FormulaireInstance.php +23 −3 Original line number Diff line number Diff line Loading @@ -125,12 +125,32 @@ class FormulaireInstance implements HistoriqueAwareInterface { $responses = $this->getReponses(); usort($responses, function (FormulaireReponse $a, FormulaireReponse $b) { return $a->getChamp()->getOrdre() <=> $b->getChamp()->getOrdre();}); //TODO :: faire mieux voir comment appeler le partial qui va bien ... foreach ($responses as $reponse) { if ($reponse->getChamp()->hasMotsClefs($mots) AND $reponse->estNonHistorise()) { if ($reponse->getChamp()->hasMotsClefs($mots) and $reponse->estNonHistorise()) { if ($reponse->getChamp()->getType()->getCode() === Champ::TYPE_PLUS_CUSTOM) { $texte .= $reponse->getChamp()->getLibelle() . " : "; if (str_replace([Champ::SEPARATOR_PLUS_CUSTOM_FIELD, Champ::SEPARATOR_PLUS_CUSTOM_GROUP], ['', ''], $reponse->getReponse()) === '') $texte .= "aucun·e" . "<br>"; else { $items = explode(Champ::SEPARATOR_PLUS_CUSTOM_GROUP, $reponse->getReponse()); $texte .= "<ol>"; foreach ($items as $item) { $texte .= "<br>"; $elements = explode(Champ::SEPARATOR_PLUS_CUSTOM_FIELD, $item); foreach ($elements as $element) { $texte .= $element . "<br>"; } } $texte .= "</ol>"; } } else { // $texte .= $reponse->getChamp()->getType()."<br>"; if ($texte !== "") $texte .= "<br/>"; $texte .= $reponse->getReponse(); } } } return $texte; } Loading
src/UnicaenAutoform/Entity/HasMotsClefsAwareTrait.php +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ trait HasMotsClefsAwareTrait { public function hasMotsClefs(array $mots) : bool { if ($this->getMotsClefs() === null) return false; $motsClefs = explode(';', $this->getMotsClefs()); foreach ($mots as $mot) { if (!in_array($mot, $motsClefs)) return false; Loading