ajout groupes et compteur visite sur export user (ref #233)

This commit is contained in:
afornerot 2021-03-16 11:51:26 +01:00
parent 569f3a5860
commit 8738cdeec5

View File

@ -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,
];