Commit 189967b6 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Nouveau champ pour nouveau besoin dans les formulaires

parent 9338e916
Loading
Loading
Loading
Loading
+15 −13
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ class Champ {
    const TYPE_SPACER           = "Spacer";
    const TYPE_LABEL            = "Label";
    const TYPE_TEXT             = "Text";
    const TYPE_MULTIPLE_TEXT    = "Multiple Text";
    const TYPE_TEXTAREA         = "Textarea";
    const TYPE_CHECKBOX         = "Checkbox";
    const TYPE_SELECT           = "Select";
@@ -20,6 +21,7 @@ class Champ {
    const TYPE_MULTIPLE         = "Multiple";
    const TYPE_ENTITY           = "Entity";
    const TYPE_ENTITY_MULTI     = "Entity Multiple";
    const TYPE_CUSTOM           = "Multiple champs paramètrables";


    /** @var integer */
+15 −13
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ class ChampForm extends Form {
                'label' => "Type de mise en forme* :",
                'value_options' => [
                    Champ::TYPE_TEXT            => "Texte libre court",
                    Champ::TYPE_MULTIPLE_TEXT   => "Multiple texte libre court",
                    Champ::TYPE_CUSTOM          => "Multiple champs parametrable",
                    Champ::TYPE_TEXTAREA        => "Texte libre long ",
                    Champ::TYPE_CHECKBOX        => "Boîte à cocher",
                    Champ::TYPE_NOMBRE          => "Nombre",
+27 −0
Original line number Diff line number Diff line
@@ -280,6 +280,20 @@ class FormulaireReponseService {
                }
                return implode(";", $values);
                break;
            case Champ::TYPE_MULTIPLE_TEXT :
                $options = explode(";", $champ->getOptions());
                $values = [];
                $hasData = false;
                for ($position = 0; $position < count($options) ; $position++) {
                    $tmp = "";
                    if (isset($data[$champ->getId()."_".$position]) AND trim($data[$champ->getId()."_".$position]) !== "") {
                        $tmp = $data[$champ->getId()."_".$position];
                        $hasData = true;
                    }
                    $values[] = $tmp;
                }
                return ($hasData)?implode(";", $values):null;
                break;
            case Champ::TYPE_PERIODE :
                $select = $data['select_'.$champ->getId()];
                if ($select === 'null')    return null;
@@ -303,6 +317,19 @@ class FormulaireReponseService {
                }
                return null;
                break;
            case Champ::TYPE_CUSTOM :
                $nbOptions = count(explode(";", $champ->getOptions()));
                $hasData = false;
                $values = [];
                for ($position = 0 ; $position < $nbOptions ; $position++) {
                    $tmp = "";
                    if (isset($data[$champ->getId()."_".$position]) AND trim($data[$champ->getId()."_".$position]) !== "") {
                        $tmp = trim($data[$champ->getId()."_".$position]);
                        $hasData = true;
                    }
                    $values[] = $tmp;
                }
                return ($hasData)?implode(";", $values):null;
            default:
                return null;
                break;
+6 −1
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ class ChampAsInputHelper extends AbstractHelper
            case Champ::TYPE_TEXT :
                $texte .= $view->partial('input/text', ['champ' => $champ, 'reponse' => $reponse]);
                break;
            case Champ::TYPE_MULTIPLE_TEXT :
                $texte .= $view->partial('input/multiple_text', ['champ' => $champ, 'reponse' => $reponse]);
                break;

            case Champ::TYPE_NOMBRE :
                $texte .= $view->partial('input/nombre', ['champ' => $champ, 'reponse' => $reponse]);
@@ -91,7 +94,9 @@ class ChampAsInputHelper extends AbstractHelper
                $options = $this->getChampService()->getAllInstance($champ->getOptions());
                $texte .= $view->partial('input/entity-multiple', ['champ' => $champ, 'options' => $options, 'reponse' => $reponse]);
                break;

            case Champ::TYPE_CUSTOM :
                $texte .= $view->partial('input/custom', ['champ' => $champ, 'reponse' => $reponse]);
                break;
            default :
                $texte .= 'Type ['. $champ->getElement() .'] inconnu !';
                break;
+6 −0
Original line number Diff line number Diff line
@@ -35,6 +35,12 @@ class ChampAsResultHelper extends AbstractHelper
            case Champ::TYPE_TEXT :
                $texte .= $view->partial('result/text', ['champ' => $champ, 'data' => $data]);
                break;
            case Champ::TYPE_MULTIPLE_TEXT :
                $texte .= $view->partial('result/multiple_text', ['champ' => $champ, 'data' => $data]);
                break;
            case Champ::TYPE_CUSTOM :
                $texte .= $view->partial('result/custom', ['champ' => $champ, 'data' => $data]);
                break;
            case Champ::TYPE_TEXTAREA :
                $texte .= $view->partial('result/textarea', ['champ' => $champ, 'data' => $data]);
                break;
Loading