nineskeletor/src/Form/Niveau01Type.php

82 lines
2.7 KiB
PHP
Raw Normal View History

2022-07-21 16:15:47 +02:00
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
class Niveau01Type extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('submit',
SubmitType::class,[
"label" => "Valider",
"attr" => ["class" => "btn btn-success"],
]
);
$builder->add('label',
TextType::class, [
"label" =>"Label",
]
);
// Si masteridentity = LDAP alors on demande le filtre des utilisateurs qui appartiennent à ce groupe
if($options["appMasteridentity"]=="LDAP"||$options["appSynchro"]=="LDAP2NINE")
{
$builder->add("fgassocldap",
ChoiceType::class,[
"mapped" => false,
"label" => $options["appNiveau01label"]." associé à l'annuaire ?",
"choices" => ["non" => "0","oui" => "1"],
]
);
$builder->add('ldapfilter',
TextType::class, [
"label" => "Filtre LDAP du ".$options["appNiveau01label"],
"label_attr" => ["id" => "label_group_ldapfilter"],
"required" => false,
]
);
}
if($options["appMasteridentity"]=="SSO")
{
$builder->add("fgassocsso",
ChoiceType::class,[
"mapped" => false,
"label" => $options["appNiveau01label"]." associé à des attributs SSO ?",
"choices" => ["non" => "0","oui" => "1"],
]
);
$builder->add('attributes',
TextareaType::class, [
"label" => "Attributs SSO du ".$options["appNiveau01label"],
"label_attr" => ["id" => "label_group_attributes"],
"required" => false,
"attr" => ["rows" => 10]
]
);
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'App\Entity\Niveau01',
'mode' => "string",
'appMasteridentity' => "string",
"appSynchro" => "string",
'appNiveau01label' => "string"
));
}
}