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
bb7fa5af
"app/Http/git@sites.upe.br:walter.felipe/submeta.git" did not exist on "67245ec5b261b3d14077285ffc2ddf5889a98152"
Commit
bb7fa5af
authored
Aug 19, 2023
by
alissonalbuquerque
Browse files
Merge branch 'dev-joao-pdf_generator'
parents
8bb811a8
87de8006
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/PadController.php
View file @
bb7fa5af
...
@@ -888,6 +888,7 @@ class PadController extends Controller
...
@@ -888,6 +888,7 @@ class PadController extends Controller
if
(
$professor
->
ch_ensino
||
$professor
->
ch_pesquisa
||
$professor
->
ch_extensao
||
$professor
->
ch_gestao
)
{
if
(
$professor
->
ch_ensino
||
$professor
->
ch_pesquisa
||
$professor
->
ch_extensao
||
$professor
->
ch_gestao
)
{
$professor
->
status
=
"Enviado"
;
$professor
->
status
=
"Enviado"
;
$professor
->
pad_id
=
$userPad
->
{
'id'
};
}
}
}
}
...
@@ -921,8 +922,9 @@ class PadController extends Controller
...
@@ -921,8 +922,9 @@ class PadController extends Controller
})
->
first
();
})
->
first
();
$pads
=
[];
set_time_limit
(
240
);
foreach
(
$professores
as
$professor
){
foreach
(
$professores
as
$professor
){
$professor
->
status
=
"Pendente"
;
$userPad
=
$professor
->
userPads
()
->
where
(
'pad_id'
,
'='
,
$pad
->
id
)
->
first
();
$userPad
=
$professor
->
userPads
()
->
where
(
'pad_id'
,
'='
,
$pad
->
id
)
->
first
();
$avaliacoes
=
$this
->
get_avaliacoes
(
$userPad
,
$avaliador_pad
);
$avaliacoes
=
$this
->
get_avaliacoes
(
$userPad
,
$avaliador_pad
);
...
@@ -933,10 +935,31 @@ class PadController extends Controller
...
@@ -933,10 +935,31 @@ class PadController extends Controller
$professor
->
ch_gestao
=
$this
->
get_carga_horaria
(
$avaliacoes
[
'gestao'
])
?
$this
->
get_carga_horaria
(
$avaliacoes
[
'gestao'
])
:
0
;
$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
)
{
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
);
}
}
...
...
app/Http/Controllers/UserPadController.php
View file @
bb7fa5af
...
@@ -118,12 +118,15 @@ class UserPadController extends Controller
...
@@ -118,12 +118,15 @@ class UserPadController extends Controller
}
}
/**
/**
*
G
enerate PDF, with a given user_pad_id
*
Return g
enerate
d
PDF, with a given user_pad_id
;
*
*
* Additionally, if a filename is given, function will save PDF in storage;
*
* @param integer $user_pad_id
* @param integer $user_pad_id
* @param string $fileName
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
generatePDF
(
$user_pad_id
)
public
function
generatePDF
(
$user_pad_id
,
$fileName
=
""
)
{
{
$niveis
=
Nivel
::
listNivel
();
$niveis
=
Nivel
::
listNivel
();
$funcoes
=
Funcao
::
listFuncaoEnsino
()
+
$funcoes
=
Funcao
::
listFuncaoEnsino
()
+
...
@@ -400,6 +403,14 @@ class UserPadController extends Controller
...
@@ -400,6 +403,14 @@ class UserPadController extends Controller
$pdf_name
=
" Relatório PAD - "
.
$userPad
->
user
->
{
'name'
};
$pdf_name
=
" Relatório PAD - "
.
$userPad
->
user
->
{
'name'
};
$pdf
=
PDF
::
loadView
(
'pad.teacher.report_pdf'
,
$data
);
$pdf
=
PDF
::
loadView
(
'pad.teacher.report_pdf'
,
$data
);
return
$pdf
->
download
(
$pdf_name
.
".pdf"
);
if
(
$fileName
==
""
)
{
return
$pdf
->
download
(
$pdf_name
.
".pdf"
);
}
else
{
$pdf
->
save
(
$fileName
);
}
}
}
}
}
resources/views/components/buttons/btn-download.blade.php
View file @
bb7fa5af
{{
--
{{
--
@
include
(
'components.buttons.btn-download'
,
[
@
include
(
'components.buttons.btn-download'
,
[
'
id'
=>
''
,
'
route'
=>
''
,
'
route'
=>
''
,
'
id'
=>
''
,
'content'
=>
''
'content'
=>
''
])
])
--
}}
--
}}
...
...
resources/views/pad/relatorio/relatorio.blade.php
View file @
bb7fa5af
...
@@ -80,6 +80,7 @@
...
@@ -80,6 +80,7 @@
<
th
scope
=
'col'
>
CH
Extensão
</
th
>
<
th
scope
=
'col'
>
CH
Extensão
</
th
>
<
th
scope
=
'col'
>
CH
Gestão
</
th
>
<
th
scope
=
'col'
>
CH
Gestão
</
th
>
<
th
scope
=
'col'
>
Campus
</
th
>
<
th
scope
=
'col'
>
Campus
</
th
>
<
th
scope
=
'col'
></
th
>
</
tr
>
</
tr
>
</
thead
>
</
thead
>
...
@@ -97,6 +98,13 @@
...
@@ -97,6 +98,13 @@
<
td
>
{{
$professor
->
ch_gestao
}}
</
td
>
<
td
>
{{
$professor
->
ch_gestao
}}
</
td
>
<
td
>
{{
$professor
->
campus
}}
</
td
>
<
td
>
{{
$professor
->
campus
}}
</
td
>
<
td
>
@
include
(
'components.buttons.btn-download'
,
[
'route'
=>
route
(
'user-pad_pdf'
,
[
'user_pad_id'
=>
$professor
->
pad_id
]),
'id'
=>
''
,
'content'
=>
''
])
</
td
>
</
tr
>
</
tr
>
@
php
$index
+=
1
@
endphp
@
php
$index
+=
1
@
endphp
@
endif
@
endif
...
...
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