110 lines
3.4 KiB
PHP
110 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace App\Form;
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
|
|
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',
|
|
]
|
|
);
|
|
|
|
$builder->add('code',
|
|
TextType::class, [
|
|
'label' => 'Code',
|
|
'required' => false,
|
|
]
|
|
);
|
|
|
|
$builder->add('email',
|
|
EmailType::class, [
|
|
'label' => 'Mail',
|
|
'required' => false,
|
|
]
|
|
);
|
|
|
|
$builder->add('postaladress',
|
|
TextareaType::class, [
|
|
'label' => 'Adresse',
|
|
'required' => false,
|
|
'attr' => ['style' => 'height:90px'],
|
|
]
|
|
);
|
|
|
|
$builder->add('telephonenumber',
|
|
TextType::class, [
|
|
'label' => 'Téléphone',
|
|
'required' => false,
|
|
]
|
|
);
|
|
|
|
// Si masteridentity = LDAP alors on demande le filtre des utilisateurs qui appartiennent à ce groupe
|
|
if ('LDAP' == $options['appMasteridentity'] || 'LDAP2NINE' == $options['appSynchro']) {
|
|
$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 ('SSO' == $options['appMasteridentity']) {
|
|
$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([
|
|
'data_class' => 'App\Entity\Niveau01',
|
|
'mode' => 'string',
|
|
'appMasteridentity' => 'string',
|
|
'appSynchro' => 'string',
|
|
'appNiveau01label' => 'string',
|
|
]);
|
|
}
|
|
}
|