Merge branch 'master' into dist/envole/6/master

This commit is contained in:
Arnaud Fornerot 2021-04-26 15:43:33 +02:00
commit 996651ca0e
4 changed files with 41 additions and 12 deletions

View File

@ -494,6 +494,13 @@ class GroupController extends Controller
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
$user=$this->getUser();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datausers");
$fields=$config->getValue();
$fields=json_decode($fields,true);
if(!is_array($fields)) $fields=[];
if(!array_key_exists("visite",$fields)) $fields["visite"]["perm"]=0;
$fgviewvisite=($fields["visite"]["perm"]==1);
foreach($datas as $data) {
// Propriétaire
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$data->getId(),"group"=>$id]);
@ -522,12 +529,18 @@ class GroupController extends Controller
}
// Visite
$visite="";
if($usergroup->getVisitedate()) {
$visite=$usergroup->getVisitedate()->format("d/m/Y H:i")."<br>nb = ".$usergroup->getVisitecpt();
if($fgviewvisite) {
$visite="";
if($usergroup->getVisitedate()) {
$visite=$usergroup->getVisitedate()->format("d/m/Y H:i")."<br>nb = ".$usergroup->getVisitecpt();
}
}
if($fgviewvisite)
$tmp=array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail(),$visite,$rolegroup);
else
$tmp=array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail(),$rolegroup);
array_push($output["data"],array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail(),$visite,$rolegroup));
array_push($output["data"],$tmp);
}
// Retour
@ -1018,6 +1031,14 @@ class GroupController extends Controller
// idreturn ?
$idreturn=$request->get("idreturn");
$em = $this->getDoctrine()->getManager();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datausers");
$fields=$config->getValue();
$fields=json_decode($fields,true);
if(!is_array($fields)) $fields=[];
if(!array_key_exists("visite",$fields)) $fields["visite"]["perm"]=0;
$fgviewvisite=($fields["visite"]["perm"]==1);
// Affichage du formulaire
return $this->render($this->labelentity.':users.html.twig', [
'useheader' => true,
@ -1026,6 +1047,7 @@ class GroupController extends Controller
'access' => $access,
$this->labeldata => $data,
'idreturn' => $idreturn,
'fgviewvisite' => $fgviewvisite,
]);
}

View File

@ -841,12 +841,15 @@ class UserController extends Controller
public function viewAction($id, Request $request)
{
$user=$this->getData($id);
$fields=$this->getDefaultDatauser();
return $this->render('CadolesCoreBundle:User:view.html.twig', [
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
"user" => $user
'user' => $user,
'fields' => $fields,
]);
}

View File

@ -36,7 +36,9 @@
<th width="70px" class="no-sort">Avatar</th>
<th width="200px">Login</th>
<th>Email</th>
{% if fgviewvisite %}
<th class="no-sort no-visible">Visite</th>
{% endif %}
{% if group.fgcanshare %}
<th class="no-sort no-visible">Permissions</th>
{% endif %}
@ -63,7 +65,9 @@
<th width="70px" class="no-sort">Avatar</th>
<th width="200px">Login</th>
<th>Email</th>
{% if fgviewvisite %}
<th class="no-sort">Visite</th>
{% endif %}
{% if group.fgcanshare %}
<th class="no-sort">Permissions</th>
{% endif %}

View File

@ -11,16 +11,16 @@
<br>L'utilisateur souhaite masquer ses informations personnelles.
{% else %}
{%if user.lastname %}<b>Nom</b> = {{ user.lastname }}<br>{%endif%}
{%if user.firstname %}<b>Prénom</b> = {{ user.firstname }}<br>{%endif%}
{%if user.firstname and not fields["firstname"]["perm"]==0 %}<b>{{fields["firstname"]["label"]}}</b> = {{ user.firstname }}<br>{%endif%}
{%if user.email %}<b>Email</b> = <a href='mailto:{{ user.email }}'>{{ user.email }}</a><br>{%endif%}
{%if user.telephonenumber %}<b>Téléphone</b> = {{ user.telephonenumber }}<br>{%endif%}
{%if user.telephonenumber and not fields["telephonenumber"]["perm"]==0 %}<b>{{fields["telephonenumber"]["label"]}}</b> = {{ user.telephonenumber }}<br>{%endif%}
{%if user.niveau01 %}<b>{{ labelniveau01 }}</b> = {{ user.niveau01.label }}<br>{%endif%}
{%if viewniveau02 and user.niveau02%}<b>{{ labelniveau02 }}</b> = {{ user.niveau02.label }}<br>{% endif %}
{%if user.job %}<b>Métier</b> = {{ user.job }}<br>{%endif%}
{%if user.position %}<b>Fonction</b> = {{ user.position }}<br>{%endif%}
{%if user.postaladress %}<b>Adresse</b> = {{ user.postaladress }}<br>{%endif%}
{%if user.visitedate %}<b>Date de dernière visite</b> = {{ user.visitedate|date('d/m/Y H:i') }}<br>{%endif%}
{%if user.visitecpt %}<b>Nombre de visites</b> = {{ user.visitecpt }}<br>{%endif%}
{%if user.job and not fields["job"]["perm"]==0 %}<b>{{fields["position"]["job"]}}</b> = {{ user.job }}<br>{%endif%}
{%if user.position and not fields["position"]["perm"]==0 %}<b>{{fields["position"]["label"]}}</b> = {{ user.position }}<br>{%endif%}
{%if user.postaladress and not fields["postaladress"]["perm"]==0 %}<b>{{fields["postaladress"]["label"]}}</b> = {{ user.postaladress }}<br>{%endif%}
{%if user.visitedate and not fields["visite"]["perm"]==0 %}<b>Date de dernière visite</b> = {{ user.visitedate|date('d/m/Y H:i') }}<br>{%endif%}
{%if user.visitecpt and not fields["visite"]["perm"]==0 %}<b>Nombre de visites</b> = {{ user.visitecpt }}<br>{%endif%}
<br>
{% set fgtitle=false %}
{% for usergroup in user.groups %}