123 lines
5.3 KiB
PHP
123 lines
5.3 KiB
PHP
<?php
|
|
namespace Cadoles\CoreBundle\Form;
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
|
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
|
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
|
|
|
|
use Doctrine\ORM\EntityRepository;
|
|
use Doctrine\ORM\EntityManager;
|
|
|
|
class GroupType extends AbstractType
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
{
|
|
$builder->add('submit',
|
|
SubmitType::class, array(
|
|
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
|
|
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
|
|
)
|
|
);
|
|
|
|
$choices=array("oui" => "1","non" => "0");
|
|
$builder->add("fgcanshare",
|
|
ChoiceType::class,array(
|
|
"label" =>"Partage dans le groupe activé",
|
|
'disabled' => ($options["mode"]=="delete"?true:false),
|
|
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
|
|
"choices" => $choices
|
|
)
|
|
);
|
|
|
|
if(!$options["updatelimite"]) {
|
|
$builder->add('label',
|
|
TextType::class, array(
|
|
"label" =>"Label",
|
|
"disabled" => ($options["mode"]=="delete"?true:false),
|
|
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
|
|
)
|
|
);
|
|
|
|
$choices=array("oui" => "1","non" => "0");
|
|
$builder->add("fgopen",
|
|
ChoiceType::class,array(
|
|
"label" =>"Groupe Ouvert (inscription possible par les utilisateurs)",
|
|
'disabled' => ($options["mode"]=="delete"?true:false),
|
|
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
|
|
"choices" => $choices
|
|
)
|
|
);
|
|
|
|
// Si masteridentity = LDAP alors on demande le filtre des utilisateurs qui appartiennent à ce groupe
|
|
if($options["masteridentity"]=="LDAP")
|
|
{
|
|
$choices=array("oui" => "1","non" => "0");
|
|
$builder->add("fgassoc",
|
|
ChoiceType::class,array(
|
|
"mapped" => false,
|
|
"label" => "Groupe associé à l'annuaire ?",
|
|
'disabled' => ($options["mode"]=="delete"?true:false),
|
|
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
|
|
"choices" => $choices
|
|
)
|
|
);
|
|
|
|
$builder->add('ldapfilter',
|
|
TextType::class, array(
|
|
"label" => "Filtre LDAP des utilisateurs",
|
|
"label_attr" => array("id" => "label_group_ldapfilter"),
|
|
"disabled" => ($options["mode"]=="delete"?true:false),
|
|
"required" => false,
|
|
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
|
|
)
|
|
);
|
|
}
|
|
|
|
if($options["masteridentity"]=="SSO")
|
|
{
|
|
$choices=array("oui" => "1","non" => "0");
|
|
$builder->add("fgassoc",
|
|
ChoiceType::class,array(
|
|
"mapped" => false,
|
|
"label" => "Groupe associé à des attributs SSO ?",
|
|
'disabled' => ($options["mode"]=="delete"?true:false),
|
|
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
|
|
"choices" => $choices
|
|
)
|
|
);
|
|
|
|
$builder->add('attributes',
|
|
TextareaType::class, array(
|
|
"label" => "Attributs SSO des utilisateurs",
|
|
"label_attr" => array("id" => "label_group_attributes"),
|
|
"disabled" => ($options["mode"]=="delete"?true:false),
|
|
"required" => false,
|
|
"attr" => array("rows" => 10, "class" => "form-control", "style" => "margin-bottom:15px")
|
|
)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
{
|
|
$resolver->setDefaults(array(
|
|
'data_class' => 'Cadoles\CoreBundle\Entity\Group',
|
|
'mode' => "string",
|
|
'masteridentity' => "string",
|
|
'updatelimite' => "boolean"
|
|
));
|
|
}
|
|
}
|