You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SAE4.01_FORMULAIRE/Source/Model/ModelAdmin.php

36 lines
984 B

<?php
namespace Model;
use API\script\Gateway\GatewayForm;
use API\script\Gateway\GatewayQuestion;
use BusinessClass\Form;
use BusinessClass\ListBoxQuestion;
class ModelAdmin
{
public function addQuestion(): void
{
$question = new ListBoxQuestion(array("Réponse1", "Réponse2", "Réponse3"),
"Quelle est votre réponse préférée ?",
array(array("Catégorie1.1", "Catégorie 1.2", "Catégorie1.3"), array("Catégorie2.1", "Catégorie 2.2"), array("Catégorie3")), 0);
$form = (new GatewayForm())->getForm();
if(!empty($form))
{
(new GatewayQuestion())->insertQuestion($question, $form[0]['id']);
}
}
public function createForm(): void
{
if(empty((new GatewayForm())->getForm()))
{
$form = new Form(0, "Votre avis nous intéresse !!!", "Description de notrer formulaire", array());
(new GatewayForm())->insertForm($form);
}
}
}