parent
198ebd14f5
commit
7ce296fd29
|
@ -317,6 +317,9 @@ class ConfigController extends Controller
|
||||||
|
|
||||||
$fields["role"]["perm"]=1;
|
$fields["role"]["perm"]=1;
|
||||||
$fields["role"]["label"]="Rôles";
|
$fields["role"]["label"]="Rôles";
|
||||||
|
|
||||||
|
$fields["telephonenumber"]["perm"]=1;
|
||||||
|
$fields["telephonenumber"]["label"]="Téléphone";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$fields=json_decode($fields, true);
|
$fields=json_decode($fields, true);
|
||||||
|
|
|
@ -65,71 +65,92 @@ class UserController extends Controller
|
||||||
$draw= $request->query->get('draw');
|
$draw= $request->query->get('draw');
|
||||||
$order= $request->query->get('order');
|
$order= $request->query->get('order');
|
||||||
$viewniveau02=$this->getParameter('viewniveau02');
|
$viewniveau02=$this->getParameter('viewniveau02');
|
||||||
|
$fields=$this->getDefaultDatauser();
|
||||||
|
$fgusevisible=!($fields["visible"]["perm"]==0);
|
||||||
|
|
||||||
// Nombre total d'enregistrement
|
// Nombre total d'enregistrement
|
||||||
if($this->isGranted('ROLE_ADMIN')||$access=="user")
|
if($access=="config") {
|
||||||
$total = $em->createQueryBuilder()->select('COUNT(user)')->from($this->labelentity,'user')->getQuery()->getSingleScalarResult();
|
if($this->isGranted('ROLE_ADMIN')) {
|
||||||
elseif($this->isGranted('ROLE_MODO')) {
|
$total = $em->createQueryBuilder()->select('COUNT(user)')->from($this->labelentity,'user')->getQuery()->getSingleScalarResult();
|
||||||
$usermodo=$this->get('security.token_storage')->getToken()->getUser()->getId();
|
}
|
||||||
$total = $em->createQueryBuilder()
|
elseif($this->isGranted('ROLE_MODO')) {
|
||||||
->select('COUNT(user)')
|
$usermodo=$this->get('security.token_storage')->getToken()->getUser()->getId();
|
||||||
->from($this->labelentity,'user')
|
$total = $em->createQueryBuilder()
|
||||||
->from("CadolesCoreBundle:UserModo",'usermodo')
|
->select('COUNT(user)')
|
||||||
->where("usermodo.niveau01 = user.niveau01")
|
->from($this->labelentity,'user')
|
||||||
->andWhere("usermodo.user = :userid")
|
->from("CadolesCoreBundle:UserModo",'usermodo')
|
||||||
->setParameter("userid", $usermodo)
|
->where("usermodo.niveau01 = user.niveau01")
|
||||||
->getQuery()->getSingleScalarResult();
|
->andWhere("usermodo.user = :userid")
|
||||||
|
->setParameter("userid", $usermodo)
|
||||||
|
->getQuery()->getSingleScalarResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif($this->isGranted('ROLE_ANIM')||$this->isGranted('ROLE_USER')) {
|
else {
|
||||||
$niveau01=$this->get('security.token_storage')->getToken()->getUser()->getNiveau01();
|
if($fgusevisible) {
|
||||||
$total = $em->createQueryBuilder()
|
$total = $em->createQueryBuilder()->select('COUNT(user)')->from($this->labelentity,'user')->where('user.visible=true')->getQuery()->getSingleScalarResult();
|
||||||
->select('COUNT(user)')
|
}
|
||||||
->from($this->labelentity,'user')
|
else {
|
||||||
->where("user.niveau01 = :niveau01")
|
$total = $em->createQueryBuilder()->select('COUNT(user)')->from($this->labelentity,'user')->getQuery()->getSingleScalarResult();
|
||||||
->setParameter("niveau01", $niveau01)
|
}
|
||||||
->getQuery()->getSingleScalarResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nombre d'enregistrement filtré
|
// Nombre d'enregistrement filtré
|
||||||
if($search["value"]=="")
|
if($search["value"]=="")
|
||||||
$totalf = $total;
|
$totalf = $total;
|
||||||
else {
|
else {
|
||||||
if($this->isGranted('ROLE_ADMIN')||$access=="user")
|
if($access=="config") {
|
||||||
$totalf= $em->createQueryBuilder()
|
if($this->isGranted('ROLE_ADMIN')) {
|
||||||
->select('COUNT(user)')
|
$totalf= $em->createQueryBuilder()
|
||||||
->from('CadolesCoreBundle:User','user')
|
->select('COUNT(user)')
|
||||||
->from('CadolesCoreBundle:Niveau01', 'niveau01')
|
->from('CadolesCoreBundle:User','user')
|
||||||
->where('user.niveau01=niveau01.id')
|
->from('CadolesCoreBundle:Niveau01', 'niveau01')
|
||||||
->andWhere('user.username LIKE :value OR user.firstname LIKE :value OR user.lastname LIKE :value OR user.email LIKE :value OR user.role LIKE :value OR niveau01.label LIKE :value')
|
->where('user.niveau01=niveau01.id')
|
||||||
->setParameter("value", "%".$search["value"]."%")
|
->andWhere('user.username LIKE :value OR user.firstname LIKE :value OR user.lastname LIKE :value OR user.email LIKE :value OR user.role LIKE :value OR niveau01.label LIKE :value')
|
||||||
->getQuery()
|
->setParameter("value", "%".$search["value"]."%")
|
||||||
->getSingleScalarResult();
|
->getQuery()
|
||||||
elseif($this->isGranted('ROLE_MODO'))
|
->getSingleScalarResult();
|
||||||
$totalf= $em->createQueryBuilder()
|
}
|
||||||
->select('COUNT(user)')
|
elseif($this->isGranted('ROLE_MODO')) {
|
||||||
->from('CadolesCoreBundle:User','user')
|
$totalf= $em->createQueryBuilder()
|
||||||
->from('CadolesCoreBundle:Niveau01', 'niveau01')
|
->select('COUNT(user)')
|
||||||
->from('CadolesCoreBundle:UserModo', 'usermodo')
|
->from('CadolesCoreBundle:User','user')
|
||||||
->where('user.niveau01=niveau01.id')
|
->from('CadolesCoreBundle:Niveau01', 'niveau01')
|
||||||
->andWhere('user.username LIKE :value OR user.firstname LIKE :value OR user.lastname LIKE :value OR user.email LIKE :value OR user.role LIKE :value OR niveau01.label LIKE :value')
|
->from('CadolesCoreBundle:UserModo', 'usermodo')
|
||||||
->andwhere("usermodo.niveau01 = user.niveau01")
|
->where('user.niveau01=niveau01.id')
|
||||||
->andWhere("usermodo.user = :userid")
|
->andWhere('user.username LIKE :value OR user.firstname LIKE :value OR user.lastname LIKE :value OR user.email LIKE :value OR user.role LIKE :value OR niveau01.label LIKE :value')
|
||||||
->setParameter("userid", $usermodo)
|
->andwhere("usermodo.niveau01 = user.niveau01")
|
||||||
->setParameter("value", "%".$search["value"]."%")
|
->andWhere("usermodo.user = :userid")
|
||||||
->getQuery()
|
->setParameter("userid", $usermodo)
|
||||||
->getSingleScalarResult();
|
->setParameter("value", "%".$search["value"]."%")
|
||||||
elseif($this->isGranted('ROLE_ANIM')||$this->isGranted('ROLE_USER'))
|
->getQuery()
|
||||||
$totalf= $em->createQueryBuilder()
|
->getSingleScalarResult();
|
||||||
->select('COUNT(user)')
|
}
|
||||||
->from('CadolesCoreBundle:User','user')
|
}
|
||||||
->from('CadolesCoreBundle:Niveau01', 'niveau01')
|
else {
|
||||||
->where('user.niveau01=niveau01.id')
|
if($fgusevisible) {
|
||||||
->andWhere('user.username LIKE :value OR user.firstname LIKE :value OR user.lastname LIKE :value OR user.email LIKE :value OR user.role LIKE :value OR niveau01.label LIKE :value')
|
$totalf= $em->createQueryBuilder()
|
||||||
->andWhere("user.niveau01 = :niveau01")
|
->select('COUNT(user)')
|
||||||
->setParameter("niveau01", $niveau01)
|
->from('CadolesCoreBundle:User','user')
|
||||||
->setParameter("value", "%".$search["value"]."%")
|
->from('CadolesCoreBundle:Niveau01', 'niveau01')
|
||||||
->getQuery()
|
->where('user.niveau01=niveau01.id')
|
||||||
->getSingleScalarResult();
|
->andWhere('user.visible=true')
|
||||||
|
->andWhere('user.username LIKE :value OR user.firstname LIKE :value OR user.lastname LIKE :value OR user.email LIKE :value OR user.role LIKE :value OR niveau01.label LIKE :value')
|
||||||
|
->setParameter("value", "%".$search["value"]."%")
|
||||||
|
->getQuery()
|
||||||
|
->getSingleScalarResult();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$totalf= $em->createQueryBuilder()
|
||||||
|
->select('COUNT(user)')
|
||||||
|
->from('CadolesCoreBundle:User','user')
|
||||||
|
->from('CadolesCoreBundle:Niveau01', 'niveau01')
|
||||||
|
->where('user.niveau01=niveau01.id')
|
||||||
|
->andWhere('user.username LIKE :value OR user.firstname LIKE :value OR user.lastname LIKE :value OR user.email LIKE :value OR user.role LIKE :value OR niveau01.label LIKE :value')
|
||||||
|
->setParameter("value", "%".$search["value"]."%")
|
||||||
|
->getQuery()
|
||||||
|
->getSingleScalarResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construction du tableau de retour
|
// Construction du tableau de retour
|
||||||
|
@ -142,22 +163,23 @@ class UserController extends Controller
|
||||||
|
|
||||||
// Parcours des Enregistrement
|
// Parcours des Enregistrement
|
||||||
$qb = $em->createQueryBuilder();
|
$qb = $em->createQueryBuilder();
|
||||||
if($this->isGranted('ROLE_ADMIN')||$access=="user") {
|
if($access=="config") {
|
||||||
|
if($this->isGranted('ROLE_ADMIN')) {
|
||||||
|
$qb->select('user')->from($this->labelentity,'user')->from('CadolesCoreBundle:Niveau01','niveau01');
|
||||||
|
$qb->where('user.niveau01=niveau01.id');
|
||||||
|
}
|
||||||
|
elseif($this->isGranted('ROLE_MODO')) {
|
||||||
|
$qb->select('user')->from($this->labelentity,'user')->from('CadolesCoreBundle:Niveau01','niveau01')->from('CadolesCoreBundle:UserModo', 'usermodo');
|
||||||
|
$qb->where('user.niveau01=niveau01.id')
|
||||||
|
->andwhere("usermodo.niveau01 = user.niveau01")
|
||||||
|
->andWhere("usermodo.user = :userid")
|
||||||
|
->setParameter("userid", $usermodo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
$qb->select('user')->from($this->labelentity,'user')->from('CadolesCoreBundle:Niveau01','niveau01');
|
$qb->select('user')->from($this->labelentity,'user')->from('CadolesCoreBundle:Niveau01','niveau01');
|
||||||
$qb->where('user.niveau01=niveau01.id');
|
$qb->where('user.niveau01=niveau01.id');
|
||||||
}
|
if($fgusevisible) $qb->andWhere('user.visible=true');
|
||||||
elseif($this->isGranted('ROLE_MODO')) {
|
|
||||||
$qb->select('user')->from($this->labelentity,'user')->from('CadolesCoreBundle:Niveau01','niveau01')->from('CadolesCoreBundle:UserModo', 'usermodo');
|
|
||||||
$qb->where('user.niveau01=niveau01.id')
|
|
||||||
->andwhere("usermodo.niveau01 = user.niveau01")
|
|
||||||
->andWhere("usermodo.user = :userid")
|
|
||||||
->setParameter("userid", $usermodo);
|
|
||||||
}
|
|
||||||
elseif($this->isGranted('ROLE_ANIM')||$this->isGranted('ROLE_USER')) {
|
|
||||||
$qb->select('user')->from($this->labelentity,'user')->from('CadolesCoreBundle:Niveau01','niveau01');
|
|
||||||
$qb->where('user.niveau01=niveau01.id')
|
|
||||||
->andwhere("user.niveau01 = :niveau01")
|
|
||||||
->setParameter("niveau01", $niveau01);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($search["value"]!="") {
|
if($search["value"]!="") {
|
||||||
|
@ -184,10 +206,14 @@ class UserController extends Controller
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6 :
|
case 6 :
|
||||||
|
$qb->orderBy('user.telephonenumber',$order[0]["dir"]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7 :
|
||||||
$qb->orderBy('niveau01.label',$order[0]["dir"]);
|
$qb->orderBy('niveau01.label',$order[0]["dir"]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9 :
|
case 10 :
|
||||||
$qb->orderBy('user.role',$order[0]["dir"]);
|
$qb->orderBy('user.role',$order[0]["dir"]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -211,10 +237,14 @@ class UserController extends Controller
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5 :
|
case 5 :
|
||||||
|
$qb->orderBy('user.telephonenumber',$order[0]["dir"]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6 :
|
||||||
$qb->orderBy('niveau01.label',$order[0]["dir"]);
|
$qb->orderBy('niveau01.label',$order[0]["dir"]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7 :
|
case 8 :
|
||||||
$qb->orderBy('user.role',$order[0]["dir"]);
|
$qb->orderBy('user.role',$order[0]["dir"]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -245,6 +275,7 @@ class UserController extends Controller
|
||||||
array_push($tmp,$data->getLastname());
|
array_push($tmp,$data->getLastname());
|
||||||
array_push($tmp,$data->getFirstname());
|
array_push($tmp,$data->getFirstname());
|
||||||
array_push($tmp,"<a href='mailto:".$data->getEmail()."'>".$data->getEmail()."</a>");
|
array_push($tmp,"<a href='mailto:".$data->getEmail()."'>".$data->getEmail()."</a>");
|
||||||
|
array_push($tmp,$data->getTelephonenumber());
|
||||||
array_push($tmp,$data->getNiveau01()->getLabel());
|
array_push($tmp,$data->getNiveau01()->getLabel());
|
||||||
if($viewniveau02) array_push($tmp,($data->getNiveau02()!==null?$data->getNiveau02()->getLabel():""));
|
if($viewniveau02) array_push($tmp,($data->getNiveau02()!==null?$data->getNiveau02()->getLabel():""));
|
||||||
array_push($tmp,$groups);
|
array_push($tmp,$groups);
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<th class="{% if fields["lastname"] is defined and fields["lastname"].perm==0 %}no-visible{% endif %}">Nom</th>
|
<th class="{% if fields["lastname"] is defined and fields["lastname"].perm==0 %}no-visible{% endif %}">Nom</th>
|
||||||
<th class="{% if fields["firstname"] is defined and fields["firstname"].perm==0 %}no-visible{% endif %}">Prénom</th>
|
<th class="{% if fields["firstname"] is defined and fields["firstname"].perm==0 %}no-visible{% endif %}">Prénom</th>
|
||||||
<th class="{% if fields["email"] is defined and fields["email"].perm==0 %}no-visible{% endif %}">Email</th>
|
<th class="{% if fields["email"] is defined and fields["email"].perm==0 %}no-visible{% endif %}">Email</th>
|
||||||
|
<th class="{% if fields["telephonenumber"] is defined and fields["telephonenumber"].perm==0 %}no-visible{% endif %}">Téléphone</th>
|
||||||
<th class="{% if fields["niveau01"] is defined and fields["niveau01"].perm==0 %}no-visible{% endif %}">{{ labelniveau01 }}</th>
|
<th class="{% if fields["niveau01"] is defined and fields["niveau01"].perm==0 %}no-visible{% endif %}">{{ labelniveau01 }}</th>
|
||||||
{% if viewniveau02 %}
|
{% if viewniveau02 %}
|
||||||
<th class="no-sort {% if fields["niveau02"] is defined and fields["niveau02"].perm==0 %}no-visible{% endif %}">{{ labelniveau02 }}</th>
|
<th class="no-sort {% if fields["niveau02"] is defined and fields["niveau02"].perm==0 %}no-visible{% endif %}">{{ labelniveau02 }}</th>
|
||||||
|
|
Loading…
Reference in New Issue