export groupe (ref #234)
This commit is contained in:
parent
8738cdeec5
commit
cf85ca9023
|
@ -139,16 +139,16 @@ class GroupController extends Controller
|
|||
case 6 :
|
||||
$qb->orderBy('table.owner',$order[0]["dir"]);
|
||||
break;
|
||||
case 7 :
|
||||
case 8 :
|
||||
$qb->orderBy('table.fgcancreatepage',$order[0]["dir"]);
|
||||
break;
|
||||
case 8 :
|
||||
case 9 :
|
||||
$qb->orderBy('table.fgcancreatecalendar',$order[0]["dir"]);
|
||||
break;
|
||||
case 9 :
|
||||
case 10 :
|
||||
$qb->orderBy('table.fgcancreateblog',$order[0]["dir"]);
|
||||
break;
|
||||
case 10 :
|
||||
case 11 :
|
||||
$qb->orderBy('table.fgcancreateproject',$order[0]["dir"]);
|
||||
break;
|
||||
}
|
||||
|
@ -222,6 +222,12 @@ class GroupController extends Controller
|
|||
$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(
|
||||
|
@ -232,6 +238,7 @@ class GroupController extends Controller
|
|||
$filtre,
|
||||
($data->getFgcanshare()?"oui":"non"),
|
||||
$userinfo,
|
||||
($visitelast?$visitelast->format("d/m/Y H:i")."<br>":"")."nb = ".$visitecpt,
|
||||
($data->getFgcancreatepage()?"oui":"non"),
|
||||
($data->getFgcancreatecalendar()?"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")
|
||||
{
|
||||
// Récupération de l'enregistrement courant
|
||||
|
|
|
@ -918,7 +918,7 @@ class UserController extends Controller
|
|||
public function exportuserAction(Request $request) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$dir = $this->get('kernel')->getRootDir() . '/../uploads/export/';
|
||||
$file = "export.csv";
|
||||
$file = "exportuser.csv";
|
||||
|
||||
$fs = new Filesystem();
|
||||
$fs->mkdir($dir);
|
||||
|
|
|
@ -494,6 +494,10 @@ cadoles_core_config_group_ajax_switchmanager:
|
|||
path: /config/group/ajax/switchmanager
|
||||
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:
|
||||
path: /config/group/users/export/{id}
|
||||
defaults: { _controller: CadolesCoreBundle:Group:usergroupexport, access: config }
|
||||
|
|
|
@ -9,17 +9,21 @@
|
|||
{%endif%}
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
{% 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") %}
|
||||
<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" %}
|
||||
Ajouter
|
||||
{% else %}
|
||||
Créer un Groupe de Travail
|
||||
{% endif %}
|
||||
</a></p>
|
||||
</a>
|
||||
{% 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-heading">
|
||||
|
@ -39,6 +43,7 @@
|
|||
{% if portal_activate %}
|
||||
<th>Groupe de Travail</th>
|
||||
<th class="text-center">Propriétaire</th>
|
||||
<th class="no-sort">Visite</th>
|
||||
{% if access=="config" %}
|
||||
<th>Création Pages</th>
|
||||
<th>Création Calendriers</th>
|
||||
|
|
Loading…
Reference in New Issue