Compare commits

...

3 Commits

5 changed files with 113 additions and 9 deletions

View File

@ -139,16 +139,16 @@ class GroupController extends Controller
case 6 : case 6 :
$qb->orderBy('table.owner',$order[0]["dir"]); $qb->orderBy('table.owner',$order[0]["dir"]);
break; break;
case 7 : case 8 :
$qb->orderBy('table.fgcancreatepage',$order[0]["dir"]); $qb->orderBy('table.fgcancreatepage',$order[0]["dir"]);
break; break;
case 8 : case 9 :
$qb->orderBy('table.fgcancreatecalendar',$order[0]["dir"]); $qb->orderBy('table.fgcancreatecalendar',$order[0]["dir"]);
break; break;
case 9 : case 10 :
$qb->orderBy('table.fgcancreateblog',$order[0]["dir"]); $qb->orderBy('table.fgcancreateblog',$order[0]["dir"]);
break; break;
case 10 : case 11 :
$qb->orderBy('table.fgcancreateproject',$order[0]["dir"]); $qb->orderBy('table.fgcancreateproject',$order[0]["dir"]);
break; break;
} }
@ -222,6 +222,12 @@ class GroupController extends Controller
$userinfo.="<br>".$data->getOwner()->getUsername(); $userinfo.="<br>".$data->getOwner()->getUsername();
} }
$visitecpt="";
$visitelast=null;
foreach($data->getUsers() as $usergroup) {
$visitecpt+=$usergroup->getVisitecpt();
$visitelast=($usergroup->getVisitedate()>$visitelast?$usergroup->getVisitedate():$visitelast);
}
array_push($output["data"],array( array_push($output["data"],array(
@ -232,6 +238,7 @@ class GroupController extends Controller
$filtre, $filtre,
($data->getFgcanshare()?"oui":"non"), ($data->getFgcanshare()?"oui":"non"),
$userinfo, $userinfo,
($visitelast?$visitelast->format("d/m/Y H:i")."<br>":"")."nb = ".$visitecpt,
($data->getFgcancreatepage()?"oui":"non"), ($data->getFgcancreatepage()?"oui":"non"),
($data->getFgcancreatecalendar()?"oui":"non"), ($data->getFgcancreatecalendar()?"oui":"non"),
($data->getFgcancreateblog()?"oui":"non"), ($data->getFgcancreateblog()?"oui":"non"),
@ -1015,6 +1022,61 @@ class GroupController extends Controller
]); ]);
} }
public function groupexportAction(Request $request, $access="config")
{
$em = $this->getDoctrine()->getManager();
$dir = $this->get('kernel')->getRootDir() . '/../uploads/export/';
$file = "exportgroup.csv";
$fs = new Filesystem();
$fs->mkdir($dir);
$csvh = fopen($dir.$file, 'w');
$d = ';'; // this is the default but i like to be explicit
$e = '"'; // this is the default but i like to be explicit
// Entête de colonne
$data=["id","Label","Ouvert","Groupe de Travail","Propriétaire","Date Visite","Cpt Visite","Création Page","Création Calendriers","Création Blogs","Création Projets"];
fputcsv($csvh, $data, $d, $e);
// Liste des utilisateurs en fonction du role de l'utilisateur en cours
$groups=$em->getRepository("CadolesCoreBundle:Group")->findAll();
foreach($groups as $group) {
$data = [
"id"=>$group->getId(),
"label"=>$group->getLabel(),
"fgopen"=>($group->getFgopen()?"oui":"non"),
"fgcanshare"=>($group->getFgcanshare()?"oui":"non"),
"owner"=>($group->getOwner()?$group->getOwner()->getUsername():""),
"visitedate"=>"",
"visitecpt"=>"",
"fgcancreatepage"=>($group->getFgcancreatepage()?"oui":"non"),
"fgcancreatecalendar"=>($group->getFgcancreatecalendar()?"oui":"non"),
"fgcancreateblog"=>($group->getFgcancreateblog()?"oui":"non"),
"fgcancreateproject"=>($group->getFgcancreateproject()?"oui":"non"),
];
$visitecpt="";
$visitelast=null;
foreach($group->getUsers() as $usergroup) {
$visitecpt+=$usergroup->getVisitecpt();
$visitelast=($usergroup->getVisitedate()>$visitelast?$usergroup->getVisitedate():$visitelast);
}
$data["visitedate"]=($visitelast?$visitelast->format("d/m/Y H:i"):"");
$data["visitecpt"]=$visitecpt;
fputcsv($csvh, $data, $d, $e);
}
fclose($csvh);
$response = new BinaryFileResponse($dir.$file);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
return $response;
}
public function usergroupexportAction($id,Request $request, $access="config") public function usergroupexportAction($id,Request $request, $access="config")
{ {
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant

View File

@ -918,7 +918,7 @@ class UserController extends Controller
public function exportuserAction(Request $request) { public function exportuserAction(Request $request) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$dir = $this->get('kernel')->getRootDir() . '/../uploads/export/'; $dir = $this->get('kernel')->getRootDir() . '/../uploads/export/';
$file = "export.csv"; $file = "exportuser.csv";
$fs = new Filesystem(); $fs = new Filesystem();
$fs->mkdir($dir); $fs->mkdir($dir);
@ -928,7 +928,7 @@ class UserController extends Controller
$e = '"'; // this is the default but i like to be explicit $e = '"'; // this is the default but i like to be explicit
// Entête de colonne // 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); fputcsv($csvh, $data, $d, $e);
// Liste des utilisateurs en fonction du role de l'utilisateur en cours // Liste des utilisateurs en fonction du role de l'utilisateur en cours
@ -950,6 +950,17 @@ class UserController extends Controller
} }
foreach($users as $user) { 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 = [ $data = [
"id"=>$user->getId(), "id"=>$user->getId(),
"username"=>$user->getUsername(), "username"=>$user->getUsername(),
@ -968,6 +979,9 @@ class UserController extends Controller
"birthdate"=>($user->getBirthdate()?$user->getBirthdate()->format("d/m/Y"):""), "birthdate"=>($user->getBirthdate()?$user->getBirthdate()->format("d/m/Y"):""),
"birthcountry"=>($user->getBirthcountry()?$user->getBirthcountry()->getLabel():""), "birthcountry"=>($user->getBirthcountry()?$user->getBirthcountry()->getLabel():""),
"birthplace"=>($user->getBirthplace()?$user->getBirthplace()->getLabel():""), "birthplace"=>($user->getBirthplace()?$user->getBirthplace()->getLabel():""),
"visite"=>$visite,
"cptvisite"=>$cptvisite,
"groups"=>$groups,
]; ];

View File

@ -494,6 +494,10 @@ cadoles_core_config_group_ajax_switchmanager:
path: /config/group/ajax/switchmanager path: /config/group/ajax/switchmanager
defaults: { _controller: CadolesCoreBundle:Group:switchmanager, access: config } defaults: { _controller: CadolesCoreBundle:Group:switchmanager, access: config }
cadoles_core_config_group_export:
path: /config/group/export
defaults: { _controller: CadolesCoreBundle:Group:groupexport }
cadoles_core_config_group_usergroup_export: cadoles_core_config_group_usergroup_export:
path: /config/group/users/export/{id} path: /config/group/users/export/{id}
defaults: { _controller: CadolesCoreBundle:Group:usergroupexport, access: config } defaults: { _controller: CadolesCoreBundle:Group:usergroupexport, access: config }

View File

@ -49,5 +49,24 @@
$(window).load(function () { $(window).load(function () {
$('#largeimg').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: preview }); $('#largeimg').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: preview });
var selection = new Object();
if($('#largeimg').height()<$('#largeimg').width()) {
selection.width = $('#largeimg').height();
selection.height = $('#largeimg').height();
}
else {
selection.width = $('#largeimg').width();
selection.height = $('#largeimg').width();
}
selection.x1=0;
selection.x2=0;
selection.y1=0;
selection.y2=0;
preview($('#largeimg'),selection);
}); });
{% endblock %} {% endblock %}

View File

@ -9,17 +9,21 @@
{%endif%} {%endif%}
</h1> </h1>
<p>
{% set permgroup = app.session.get('permgroup') %} {% set permgroup = app.session.get('permgroup') %}
{% if is_granted('ROLE_ADMIN') or (is_granted('ROLE_MODO') and (permgroup=="ROLE_MODO" or permgroup=="ROLE_ANIM" or permgroup=="ROLE_USER")) or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_ANIM" or permgroup=="ROLE_USER")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %} {% if is_granted('ROLE_ADMIN') or (is_granted('ROLE_MODO') and (permgroup=="ROLE_MODO" or permgroup=="ROLE_ANIM" or permgroup=="ROLE_USER")) or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_ANIM" or permgroup=="ROLE_USER")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %}
<p><a class="btn btn-success" href={{ path('cadoles_core_'~access~'_group_submit') }}> <a class="btn btn-success" href={{ path('cadoles_core_'~access~'_group_submit') }}>
{% if access=="config" %} {% if access=="config" %}
Ajouter Ajouter
{% else %} {% else %}
Créer un Groupe de Travail Créer un Groupe de Travail
{% endif %} {% endif %}
</a></p> </a>
{% endif %} {% endif %}
{%if access=="config" %}
<a class="btn btn-success" href={{ path('cadoles_core_config_group_export') }}>Exporter CSV</a>
{% endif %}
</p>
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
@ -39,6 +43,7 @@
{% if portal_activate %} {% if portal_activate %}
<th>Groupe de Travail</th> <th>Groupe de Travail</th>
<th class="text-center">Propriétaire</th> <th class="text-center">Propriétaire</th>
<th class="no-sort">Visite</th>
{% if access=="config" %} {% if access=="config" %}
<th>Création Pages</th> <th>Création Pages</th>
<th>Création Calendriers</th> <th>Création Calendriers</th>