From 8738cdeec598fe7de8f69b1721580319d9d07d6a Mon Sep 17 00:00:00 2001 From: afornerot Date: Tue, 16 Mar 2021 11:51:26 +0100 Subject: [PATCH] ajout groupes et compteur visite sur export user (ref #233) --- .../CoreBundle/Controller/UserController.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php index 60552723..c153cbc7 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php @@ -928,7 +928,7 @@ class UserController extends Controller $e = '"'; // this is the default but i like to be explicit // Entête de colonne - $data=["id","Login","Nom","Prénom","Email","Téléphone",$this->getParameter("labelniveau01"),$this->getParameter("labelniveau02"),"Métier","Fonction","Nom Usage","Autres Prénom","Sexe","Adresse","Date Naissance","Pays Naissance","Ville Naissance"]; + $data=["id","Login","Nom","Prénom","Email","Téléphone",$this->getParameter("labelniveau01"),$this->getParameter("labelniveau02"),"Métier","Fonction","Nom Usage","Autres Prénom","Sexe","Adresse","Date Naissance","Pays Naissance","Ville Naissance","Date Visite","Cpt Visite","Groupes"]; fputcsv($csvh, $data, $d, $e); // Liste des utilisateurs en fonction du role de l'utilisateur en cours @@ -950,6 +950,17 @@ class UserController extends Controller } foreach($users as $user) { + $groups=""; + $fgfirst=true; + foreach($user->getGroups() as $key => $usergroup) { + if(!$fgfirst) $groups.=" - "; + $groups.=$usergroup->getGroup()->getLabel(); + if($fgfirst) $fgfirst=false; + } + + $visite = ($user->getVisitedate()?$user->getVisitedate()->format("d/m/Y H:i"):""); + $cptvisite = ($user->getVisitedate()?$user->getVisitecpt():""); + $data = [ "id"=>$user->getId(), "username"=>$user->getUsername(), @@ -968,6 +979,9 @@ class UserController extends Controller "birthdate"=>($user->getBirthdate()?$user->getBirthdate()->format("d/m/Y"):""), "birthcountry"=>($user->getBirthcountry()?$user->getBirthcountry()->getLabel():""), "birthplace"=>($user->getBirthplace()?$user->getBirthplace()->getLabel():""), + "visite"=>$visite, + "cptvisite"=>$cptvisite, + "groups"=>$groups, ];