svg
This commit is contained in:
parent
b40412eba6
commit
6a56c60fd1
|
@ -8,12 +8,10 @@ use Symfony\Component\Form\FormError;
|
|||
use App\Form\CreateQuestFlow;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Knp\Bundle\SnappyBundle\Snappy\Response\PdfResponse;
|
||||
use Symfony\Component\Routing\Generator\UrlGenerator;
|
||||
use Dompdf\Dompdf;
|
||||
use Dompdf\Options;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
|
||||
use App\Entity\Quest;
|
||||
use App\Entity\Questoption;
|
||||
|
@ -774,21 +772,10 @@ class QuestController extends AbstractController
|
|||
}
|
||||
}
|
||||
|
||||
if($type!="pdf") {
|
||||
return $this->render('Quest/result.html.twig',[
|
||||
'useheader' => true,
|
||||
'usesidebar' => false,
|
||||
'quest' => $quest,
|
||||
'questguests' => $questguests,
|
||||
'graphs' => $graphs,
|
||||
'access' => $access,
|
||||
]);
|
||||
}
|
||||
else {
|
||||
|
||||
if($type=="pdf") {
|
||||
$rootdir = $this->appKernel->getProjectDir();
|
||||
$filename="Enquete-".str_pad($id,5,"0",STR_PAD_LEFT).".pdf";
|
||||
$fileloc=$rootdir."/uploads/quest/".$filename;
|
||||
$fileloc=$rootdir."/uploads/quest/$id/".$filename;
|
||||
|
||||
$fs = new Filesystem();
|
||||
$fs->remove(array($fileloc));
|
||||
|
@ -808,6 +795,32 @@ class QuestController extends AbstractController
|
|||
$this->knpSnappy->generateFromHtml($render,$fileloc);
|
||||
return $this->file($fileloc);
|
||||
}
|
||||
elseif($type=="csv") {
|
||||
$rootdir = $this->appKernel->getProjectDir()."/uploads/quest/$id";
|
||||
$filename="Enquete-".str_pad($id,5,"0",STR_PAD_LEFT).".csv";
|
||||
$fs = new Filesystem();
|
||||
$fs->mkdir($rootdir);
|
||||
$csvh = fopen($rootdir."/".$filename, 'w');
|
||||
$d = ';'; // this is the default but i like to be explicit
|
||||
$e = '"'; // this is the default but i like to be explicit
|
||||
|
||||
$data=["id","Login","Nom","Prénom","Email","Téléphone"];
|
||||
fputcsv($csvh, $data, $d, $e);
|
||||
fclose($csvh);
|
||||
$response = new BinaryFileResponse($rootdir."/".$filename);
|
||||
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
|
||||
return $response;
|
||||
}
|
||||
else {
|
||||
return $this->render('Quest/result.html.twig',[
|
||||
'useheader' => true,
|
||||
'usesidebar' => false,
|
||||
'quest' => $quest,
|
||||
'questguests' => $questguests,
|
||||
'graphs' => $graphs,
|
||||
'access' => $access,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function resultbyguestkey($key,Request $request)
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
}
|
||||
|
||||
.grid-full { width: 100% }
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.grid-sizer, .grid-item { width: 100%; }
|
||||
.gutter-sizer { width: 0%; }
|
||||
|
@ -136,13 +138,18 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="grid-item notmytitle grid-full mt-5"><h2>Mes Participations</h2></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
$(document).ready(function() {
|
||||
$(".notmy").detach().appendTo('.grid');
|
||||
$(".notmy").hide();
|
||||
$(".notmytitle").hide();
|
||||
$('.grid').masonry({
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: '.grid-sizer',
|
||||
|
@ -173,10 +180,14 @@
|
|||
}
|
||||
|
||||
$('#switchactive').change(function() {
|
||||
if($(this).is(":checked"))
|
||||
if($(this).is(":checked")) {
|
||||
$(".notmy").hide();
|
||||
else
|
||||
$(".notmytitle").hide();
|
||||
}
|
||||
else {
|
||||
$(".notmy").show();
|
||||
$(".notmytitle").show();
|
||||
}
|
||||
|
||||
$('.grid').masonry({
|
||||
itemSelector: '.grid-item',
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
}
|
||||
|
||||
.grid-full { width: 100% }
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.grid-sizer, .grid-item { width: 100%; }
|
||||
.gutter-sizer { width: 0%; }
|
||||
|
@ -152,13 +154,19 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="grid-item notmytitle grid-full mt-5"><h2>Mes Participations</h2></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
$(document).ready(function() {
|
||||
$(".notmy").detach().appendTo('.grid');
|
||||
$(".notmy").hide();
|
||||
$(".notmytitle").hide();
|
||||
|
||||
$('.grid').masonry({
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: '.grid-sizer',
|
||||
|
@ -188,10 +196,14 @@
|
|||
}
|
||||
|
||||
$('#switchactive').change(function() {
|
||||
if($(this).is(":checked"))
|
||||
if($(this).is(":checked")) {
|
||||
$(".notmy").hide();
|
||||
else
|
||||
$(".notmytitle").hide();
|
||||
}
|
||||
else {
|
||||
$(".notmy").show();
|
||||
$(".notmytitle").show();
|
||||
}
|
||||
|
||||
$('.grid').masonry({
|
||||
itemSelector: '.grid-item',
|
||||
|
|
Loading…
Reference in New Issue