rendre modifiable les inscriptions (ref #113)
This commit is contained in:
parent
e9d13ed100
commit
f9df134c46
|
@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
|
|||
(-100, 'DRAAF', '130007107');
|
||||
|
||||
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
|
||||
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}sh/qcK9rVlrIFTJVhcolNLa3Ww0g4ZzK
|
||||
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}Ohb+BjJ5uHPUGP9Xpcl3j1woHkTgkbH0
|
||||
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
|
||||
|
||||
|
||||
|
|
|
@ -387,6 +387,18 @@ class RegistrationController extends Controller
|
|||
|
||||
// Sur erreur
|
||||
$this->getErrorForm($id,$form,$request,$data,"send");
|
||||
|
||||
// Sur validation
|
||||
if ($form->get('save')->isClicked() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$data = $form->getData();
|
||||
|
||||
// Sauvegarde
|
||||
$em->persist($data);
|
||||
$em->flush();
|
||||
|
||||
return $this->redirectToRoute('cadoles_core_config_registration');
|
||||
}
|
||||
|
||||
// Sur validation
|
||||
if ($form->get('submit')->isClicked() && $form->isValid()) {
|
||||
|
|
|
@ -33,11 +33,20 @@ class RegistrationType extends AbstractType
|
|||
|
||||
$builder->add('submit',
|
||||
SubmitType::class, array(
|
||||
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
|
||||
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Confirmer"),
|
||||
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
|
||||
)
|
||||
);
|
||||
|
||||
if($options["mode"]=="send") {
|
||||
$builder->add('save',
|
||||
SubmitType::class, array(
|
||||
"label" => "Sauvegarder",
|
||||
"attr" => array("class" => "btn btn-success")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
# Obligatoire
|
||||
$builder->add('username',
|
||||
TextType::class, array(
|
||||
|
@ -50,7 +59,7 @@ class RegistrationType extends AbstractType
|
|||
$builder->add('lastname',
|
||||
TextType::class, array(
|
||||
"label" =>"Nom de Famille",
|
||||
"disabled" => ($options["mode"]=="delete"||$options["mode"]=="send"?true:false),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
|
||||
)
|
||||
);
|
||||
|
@ -58,7 +67,7 @@ class RegistrationType extends AbstractType
|
|||
$builder->add('email',
|
||||
EmailType::class, array(
|
||||
"label" =>"Mail",
|
||||
"disabled" => ($options["mode"]=="delete"||$options["mode"]=="send"?true:false),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
|
||||
)
|
||||
);
|
||||
|
@ -68,8 +77,8 @@ class RegistrationType extends AbstractType
|
|||
array("class" => "CadolesCoreBundle:Niveau01",
|
||||
"label" => $session->get('labelniveau01'),
|
||||
"choice_label" => "label",
|
||||
"disabled" => ($options["mode"]=="delete"||$options["mode"]=="send"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="submit"?false:true))));
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="delete"?true:false))));
|
||||
|
||||
# Password
|
||||
if($options["mode"]!="delete"&&$options["mode"]!="send") {
|
||||
|
@ -98,7 +107,7 @@ class RegistrationType extends AbstractType
|
|||
TextType::class, array(
|
||||
"label" =>"Prénom",
|
||||
"required" => (!array_key_exists("firstname",$fields)?false:($fields["firstname"]["perm"]==2)),
|
||||
"disabled" => ($options["mode"]=="delete"||$options["mode"]=="send"?true:false),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
|
||||
)
|
||||
);
|
||||
|
@ -110,7 +119,7 @@ class RegistrationType extends AbstractType
|
|||
ChoiceType::class,array(
|
||||
"label" =>"Visible",
|
||||
"required" => (!array_key_exists("visible",$fields)?false:($fields["visible"]["perm"]==2)),
|
||||
'disabled' => ($options["mode"]=="submit"?false:true),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
|
||||
"choices" => $choices
|
||||
)
|
||||
|
@ -122,7 +131,7 @@ class RegistrationType extends AbstractType
|
|||
TextType::class, array(
|
||||
"label" => "Nom d'Usage",
|
||||
"required" => (!array_key_exists("usualname",$fields)?false:($fields["usualname"]["perm"]==2)),
|
||||
"disabled" => ($options["mode"]=="submit"?false:true),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
|
||||
)
|
||||
);
|
||||
|
@ -133,7 +142,7 @@ class RegistrationType extends AbstractType
|
|||
TextType::class, array(
|
||||
"label" => "Autre Prénom",
|
||||
"required" => (!array_key_exists("givensname",$fields)?false:($fields["givensname"]["perm"]==2)),
|
||||
"disabled" => ($options["mode"]=="submit"?false:true),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
|
||||
)
|
||||
);
|
||||
|
@ -144,7 +153,7 @@ class RegistrationType extends AbstractType
|
|||
TextType::class, array(
|
||||
"label" => "Téléphone",
|
||||
"required" => (!array_key_exists("telephonenumber",$fields)?false:($fields["telephonenumber"]["perm"]==2)),
|
||||
"disabled" => ($options["mode"]=="submit"?false:true),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
|
||||
)
|
||||
);
|
||||
|
@ -155,7 +164,7 @@ class RegistrationType extends AbstractType
|
|||
TextareaType::class, array(
|
||||
"label" => "Adresse",
|
||||
"required" => (!array_key_exists("postaladress",$fields)?false:($fields["postaladress"]["perm"]==2)),
|
||||
"disabled" => ($options["mode"]=="submit"?false:true),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px; height: 90px")
|
||||
)
|
||||
);
|
||||
|
@ -166,7 +175,7 @@ class RegistrationType extends AbstractType
|
|||
DateType::class, array(
|
||||
"label" => "Date de Naissance",
|
||||
"required" => (!array_key_exists("birthdate",$fields)?false:($fields["birthdate"]["perm"]==2)),
|
||||
"disabled" => ($options["mode"]=="submit"?false:true),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"widget" => 'single_text',
|
||||
"format" => "dd/MM/yyyy",
|
||||
"html5" => false,
|
||||
|
@ -182,7 +191,7 @@ class RegistrationType extends AbstractType
|
|||
ChoiceType::class,array(
|
||||
"label" =>"Sexe",
|
||||
"required" => (!array_key_exists("gender",$fields)?false:($fields["gender"]["perm"]==2)),
|
||||
'disabled' => ($options["mode"]=="submit"?false:true),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
|
||||
"choices" => $choices
|
||||
)
|
||||
|
@ -194,7 +203,7 @@ class RegistrationType extends AbstractType
|
|||
TextType::class, array(
|
||||
"label" => "Métier",
|
||||
"required" => (!array_key_exists("job",$fields)?false:($fields["job"]["perm"]==2)),
|
||||
"disabled" => ($options["mode"]=="submit"?false:true),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
|
||||
)
|
||||
);
|
||||
|
@ -205,7 +214,7 @@ class RegistrationType extends AbstractType
|
|||
TextType::class, array(
|
||||
"label" => "Fonction",
|
||||
"required" => (!array_key_exists("position",$fields)?false:($fields["position"]["perm"]==2)),
|
||||
"disabled" => ($options["mode"]=="submit"?false:true),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
|
||||
)
|
||||
);
|
||||
|
@ -216,7 +225,7 @@ class RegistrationType extends AbstractType
|
|||
$builder->add('birthcountry',
|
||||
Select2EntityType::class, array(
|
||||
'label' => "Pays de Naissance",
|
||||
'disabled' => ($options["mode"]=="delete"?true:false),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"required" => (!array_key_exists("birthcountry",$fields)?false:($fields["birthcountry"]["perm"]==2)),
|
||||
'multiple' => false,
|
||||
'remote_route' => 'cadoles_core_ajax_country_list',
|
||||
|
@ -240,8 +249,8 @@ class RegistrationType extends AbstractType
|
|||
$builder->add('birthplace',
|
||||
Select2EntityType::class, array(
|
||||
'label' => "Ville de Naissance",
|
||||
'disabled' => ($options["mode"]=="delete"?true:false),
|
||||
"required" => false,
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"required" => false,
|
||||
'multiple' => false,
|
||||
'remote_route' => 'cadoles_core_ajax_city_list',
|
||||
'class' => 'Cadoles\coreBundle\Entity\City',
|
||||
|
@ -265,7 +274,7 @@ class RegistrationType extends AbstractType
|
|||
$builder->add('niveau02',
|
||||
Select2EntityType::class, array(
|
||||
'label' => $session->get('labelniveau02'),
|
||||
'disabled' => ($options["mode"]=="delete"?true:false),
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"required" => (!array_key_exists("niveau02",$fields)?false:($fields["niveau02"]["perm"]==2)),
|
||||
'multiple' => false,
|
||||
'remote_route' => 'cadoles_core_ajax_niveau02_list',
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if mode!="submit" %}
|
||||
{{ form_widget(form.save) }}
|
||||
<a class="btn btn-default" href={{ path('cadoles_core_config_registration') }}>Annuler</a>
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue