Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Walter Felipe
pad-upe
Commits
2c21473e
Commit
2c21473e
authored
Aug 18, 2023
by
PedroLopesUPE
Browse files
Versão funcional (lenta) do gerador de PDF
Botão para função ainda escondido. Habilitável quando função estiver otimizada.
parent
120fe191
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/PadController.php
View file @
2c21473e
...
...
@@ -921,8 +921,9 @@ class PadController extends Controller
})
->
first
();
$pads
=
[];
set_time_limit
(
240
);
foreach
(
$professores
as
$professor
){
$professor
->
status
=
"Pendente"
;
$userPad
=
$professor
->
userPads
()
->
where
(
'pad_id'
,
'='
,
$pad
->
id
)
->
first
();
$avaliacoes
=
$this
->
get_avaliacoes
(
$userPad
,
$avaliador_pad
);
...
...
@@ -933,10 +934,31 @@ class PadController extends Controller
$professor
->
ch_gestao
=
$this
->
get_carga_horaria
(
$avaliacoes
[
'gestao'
])
?
$this
->
get_carga_horaria
(
$avaliacoes
[
'gestao'
])
:
0
;
if
(
$professor
->
ch_ensino
||
$professor
->
ch_pesquisa
||
$professor
->
ch_extensao
||
$professor
->
ch_gestao
)
{
$userPadGeneratePDF
->
generatePDF
(
$userPad
->
{
'id'
});
$resource
=
tmpfile
();
$path
=
stream_get_meta_data
(
$resource
)[
'uri'
];
$fileName
=
storage_path
(
$professor
->
{
'name'
}
.
"_.pdf"
);
$userPadGeneratePDF
->
GeneratePDF
(
$userPad
->
{
'id'
},
$fileName
);
$pads
[
$professor
->
{
'name'
}]
=
$fileName
;
}
}
$zipFile
=
storage_path
(
random_int
(
1000
,
9999
)
.
".zip"
);
$zip
=
new
\
ZipArchive
();
$zip
->
open
(
$zipFile
,
\
ZipArchive
::
CREATE
);
foreach
(
$pads
as
$profName
=>
$file
)
{
$zip
->
addFile
(
$file
,
"PAD - Professor "
.
$profName
.
"_.pdf"
);
}
$zip
->
close
();
foreach
(
$pads
as
$profName
=>
$file
)
{
unlink
(
$file
);
}
header
(
'Content-type: application/zip'
);
header
(
'Content-Disposition: attachment; filename= Relatórios PAD -- Avaliador-'
.
$user
->
name
.
'.zip'
);
readfile
(
$zipFile
);
unlink
(
$zipFile
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment