This commit is contained in:
afornerot 2019-06-26 16:55:21 +02:00
parent 222676cf5b
commit 8de5145700
15 changed files with 710 additions and 387 deletions

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107'); (-100, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}EHcsvjQ0ZSD0/jiRa6+mC4AtCXMZesgA (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}Zk1FeGDztzYdA2Q2EhJOmEuDHs7uyXI2
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
@ -19,6 +19,7 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1010, 1000, 1010, 'Générale', 'cadoles_core_config_commun', 'fa-table', 'ROLE_ADMIN,ROLE_MODO', ''), (1010, 1000, 1010, 'Générale', 'cadoles_core_config_commun', 'fa-table', 'ROLE_ADMIN,ROLE_MODO', ''),
(1020, 1000, 1020, 'Thème', 'cadoles_core_config_theme', 'fa-paint-brush', 'ROLE_ADMIN,ROLE_MODO', ''), (1020, 1000, 1020, 'Thème', 'cadoles_core_config_theme', 'fa-paint-brush', 'ROLE_ADMIN,ROLE_MODO', ''),
(1030, 1000, 1030, 'Modération', 'cadoles_core_config_permmodo', 'fa-balance-scale', 'ROLE_ADMIN', ''), (1030, 1000, 1030, 'Modération', 'cadoles_core_config_permmodo', 'fa-balance-scale', 'ROLE_ADMIN', ''),
(1040, 1000, 1040, 'Fiche Utilisateur', 'cadoles_core_config_datauser', 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''),
(1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''), (1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''),
(1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN,ROLE_MODO', ''), (1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN,ROLE_MODO', ''),
@ -69,6 +70,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
('003', 1, 1, 0, 'string', 'subappname', 'Portail', '', 'Le sous titre de votre site'), ('003', 1, 1, 0, 'string', 'subappname', 'Portail', '', 'Le sous titre de votre site'),
('004', 1, 1, 1, 'logo', 'logo', 'uploads/logo/logo.png', '', 'Le logo de votre site'), ('004', 1, 1, 1, 'logo', 'logo', 'uploads/logo/logo.png', '', 'Le logo de votre site'),
('005', 0, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'), ('005', 0, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'),
('006', 0, 1, 0, 'datauser', 'datauser', '', '', 'Parametrage des champs utilisateurs : obligatoire / facultatif / caché'),
('010', 1, 1, 1, 'boolean', 'fgforceconnect', '0', '', 'Forcer la connection afin de rendre votre site privé'), ('010', 1, 1, 1, 'boolean', 'fgforceconnect', '0', '', 'Forcer la connection afin de rendre votre site privé'),
@ -90,12 +92,14 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
INSERT IGNORE permmodo (`route`, `visible`) VALUES INSERT IGNORE permmodo (`route`, `visible`) VALUES
('cadoles_core_config_commun',0), ('cadoles_core_config_commun',0),
('cadoles_core_config_theme',0), ('cadoles_core_config_theme',0),
('cadoles_core_config_datauser',0),
('cadoles_core_config_whitelist',0), ('cadoles_core_config_whitelist',0),
('cadoles_core_config_niveau01',0), ('cadoles_core_config_niveau01',0),
('cadoles_core_config_niveau02',1), ('cadoles_core_config_niveau02',1),
('cadoles_core_config_group',1), ('cadoles_core_config_group',1),
('cadoles_core_config_registration',1), ('cadoles_core_config_registration',1),
('cadoles_core_config_user',1), ('cadoles_core_config_user',1),
('cadoles_core_config_importuser',0),
('cadoles_portal_config_page',1), ('cadoles_portal_config_page',1),
('cadoles_portal_config_item',1), ('cadoles_portal_config_item',1),
('cadoles_portal_config_alert',1), ('cadoles_portal_config_alert',1),

View File

@ -8,6 +8,7 @@ use Symfony\Component\HttpFoundation\Response;
use Cadoles\CoreBundle\Entity\Config; use Cadoles\CoreBundle\Entity\Config;
use Cadoles\CoreBundle\Form\ConfigType; use Cadoles\CoreBundle\Form\ConfigType;
use Cadoles\CoreBundle\Form\DatauserType;
class ConfigController extends Controller class ConfigController extends Controller
{ {
@ -184,6 +185,91 @@ class ConfigController extends Controller
return $response; return $response;
} }
public function datauserAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$session=$this->get('session');
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
if($fields=="") {
// Valeur par défaut 0=caché / 1=falcultatif / 2=obligatoire
$fields["firstname"]["perm"]=1;
$fields["firstname"]["label"]="Prénom";
$fields["visible"]["perm"]=2;
$fields["visible"]["label"]="Visible";
$fields["authlevel"]["perm"]=2;
$fields["authlevel"]["label"]="Niveau d'authentification";
$fields["belongingpopulation"]["perm"]=2;
$fields["belongingpopulation"]["label"]="Population d'appartenance";
$fields["job"]["perm"]=1;
$fields["job"]["label"]="Métier";
$fields["position"]["perm"]=1;
$fields["position"]["label"]="Fonction";
$fields["niveau02"]["perm"]=1;
$fields["niveau02"]["label"]="Niveau 02";
$fields["usualname"]["perm"]=1;
$fields["usualname"]["label"]="Nom d'Usage";
$fields["gender"]["perm"]=1;
$fields["gender"]["label"]="Sexe";
$fields["givensname"]["perm"]=1;
$fields["givensname"]["label"]="Autre Prénom";
$fields["telephonenumber"]["perm"]=1;
$fields["telephonenumber"]["label"]="Téléphone";
$fields["postaladress"]["perm"]=1;
$fields["postaladress"]["label"]="Adresse";
$fields["birthdate"]["perm"]=1;
$fields["birthdate"]["label"]="Date de Naissance";
$fields["birthcountry"]["perm"]=1;
$fields["birthcountry"]["label"]="Pays de Naissance";
$fields["birthplace"]["perm"]=1;
$fields["birthplace"]["label"]="Ville de Naissance";
}
else {
$fields=json_decode($fields, true);
}
$form = $this->createForm(DatauserType::class,$config,array("fields" => $fields));
// Récupération des data du formulaire
$form->handleRequest($request);
if ($form->get('submit')->isClicked() && $form->isValid()) {
foreach($fields as $key => $value) {
$perm = $form->get($key)->getData();
$fields[$key]["perm"]=$perm;
}
$json=json_encode($fields);
$config->setValue($json);
$em->persist($config);
$em->flush();
}
return $this->render('CadolesCoreBundle:Config:datauser.html.twig',[
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'form' => $form->createView()
]);
}
protected function getErrorForm($form,$request,$data) { protected function getErrorForm($form,$request,$data) {
if ($form->get('submit')->isClicked() && !$form->isValid()) { if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear(); $this->get('session')->getFlashBag()->clear();

View File

@ -172,7 +172,7 @@ class RegistrationController extends Controller
public function submitAction(Request $request) public function submitAction(Request $request)
{ {
$em = $this->getDoctrine()->getManager();
$moderegistration = $this->getParameter('moderegistration'); $moderegistration = $this->getParameter('moderegistration');
$masteridentity = $this->getParameter('masteridentity'); $masteridentity = $this->getParameter('masteridentity');
@ -180,9 +180,14 @@ class RegistrationController extends Controller
throw $this->createNotFoundException('Permission denied'); throw $this->createNotFoundException('Permission denied');
$data = new Registration(); $data = new Registration();
$data->setVisible(true);
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Création du formulaire // Création du formulaire
$form = $this->createForm(RegistrationType::class,$data,array("mode"=>"submit")); $form = $this->createForm(RegistrationType::class,$data,array("mode"=>"submit","fields"=>$fields));
// Récupération des data du formulaire // Récupération des data du formulaire
$form->handleRequest($request); $form->handleRequest($request);
@ -192,7 +197,7 @@ class RegistrationController extends Controller
// Sur validation(z) // Sur validation(z)
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$data = $form->getData(); $data = $form->getData();
$appname = $this->get('session')->get('appname'); $appname = $this->get('session')->get('appname');
@ -354,6 +359,7 @@ class RegistrationController extends Controller
public function sendAction($id,Request $request) public function sendAction($id,Request $request)
{ {
$em = $this->getDoctrine()->getManager();
$moderegistration = $this->getParameter('moderegistration'); $moderegistration = $this->getParameter('moderegistration');
$masteridentity = $this->getParameter('masteridentity'); $masteridentity = $this->getParameter('masteridentity');
if($moderegistration=="none"||$masteridentity!="SQL") if($moderegistration=="none"||$masteridentity!="SQL")
@ -361,11 +367,14 @@ class RegistrationController extends Controller
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$data=$this->getData($id); $data=$this->getData($id);
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Vérifier que cet enregistrement est modifiable // Vérifier que cet enregistrement est modifiable
// Création du formulaire // Création du formulaire
$form = $this->createForm(RegistrationType::class,$data,array("mode"=>"send")); $form = $this->createForm(RegistrationType::class,$data,array("mode"=>"send","fields"=>$fields));
// Récupération des data du formulaire // Récupération des data du formulaire
$form->handleRequest($request); $form->handleRequest($request);
@ -512,6 +521,8 @@ class RegistrationController extends Controller
public function deleteAction($id,Request $request) public function deleteAction($id,Request $request)
{ {
$em = $this->getDoctrine()->getManager();
$moderegistration = $this->getParameter('moderegistration'); $moderegistration = $this->getParameter('moderegistration');
$masteridentity = $this->getParameter('masteridentity'); $masteridentity = $this->getParameter('masteridentity');
if($moderegistration=="none"||$masteridentity!="SQL") if($moderegistration=="none"||$masteridentity!="SQL")
@ -519,11 +530,14 @@ class RegistrationController extends Controller
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$data=$this->getData($id); $data=$this->getData($id);
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Vérifier que cet enregistrement est supprimable // Vérifier que cet enregistrement est supprimable
// Création du formulaire // Création du formulaire
$form = $this->createForm(RegistrationType::class,$data,array("mode"=>"delete")); $form = $this->createForm(RegistrationType::class,$data,array("mode"=>"delete","fields"=>$fields));
// Récupération des data du formulaire // Récupération des data du formulaire
$form->handleRequest($request); $form->handleRequest($request);
@ -533,7 +547,6 @@ class RegistrationController extends Controller
// Sur validation // Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($data); $em->remove($data);
$em->flush(); $em->flush();

View File

@ -252,19 +252,29 @@ class UserController extends Controller
public function submitAction(Request $request) public function submitAction(Request $request)
{ {
$em = $this->getDoctrine()->getManager();
// Vérifier que l'on puisse créer // Vérifier que l'on puisse créer
if($this->GetParameter("masteridentity")!="SQL") if($this->GetParameter("masteridentity")!="SQL")
throw $this->createNotFoundException('Permission denied'); throw $this->createNotFoundException('Permission denied');
// Initialisation de l'enregistrement // Initialisation de l'enregistrement
$data = new User(); $data = new User();
$data->setVisible(true);
$data->setBelongingpopulation("authlevel");
$data->setAuthlevel("simple");
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Création du formulaire // Création du formulaire
$form = $this->createForm(UserType::class,$data,array( $form = $this->createForm(UserType::class,$data,array(
"mode"=>"submit", "mode"=>"submit",
"access"=>"config", "access"=>"config",
"perm"=>$this->isGranted('ROLE_ADMIN'),"userid"=>$this->get('security.token_storage')->getToken()->getUser()->getId(), "perm"=>$this->isGranted('ROLE_ADMIN'),"userid"=>$this->get('security.token_storage')->getToken()->getUser()->getId(),
"masteridentity"=>$this->GetParameter("masteridentity") "masteridentity"=>$this->GetParameter("masteridentity"),
"fields"=>$fields
)); ));
// Récupération des data du formulaire // Récupération des data du formulaire
@ -276,7 +286,6 @@ class UserController extends Controller
// Sur validation // Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData(); $data = $form->getData();
$em = $this->getDoctrine()->getManager();
// On récupère le SIREN et le SIRET // On récupère le SIREN et le SIRET
$data->setSiren($data->getNiveau01()->getSiren()); $data->setSiren($data->getNiveau01()->getSiren());
@ -337,9 +346,14 @@ class UserController extends Controller
public function updateAction($id,$access,Request $request) public function updateAction($id,$access,Request $request)
{ {
$em = $this->getDoctrine()->getManager();
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$data=$this->getData($id); $data=$this->getData($id);
$oldpassword=$data->getPassword(); $oldpassword=$data->getPassword();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste // Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste
if($this->isGranted('ROLE_MODO')&&$access=="config") { if($this->isGranted('ROLE_MODO')&&$access=="config") {
@ -372,7 +386,8 @@ class UserController extends Controller
"access"=>$access, "access"=>$access,
"perm"=>($access=="config"?$this->isGranted('ROLE_ADMIN'):false), "perm"=>($access=="config"?$this->isGranted('ROLE_ADMIN'):false),
"userid"=>$this->get('security.token_storage')->getToken()->getUser()->getId(), "userid"=>$this->get('security.token_storage')->getToken()->getUser()->getId(),
"masteridentity"=>$this->GetParameter("masteridentity") "masteridentity"=>$this->GetParameter("masteridentity"),
"fields"=>$fields
)); ));
// Récupération des data du formulaire // Récupération des data du formulaire
@ -383,7 +398,6 @@ class UserController extends Controller
// Sur validation // Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$data = $form->getData(); $data = $form->getData();
// Si pas de changement de password on replace l'ancien // Si pas de changement de password on replace l'ancien
@ -494,8 +508,13 @@ class UserController extends Controller
public function deleteAction($id,Request $request) public function deleteAction($id,Request $request)
{ {
$em = $this->getDoctrine()->getManager();
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$data=$this->getData($id); $data=$this->getData($id);
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste // Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste
if($this->isGranted('ROLE_MODO')&&$access=="config") { if($this->isGranted('ROLE_MODO')&&$access=="config") {
@ -518,7 +537,8 @@ class UserController extends Controller
"access"=>"config", "access"=>"config",
"perm"=>false, "perm"=>false,
"userid"=>$this->get('security.token_storage')->getToken()->getUser()->getId(), "userid"=>$this->get('security.token_storage')->getToken()->getUser()->getId(),
"masteridentity"=>$this->GetParameter("masteridentity") "masteridentity"=>$this->GetParameter("masteridentity"),
"fields"=>$fields
)); ));
// Récupération des data du formulaire // Récupération des data du formulaire
@ -529,7 +549,6 @@ class UserController extends Controller
// Sur validation // Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($data); $em->remove($data);
$em->flush(); $em->flush();
@ -758,7 +777,6 @@ class UserController extends Controller
$user->setBirthcountry($birthcountry); $user->setBirthcountry($birthcountry);
$user->setBirthplace($birthplace); $user->setBirthplace($birthplace);
$user->setVisible($visible); $user->setVisible($visible);
$user->setVisible(true);
$user->setRole($role); $user->setRole($role);
$user->setSiren($niveau01->getSiren()); $user->setSiren($niveau01->getSiren());

View File

@ -16,7 +16,7 @@ class Config
protected $id; protected $id;
/** /**
* @ORM\Column(type="string", length=250) * @ORM\Column(type="text")
*/ */
protected $value; protected $value;

View File

@ -0,0 +1,70 @@
<?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\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\HttpFoundation\Session\Session;
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
class DatauserType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$session = new Session();
$session->getFlashBag()->clear();
$config = $session->get('configs');
$builder->add('submit',
SubmitType::class,
array("label" => "Valider",
"attr" => array("class" => "btn btn-success")));
foreach($options["fields"] as $key => $field) {
if($key=="birthplace")
$choices=array(
"Falcultatif" => 1,
"Caché" => 0,
);
else
$choices=array(
"Obligatoire" => 2,
"Falcultatif" => 1,
"Caché" => 0,
);
$builder->add($key, ChoiceType::class,
array("label" => $field["label"],
"label_attr" => array("style" => 'margin-top:15px;'),
"attr" => array("class" => "form-control"),
"data" => $field["perm"],
"mapped" => false,
'required' => ($options["required"]==0?false:true),
"choices" => $choices));
}
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Cadoles\CoreBundle\Entity\Config',
'fields' => "array",
));
}
}

View File

@ -28,7 +28,9 @@ class RegistrationType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$session = new Session(); $session = new Session();
$fields=$options["fields"];
if(!is_array($fields)) $fields=[];
$builder->add('submit', $builder->add('submit',
SubmitType::class, array( SubmitType::class, array(
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"), "label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
@ -45,14 +47,6 @@ class RegistrationType extends AbstractType
) )
); );
$builder->add('firstname',
TextType::class, array(
"label" =>"Prénom",
"disabled" => ($options["mode"]=="delete"||$options["mode"]=="send"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
$builder->add('lastname', $builder->add('lastname',
TextType::class, array( TextType::class, array(
"label" =>"Nom de Famille", "label" =>"Nom de Famille",
@ -69,17 +63,6 @@ class RegistrationType extends AbstractType
) )
); );
$choices=array("oui" => "1","non" => "0");
$builder->add("visible",
ChoiceType::class,array(
"label" =>"Visible",
'disabled' => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
$builder->add('niveau01', $builder->add('niveau01',
EntityType::class, EntityType::class,
array("class" => "CadolesCoreBundle:Niveau01", array("class" => "CadolesCoreBundle:Niveau01",
@ -108,149 +91,201 @@ class RegistrationType extends AbstractType
); );
} }
# Optionnel
$builder->add('usualname',
TextType::class, array(
"label" => "Nom d'Usage",
"required" => false,
"disabled" => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
$builder->add('givensname', # En fonction de datauser
TextType::class, array( if(!array_key_exists("firstname",$fields)||$fields["firstname"]["perm"]!=0) {
"label" => "Autre Prénom", $builder->add('firstname',
"required" => false, TextType::class, array(
"disabled" => ($options["mode"]=="submit"?false:true), "label" =>"Prénom",
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px") "required" => (!array_key_exists("firstname",$fields)?false:($fields["firstname"]["perm"]==2)),
) "disabled" => ($options["mode"]=="delete"||$options["mode"]=="send"?true:false),
); "attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
$builder->add('telephonenumber',
TextType::class, array(
"label" => "Téléphone",
"required" => false,
"disabled" => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
$builder->add('postaladress',
TextareaType::class, array(
"label" => "Adresse",
"required" => false,
"disabled" => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px; height: 90px")
)
);
$builder->add('birthdate',
DateType::class, array(
"label" => "Date de Naissance",
"required" => false,
"disabled" => ($options["mode"]=="submit"?false:true),
"widget" => 'single_text',
"format" => "dd/MM/yyyy",
"html5" => false,
"attr" => array("class" => "form-control js-datepicker", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="delete"?true:false)
) )
) );
); }
$choices=array("" => "", "homme" => "male","femme" => "female");
$builder->add("gender",
ChoiceType::class,array(
"label" =>"Sexe",
"required" => false,
'disabled' => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
$builder->add('job', if(!array_key_exists("visible",$fields)||$fields["visible"]["perm"]!=0) {
TextType::class, array( $choices=array("oui" => "1","non" => "0");
"label" => "Métier", $builder->add("visible",
"required" => false, ChoiceType::class,array(
"disabled" => ($options["mode"]=="submit"?false:true), "label" =>"Visible",
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px") "required" => (!array_key_exists("visible",$fields)?false:($fields["visible"]["perm"]==2)),
) 'disabled' => ($options["mode"]=="submit"?false:true),
); "attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
}
$builder->add('position', if(!array_key_exists("usualname",$fields)||$fields["usualname"]["perm"]!=0) {
TextType::class, array( $builder->add('usualname',
"label" => "Fonction", TextType::class, array(
"required" => false, "label" => "Nom d'Usage",
"disabled" => ($options["mode"]=="submit"?false:true), "required" => (!array_key_exists("usualname",$fields)?false:($fields["usualname"]["perm"]==2)),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px") "disabled" => ($options["mode"]=="submit"?false:true),
) "attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
); )
);
}
if(!array_key_exists("givensname",$fields)||$fields["givensname"]["perm"]!=0) {
$builder->add('givensname',
TextType::class, array(
"label" => "Autre Prénom",
"required" => (!array_key_exists("givensname",$fields)?false:($fields["givensname"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
if(!array_key_exists("telephonenumber",$fields)||$fields["telephonenumber"]["perm"]!=0) {
$builder->add('telephonenumber',
TextType::class, array(
"label" => "Téléphone",
"required" => (!array_key_exists("telephonenumber",$fields)?false:($fields["telephonenumber"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
if(!array_key_exists("postaladress",$fields)||$fields["postaladress"]["perm"]!=0) {
$builder->add('postaladress',
TextareaType::class, array(
"label" => "Adresse",
"required" => (!array_key_exists("postaladress",$fields)?false:($fields["postaladress"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px; height: 90px")
)
);
}
if(!array_key_exists("birthdate",$fields)||$fields["birthdate"]["perm"]!=0) {
$builder->add('birthdate',
DateType::class, array(
"label" => "Date de Naissance",
"required" => (!array_key_exists("birthdate",$fields)?false:($fields["birthdate"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"widget" => 'single_text',
"format" => "dd/MM/yyyy",
"html5" => false,
"attr" => array("class" => "form-control js-datepicker", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="delete"?true:false)
)
)
);
}
if(!array_key_exists("gender",$fields)||$fields["gender"]["perm"]!=0) {
$choices=array("" => "", "homme" => "male","femme" => "female");
$builder->add("gender",
ChoiceType::class,array(
"label" =>"Sexe",
"required" => (!array_key_exists("gender",$fields)?false:($fields["gender"]["perm"]==2)),
'disabled' => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
}
if(!array_key_exists("job",$fields)||$fields["job"]["perm"]!=0) {
$builder->add('job',
TextType::class, array(
"label" => "Métier",
"required" => (!array_key_exists("job",$fields)?false:($fields["job"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
if(!array_key_exists("position",$fields)||$fields["position"]["perm"]!=0) {
$builder->add('position',
TextType::class, array(
"label" => "Fonction",
"required" => (!array_key_exists("position",$fields)?false:($fields["position"]["perm"]==2)),
"disabled" => ($options["mode"]=="submit"?false:true),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
if(!array_key_exists("birthcountry",$fields)||$fields["birthcountry"]["perm"]!=0) {
$builder->add('birthcountry',
Select2EntityType::class, array(
'label' => "Pays de Naissance",
'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',
'class' => 'Cadoles\coreBundle\Entity\Country',
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 2,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => 'Selectionner un pays',
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
if(!array_key_exists("birthplace",$fields)||($fields["birthcountry"]["perm"]!=0&&$fields["birthplace"]["perm"]!=0)) {
$builder->add('birthplace',
Select2EntityType::class, array(
'label' => "Ville de Naissance",
'disabled' => ($options["mode"]=="delete"?true:false),
"required" => false,
'multiple' => false,
'remote_route' => 'cadoles_core_ajax_city_list',
'class' => 'Cadoles\coreBundle\Entity\City',
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 2,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => 'Selectionner une ville',
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
$builder->add('birthcountry', if($session->get('viewniveau02')) {
Select2EntityType::class, array( if(!array_key_exists("niveau02",$fields)||$fields["niveau02"]["perm"]!=0) {
'label' => "Pays de Naissance", $builder->add('niveau02',
'disabled' => ($options["mode"]=="submit"?false:true), Select2EntityType::class, array(
'multiple' => false, 'label' => $session->get('labelniveau02'),
'remote_route' => 'cadoles_core_ajax_country_list', 'disabled' => ($options["mode"]=="delete"?true:false),
'class' => 'Cadoles\coreBundle\Entity\Country', "required" => (!array_key_exists("niveau02",$fields)?false:($fields["niveau02"]["perm"]==2)),
'primary_key' => 'id', 'multiple' => false,
'text_property' => 'label', 'remote_route' => 'cadoles_core_ajax_niveau02_list',
'minimum_input_length' => 2, 'class' => 'Cadoles\coreBundle\Entity\Niveau02',
'page_limit' => 10, 'req_params' => ['niveau01' => 'parent.children[niveau01]'],
'allow_clear' => true, 'primary_key' => 'id',
'delay' => 250, 'text_property' => 'label',
'cache' => false, 'minimum_input_length' => 0,
'cache_timeout' => 60000, // if 'cache' is true 'page_limit' => 10,
'language' => 'fr', 'allow_clear' => true,
'placeholder' => 'Selectionner un pays', 'delay' => 250,
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px") 'cache' => false,
) 'cache_timeout' => 60000, // if 'cache' is true
); 'language' => 'fr',
'placeholder' => 'Selectionner '.$session->get('labelniveau02'),
$builder->add('birthplace', 'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
Select2EntityType::class, array( )
'label' => "Ville de Naissance", );
'disabled' => ($options["mode"]=="submit"?false:true), }
'multiple' => false, }
'remote_route' => 'cadoles_core_ajax_city_list',
'class' => 'Cadoles\coreBundle\Entity\City',
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 2,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => 'Selectionner une ville',
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
$builder->add('niveau02',
Select2EntityType::class, array(
'label' => $session->get('labelniveau02'),
'disabled' => ($options["mode"]=="submit"?false:true),
'multiple' => false,
'remote_route' => 'cadoles_core_ajax_niveau02_list',
'class' => 'Cadoles\coreBundle\Entity\Niveau02',
'req_params' => ['niveau01' => 'parent.children[niveau01]'],
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 0,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => 'Selectionner une Localisation',
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
} }
@ -258,7 +293,8 @@ class RegistrationType extends AbstractType
{ {
$resolver->setDefaults(array( $resolver->setDefaults(array(
'data_class' => 'Cadoles\CoreBundle\Entity\Registration', 'data_class' => 'Cadoles\CoreBundle\Entity\Registration',
'mode' => "string" 'mode' => "string",
'fields' => "array"
)); ));
} }
} }

View File

@ -27,6 +27,8 @@ class UserType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$session = new Session(); $session = new Session();
$fields=$options["fields"];
if(!is_array($fields)) $fields=[];
$builder->add('submit', $builder->add('submit',
SubmitType::class, array( SubmitType::class, array(
@ -44,15 +46,6 @@ class UserType extends AbstractType
) )
); );
$builder->add('firstname',
TextType::class, array(
"label" =>"Prénom",
"required" => false,
"disabled" => ($options["mode"]=="delete"||$options["masteridentity"]!="SQL"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
$builder->add('lastname', $builder->add('lastname',
TextType::class, array( TextType::class, array(
"label" =>"Nom", "label" =>"Nom",
@ -82,16 +75,6 @@ class UserType extends AbstractType
"choices" => $choices)); "choices" => $choices));
} }
$choices=array("oui" => "1","non" => "0");
$builder->add("visible",
ChoiceType::class,array(
"label" =>"Visible",
'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
$perm=$options["perm"]; $perm=$options["perm"];
$userid=$options["userid"]; $userid=$options["userid"];
$access=$options["access"]; $access=$options["access"];
@ -118,8 +101,6 @@ class UserType extends AbstractType
"disabled" => ($options["mode"]=="delete"||$options["masteridentity"]!="SQL"?true:false), "disabled" => ($options["mode"]=="delete"||$options["masteridentity"]!="SQL"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($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["masteridentity"]=="SQL") { if($options["mode"]!="delete"&&$options["masteridentity"]=="SQL") {
$builder->add('password', $builder->add('password',
RepeatedType::class, array( RepeatedType::class, array(
@ -131,175 +112,230 @@ class UserType extends AbstractType
) )
); );
} }
# Optionnel
$builder->add('usualname',
TextType::class, array(
"label" => "Nom d'Usage",
"required" => false,
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
$builder->add('givensname',
TextType::class, array(
"label" => "Autre Prénom",
"required" => false,
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
$builder->add('telephonenumber',
TextType::class, array(
"label" => "Téléphone",
"required" => false,
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
$builder->add('postaladress',
TextareaType::class, array(
"label" => "Adresse",
"required" => false,
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px; height:90px")
)
);
$builder->add('birthdate',
DateType::class, array( # En fonction de datauser
"label" => "Date de Naissance", if(!array_key_exists("firstname",$fields)||$fields["firstname"]["perm"]!=0) {
"required" => false, $builder->add('firstname',
"disabled" => ($options["mode"]=="delete"?true:false), TextType::class, [
"widget" => 'single_text', "label" =>"Prénom",
"format" => "dd/MM/yyyy", "required" => (!array_key_exists("firstname",$fields)?false:($fields["firstname"]["perm"]==2)),
"html5" => false, "disabled" => ($options["mode"]=="delete"||$options["masteridentity"]!="SQL"?true:false),
"attr" => array("class" => "form-control js-datepicker", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="delete"?true:false) "attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
]);
}
if(!array_key_exists("visible",$fields)||$fields["visible"]["perm"]!=0) {
$choices=array("oui" => "1","non" => "0");
$builder->add("visible",
ChoiceType::class,array(
"label" =>"Visible",
'disabled' => ($options["mode"]=="delete"?true:false),
"required" => (!array_key_exists("visible",$fields)?false:($fields["visible"]["perm"]==2)),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
) )
) );
); }
$choices=array("" => "", "homme" => "male","femme" => "female");
$builder->add("gender",
ChoiceType::class,array(
"label" =>"Sexe",
"required" => false,
'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
);
$builder->add('job', if(!array_key_exists("usualname",$fields)||$fields["usualname"]["perm"]!=0) {
TextType::class, array( $builder->add('usualname',
"label" => "Métier", TextType::class, array(
"required" => false, "label" => "Nom d'Usage",
"disabled" => ($options["mode"]=="delete"?true:false), "required" => (!array_key_exists("usualname",$fields)?false:($fields["usualname"]["perm"]==2)),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px") "disabled" => ($options["mode"]=="delete"?true:false),
) "attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
); )
);
}
$builder->add('position', if(!array_key_exists("gender",$fields)||$fields["gender"]["perm"]!=0) {
TextType::class, array( $choices=array("" => "", "homme" => "male","femme" => "female");
"label" => "Fonction", $builder->add("gender",
"required" => false, ChoiceType::class,array(
"disabled" => ($options["mode"]=="delete"?true:false), "label" =>"Sexe",
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px") "required" => (!array_key_exists("gender",$fields)?false:($fields["gender"]["perm"]==2)),
) 'disabled' => ($options["mode"]=="delete"?true:false),
); "attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices
)
$builder->add('birthcountry', );
Select2EntityType::class, array( }
'label' => "Pays de Naissance",
'disabled' => ($options["mode"]=="delete"?true:false), if(!array_key_exists("givensname",$fields)||$fields["givensname"]["perm"]!=0) {
'multiple' => false, $builder->add('givensname',
'remote_route' => 'cadoles_core_ajax_country_list', TextType::class, array(
'class' => 'Cadoles\coreBundle\Entity\Country', "label" => "Autre Prénom",
'primary_key' => 'id', "required" => (!array_key_exists("givensname",$fields)?false:($fields["givensname"]["perm"]==2)),
'text_property' => 'label', "disabled" => ($options["mode"]=="delete"?true:false),
'minimum_input_length' => 2, "attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
'page_limit' => 10, )
'allow_clear' => true, );
'delay' => 250, }
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true if(!array_key_exists("telephonenumber",$fields)||$fields["telephonenumber"]["perm"]!=0) {
'language' => 'fr', $builder->add('telephonenumber',
'placeholder' => 'Selectionner un pays', TextType::class, array(
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px") "label" => "Téléphone",
) "required" => (!array_key_exists("telephonenumber",$fields)?false:($fields["telephonenumber"]["perm"]==2)),
); "disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
$builder->add('birthplace', )
Select2EntityType::class, array( );
'label' => "Ville de Naissance", }
'disabled' => ($options["mode"]=="delete"?true:false),
'multiple' => false, if(!array_key_exists("postaladress",$fields)||$fields["postaladress"]["perm"]!=0) {
'remote_route' => 'cadoles_core_ajax_city_list', $builder->add('postaladress',
'class' => 'Cadoles\coreBundle\Entity\City', TextareaType::class, array(
'primary_key' => 'id', "label" => "Adresse",
'text_property' => 'label', "required" => (!array_key_exists("postaladress",$fields)?false:($fields["postaladress"]["perm"]==2)),
'minimum_input_length' => 2, "disabled" => ($options["mode"]=="delete"?true:false),
'page_limit' => 10, "attr" => array("class" => "form-control", "style" => "margin-bottom:15px; height:90px")
'allow_clear' => true, )
'delay' => 250, );
'cache' => false, }
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr', if(!array_key_exists("birthdate",$fields)||$fields["birthdate"]["perm"]!=0) {
'placeholder' => 'Selectionner une ville', $builder->add('birthdate',
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px") DateType::class, array(
) "label" => "Date de Naissance",
); "required" => (!array_key_exists("birthdate",$fields)?false:($fields["birthdate"]["perm"]==2)),
"disabled" => ($options["mode"]=="delete"?true:false),
if($session->get('viewniveau02')) { "widget" => 'single_text',
$builder->add('niveau02', "format" => "dd/MM/yyyy",
"html5" => false,
"attr" => array("class" => "form-control js-datepicker", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="delete"?true:false)
)
)
);
}
if(!array_key_exists("birthcountry",$fields)||$fields["birthcountry"]["perm"]!=0) {
$builder->add('birthcountry',
Select2EntityType::class, array( Select2EntityType::class, array(
'label' => $session->get('labelniveau02'), '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, 'multiple' => false,
'remote_route' => 'cadoles_core_ajax_niveau02_list', 'remote_route' => 'cadoles_core_ajax_country_list',
'class' => 'Cadoles\coreBundle\Entity\Niveau02', 'class' => 'Cadoles\coreBundle\Entity\Country',
'req_params' => ['niveau01' => 'parent.children[niveau01]'],
'primary_key' => 'id', 'primary_key' => 'id',
'text_property' => 'label', 'text_property' => 'label',
'minimum_input_length' => 0, 'minimum_input_length' => 2,
'page_limit' => 10, 'page_limit' => 10,
'allow_clear' => true, 'allow_clear' => true,
'delay' => 250, 'delay' => 250,
'cache' => false, 'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true 'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr', 'language' => 'fr',
'placeholder' => 'Selectionner '.$session->get('labelniveau02'), 'placeholder' => 'Selectionner un pays',
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px") 'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
) )
); );
}
if(!array_key_exists("birthplace",$fields)||($fields["birthcountry"]["perm"]!=0&&$fields["birthplace"]["perm"]!=0)) {
$builder->add('birthplace',
Select2EntityType::class, array(
'label' => "Ville de Naissance",
'disabled' => ($options["mode"]=="delete"?true:false),
"required" => false,
'multiple' => false,
'remote_route' => 'cadoles_core_ajax_city_list',
'class' => 'Cadoles\coreBundle\Entity\City',
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 2,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => 'Selectionner une ville',
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
if(!array_key_exists("job",$fields)||$fields["job"]["perm"]!=0) {
$builder->add('job',
TextType::class, array(
"label" => "Métier",
"required" => (!array_key_exists("job",$fields)?false:($fields["job"]["perm"]==2)),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
if(!array_key_exists("position",$fields)||$fields["position"]["perm"]!=0) {
$builder->add('position',
TextType::class, array(
"label" => "Fonction",
"required" => (!array_key_exists("position",$fields)?false:($fields["position"]["perm"]==2)),
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
if($session->get('viewniveau02')) {
if(!array_key_exists("niveau02",$fields)||$fields["niveau02"]["perm"]!=0) {
$builder->add('niveau02',
Select2EntityType::class, array(
'label' => $session->get('labelniveau02'),
'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',
'class' => 'Cadoles\coreBundle\Entity\Niveau02',
'req_params' => ['niveau01' => 'parent.children[niveau01]'],
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 0,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => 'Selectionner '.$session->get('labelniveau02'),
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px")
)
);
}
} }
if($options["access"]=="config") { if($options["access"]=="config") {
$choices=array("simple" => "simple","substantiel" => "substantiel","fort" => "fort"); if(!array_key_exists("authlevel",$fields)||$fields["authlevel"]["perm"]!=0) {
$builder->add("authlevel", $choices=array("simple" => "simple","substantiel" => "substantiel","fort" => "fort");
ChoiceType::class,array( $builder->add("authlevel",
"label" =>"Niveau d'authentification", ChoiceType::class,array(
"required" => true, "label" =>"Niveau d'authentification",
'disabled' => ($options["mode"]=="delete"?true:false), "required" => (!array_key_exists("authlevel",$fields)?false:($fields["authlevel"]["perm"]==2)),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"), 'disabled' => ($options["mode"]=="delete"?true:false),
"choices" => $choices "attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
) "choices" => $choices
); )
);
}
$choices=array("agent" => "agent","prestataire" => "prestataire","partenaire" => "partenaire","stagiaire" => "stagiare"); if(!array_key_exists("belongingpopulation",$fields)||$fields["belongingpopulation"]["perm"]!=0) {
$builder->add("belongingpopulation", $choices=array("agent" => "agent","prestataire" => "prestataire","partenaire" => "partenaire","stagiaire" => "stagiare");
ChoiceType::class,array( $builder->add("belongingpopulation",
"label" =>"Population d'appartenance", ChoiceType::class,array(
"required" => true, "label" =>"Population d'appartenance",
'disabled' => ($options["mode"]=="delete"?true:false), "required" => (!array_key_exists("niveau02",$fields)?false:($fields["belongingpopulation"]["perm"]==2)),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"), 'disabled' => ($options["mode"]=="delete"?true:false),
"choices" => $choices "attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
) "choices" => $choices
); )
);
}
} }
# Avatar # Avatar
@ -321,7 +357,8 @@ class UserType extends AbstractType
'access' => "string", 'access' => "string",
'perm' => "boolean", 'perm' => "boolean",
'userid' => "integer", 'userid' => "integer",
'masteridentity' => "string" 'masteridentity' => "string",
"fields" => "array"
)); ));
} }
} }

View File

@ -157,6 +157,9 @@ cadoles_core_config_permmodo_update:
path: /config/commun/permmodo/update path: /config/commun/permmodo/update
defaults: { _controller: CadolesCoreBundle:Config:permmodoupdate } defaults: { _controller: CadolesCoreBundle:Config:permmodoupdate }
cadoles_core_config_datauser:
path: /config/commun/datauser
defaults: { _controller: CadolesCoreBundle:Config:datauser }
#== Registration ========================================================================================================= #== Registration =========================================================================================================
#-- Access config #-- Access config

View File

@ -0,0 +1,35 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
Paramétrage de la Fiche Utilisateur
</h1>
{{ form_widget(form.submit) }}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
});
{% endblock %}

View File

@ -86,10 +86,10 @@
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ form_row(form.firstname) }} {% if form.firstname is defined %} {{ form_row(form.firstname) }} {% endif %}
{{ form_row(form.lastname) }} {{ form_row(form.lastname) }}
{{ form_row(form.email) }} {% if form.email is defined %} {{ form_row(form.email) }} {% endif %}
{{ form_row(form.visible) }} {% if form.visible is defined %} {{ form_row(form.visible) }} {% endif %}
</div> </div>
</div> </div>
</div> </div>
@ -100,31 +100,38 @@
<i class="fa fa-sitemap fa-fw"></i> Organisation <i class="fa fa-sitemap fa-fw"></i> Organisation
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ form_row(form.job) }} {% if form.job is defined %} {{ form_row(form.job) }} {% endif %}
{{ form_row(form.position) }} {% if form.position is defined %} {{ form_row(form.position) }} {% endif %}
{{ form_row(form.niveau01) }} {{ form_row(form.niveau01) }}
{{ form_row(form.niveau02) }} {% if form.niveau02 is defined %} {{ form_row(form.niveau02) }} {% endif %}
</div> </div>
</div> </div>
<div class="panel panel-primary"> <div id="paneloption" class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-user fa-fw"></i> Optionnel <i class="fa fa-user fa-fw"></i> Optionnel
</div> </div>
<div class="panel-body"> <div class="panel-body">
{% if form.usualname is defined and form.gender is defined%}
<div class="row"> <div class="row">
<div class="col-xs-8"> <div class="col-xs-8">
{{ form_row(form.usualname) }} {{ form_row(form.usualname) }}
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
{{ form_row(form.gender) }} {{ form_row(form.gender) }}
</div> </div>
</div> </div>
{{ form_row(form.givensname) }} {% elseif form.usualname is defined %} {{ form_row(form.usualname) }}
{{ form_row(form.telephonenumber) }} {% elseif form.gender is defined %} {{ form_row(form.gender) }}
{{ form_row(form.postaladress) }} {% endif %}
{% if form.givensname is defined %} {{ form_row(form.givensname) }} {% endif %}
{% if form.telephonenumber is defined %} {{ form_row(form.telephonenumber) }} {% endif %}
{% if form.postaladress is defined %} {{ form_row(form.postaladress) }} {% endif %}
{% if form.birthdate is defined and form.birthdate is defined%}
<div class="row"> <div class="row">
<div class="col-xs-4"> <div class="col-xs-4">
{{ form_row(form.birthdate) }} {{ form_row(form.birthdate) }}
@ -133,9 +140,12 @@
{{ form_row(form.birthcountry) }} {{ form_row(form.birthcountry) }}
</div> </div>
</div> </div>
{% elseif form.birthdate is defined %} {{ form_row(form.birthdate) }}
{% elseif form.birthcountry is defined %} {{ form_row(form.birthcountry) }}
{% endif %}
<div id="blockcity"> <div id="blockcity">
{{ form_row(form.birthplace) }} {% if form.birthplace is defined %} {{ form_row(form.birthplace) }} {% endif %}
</div> </div>
</div> </div>
</div> </div>
@ -179,6 +189,7 @@
} }
$(document).ready(function() { $(document).ready(function() {
if(!$("#paneloption").find(".panel-body").find("label").length) $("#paneloption").hide();
hideshow(); hideshow();
}); });
{% endblock %} {% endblock %}

View File

@ -83,22 +83,34 @@
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ form_row(form.firstname) }} {% if form.firstname is defined %} {{ form_row(form.firstname) }} {% endif %}
{{ form_row(form.lastname) }} {{ form_row(form.lastname) }}
{{ form_row(form.email) }} {{ form_row(form.email) }}
{{ form_row(form.visible) }} {% if form.visible is defined %} {{ form_row(form.visible) }} {% endif %}
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-sitemap fa-fw"></i> Organisation
</div>
<div class="panel-body">
{% if form.job is defined %}{{ form_row(form.job) }}{% endif %}
{% if form.position is defined %}{{ form_row(form.position) }}{% endif %}
{{ form_row(form.niveau01) }}
{% if form.niveau02 is defined %}{{ form_row(form.niveau02) }}{% endif %}
</div> </div>
</div> </div>
{% if access=="config" %} {% if access=="config" %}
<div class="panel panel-primary"> <div id="panelopenid" class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-key fa-fw"></i> OpenID <i class="fa fa-key fa-fw"></i> OpenID
</div> </div>
<div class="panel-body"> <div class="panel-body">
{{ form_row(form.authlevel) }} {% if form.authlevel is defined %}{{ form_row(form.authlevel) }}{% endif %}
{{ form_row(form.belongingpopulation) }} {% if form.belongingpopulation is defined %}{{ form_row(form.belongingpopulation) }}{% endif %}
</div> </div>
</div> </div>
{% endif %} {% endif %}
@ -187,38 +199,33 @@
</div> </div>
</div> </div>
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-sitemap fa-fw"></i> Organisation
</div>
<div class="panel-body">
{{ form_row(form.job) }}
{{ form_row(form.position) }}
{{ form_row(form.niveau01) }}
{% if form.niveau02 is defined %}
{{ form_row(form.niveau02) }}
{% endif %}
</div>
</div>
<div class="panel panel-primary">
<div id="paneloption" class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-user fa-fw"></i> Optionnel <i class="fa fa-user fa-fw"></i> Optionnel
</div> </div>
<div class="panel-body"> <div class="panel-body">
{% if form.usualname is defined and form.gender is defined%}
<div class="row"> <div class="row">
<div class="col-xs-8"> <div class="col-xs-8">
{{ form_row(form.usualname) }} {{ form_row(form.usualname) }}
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
{{ form_row(form.gender) }} {{ form_row(form.gender) }}
</div> </div>
</div> </div>
{{ form_row(form.givensname) }} {% elseif form.usualname is defined %} {{ form_row(form.usualname) }}
{{ form_row(form.telephonenumber) }} {% elseif form.gender is defined %} {{ form_row(form.gender) }}
{{ form_row(form.postaladress) }} {% endif %}
{% if form.givensname is defined %} {{ form_row(form.givensname) }} {% endif %}
{% if form.telephonenumber is defined %} {{ form_row(form.telephonenumber) }} {% endif %}
{% if form.postaladress is defined %} {{ form_row(form.postaladress) }} {% endif %}
{% if form.birthdate is defined and form.birthdate is defined%}
<div class="row"> <div class="row">
<div class="col-xs-4"> <div class="col-xs-4">
{{ form_row(form.birthdate) }} {{ form_row(form.birthdate) }}
@ -227,9 +234,12 @@
{{ form_row(form.birthcountry) }} {{ form_row(form.birthcountry) }}
</div> </div>
</div> </div>
{% elseif form.birthdate is defined %} {{ form_row(form.birthdate) }}
{% elseif form.birthcountry is defined %} {{ form_row(form.birthcountry) }}
{% endif %}
<div id="blockcity"> <div id="blockcity">
{{ form_row(form.birthplace) }} {% if form.birthplace is defined %} {{ form_row(form.birthplace) }} {% endif %}
</div> </div>
</div> </div>
</div> </div>
@ -350,6 +360,8 @@
// Vider le password // Vider le password
$("#user_password_first").val(""); $("#user_password_first").val("");
if(!$("#panelopenid").find(".panel-body").find("label").length) $("#panelopenid").hide();
if(!$("#paneloption").find(".panel-body").find("label").length) $("#paneloption").hide();
// Afficher / Masquer // Afficher / Masquer
hideshow(); hideshow();

View File

@ -25,7 +25,7 @@
Niveau01 & Niveau02 & Pays & Ville = doivent exister dans la base<br><br> Niveau01 & Niveau02 & Pays & Ville = doivent exister dans la base<br><br>
Importation impossible si login et/ou email déjà existant en base<br> Importation impossible si login et/ou email déjà existant en base<br>
A chaque création un mail sera envoyé à l'utilisateur pour lui préceser qu'il est inscrit et qu'il devra suivre le process de reinitialisation de password pour ce connecter au portail. A chaque création un mail sera envoyé à l'utilisateur pour lui préciser qu'il est inscrit et qu'il devra suivre le process de reinitialisation de password pour ce connecter au portail.
</div> </div>
</div> </div>

View File

@ -22,11 +22,9 @@
> Items Envole > Items Envole
> Donner des permissions d'écritures sur les calendriers comme sur le blog > Donner des permissions d'écritures sur les calendriers comme sur le blog
> Que faire si lock sur cron depuis trop longtemps
> Couleur sur blog > Couleur sur blog
> Couleur et icone sur Itemcategory (base faite reste à implémenter dans les écrans) > Couleur et icone sur Itemcategory (base faite reste à implémenter dans les écrans)
> Import de compte
> Widget Open Office > Widget Open Office
> Role Animateur de Groupe > Role Animateur de Groupe
> Widget invitation > Widget invitation
@ -36,10 +34,6 @@
> France Connect Agent > France Connect Agent
> Page Blanche paramétrable > Page Blanche paramétrable
> Fiche user paramétrable > Fiche user paramétrable
> Sonde Piwik
> Index sur group.fgall
> Widgets Envole
- Opensondage

View File

@ -28,6 +28,7 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1010, 1000, 1010, 'Générale', 'cadoles_core_config_commun', 'fa-table', 'ROLE_ADMIN,ROLE_MODO', ''), (1010, 1000, 1010, 'Générale', 'cadoles_core_config_commun', 'fa-table', 'ROLE_ADMIN,ROLE_MODO', ''),
(1020, 1000, 1020, 'Thème', 'cadoles_core_config_theme', 'fa-paint-brush', 'ROLE_ADMIN,ROLE_MODO', ''), (1020, 1000, 1020, 'Thème', 'cadoles_core_config_theme', 'fa-paint-brush', 'ROLE_ADMIN,ROLE_MODO', ''),
(1030, 1000, 1030, 'Modération', 'cadoles_core_config_permmodo', 'fa-balance-scale', 'ROLE_ADMIN', ''), (1030, 1000, 1030, 'Modération', 'cadoles_core_config_permmodo', 'fa-balance-scale', 'ROLE_ADMIN', ''),
(1040, 1000, 1040, 'Fiche Utilisateur', 'cadoles_core_config_datauser', 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''),
(1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''), (1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''),
(1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN,ROLE_MODO', ''), (1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN,ROLE_MODO', ''),
@ -80,6 +81,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
('003', 1, 1, 0, 'string', 'subappname', 'Portail', '', 'Le sous titre de votre site'), ('003', 1, 1, 0, 'string', 'subappname', 'Portail', '', 'Le sous titre de votre site'),
('004', 1, 1, 1, 'logo', 'logo', 'uploads/logo/logo.png', '', 'Le logo de votre site'), ('004', 1, 1, 1, 'logo', 'logo', 'uploads/logo/logo.png', '', 'Le logo de votre site'),
('005', 0, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'), ('005', 0, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'),
('006', 0, 1, 0, 'datauser', 'datauser', '', '', 'Parametrage des champs utilisateurs : obligatoire / facultatif / caché'),
('010', 1, 1, 1, 'boolean', 'fgforceconnect', '0', '', 'Forcer la connection afin de rendre votre site privé'), ('010', 1, 1, 1, 'boolean', 'fgforceconnect', '0', '', 'Forcer la connection afin de rendre votre site privé'),
@ -107,12 +109,14 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
INSERT IGNORE permmodo (`route`, `visible`) VALUES INSERT IGNORE permmodo (`route`, `visible`) VALUES
('cadoles_core_config_commun',0), ('cadoles_core_config_commun',0),
('cadoles_core_config_theme',0), ('cadoles_core_config_theme',0),
('cadoles_core_config_datauser',0),
('cadoles_core_config_whitelist',0), ('cadoles_core_config_whitelist',0),
('cadoles_core_config_niveau01',0), ('cadoles_core_config_niveau01',0),
('cadoles_core_config_niveau02',1), ('cadoles_core_config_niveau02',1),
('cadoles_core_config_group',1), ('cadoles_core_config_group',1),
('cadoles_core_config_registration',1), ('cadoles_core_config_registration',1),
('cadoles_core_config_user',1), ('cadoles_core_config_user',1),
('cadoles_core_config_importuser',0),
('cadoles_portal_config_page',1), ('cadoles_portal_config_page',1),
('cadoles_portal_config_item',1), ('cadoles_portal_config_item',1),
('cadoles_portal_config_alert',1), ('cadoles_portal_config_alert',1),