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
submeta
Commits
99a9b2bb
Commit
99a9b2bb
authored
May 25, 2020
by
Gabriel-31415
Browse files
novas atualizações
parent
b09fb79e
Changes
55
Hide whitespace changes
Inline
Side-by-side
app/Avaliador.php
0 → 100644
View file @
99a9b2bb
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
Avaliador
extends
Model
{
public
function
user
(){
return
$this
->
belongsTo
(
'App\User'
);
}
}
app/CoordenadorComissao.php
0 → 100644
View file @
99a9b2bb
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
CoordenadorComissao
extends
Model
{
public
function
user
(){
return
$this
->
belongsTo
(
'App\User'
);
}
public
function
editais
(){
return
$this
->
hasMany
(
'App\Evento'
,
'coordenadorId'
);
}
}
app/Evento.php
View file @
99a9b2bb
...
@@ -34,5 +34,9 @@ class Evento extends Model
...
@@ -34,5 +34,9 @@ class Evento extends Model
return
$this
->
belongsTo
(
'App\User'
,
'coordenadorId'
);
return
$this
->
belongsTo
(
'App\User'
,
'coordenadorId'
);
}
}
public
function
coordenadorComissao
(){
return
$this
->
belongsTo
(
'App\CoordenadorComissao'
,
'coordenadorId'
);
}
}
}
app/Http/Controllers/AdministradorController.php
View file @
99a9b2bb
...
@@ -8,6 +8,14 @@ class AdministradorController extends Controller
...
@@ -8,6 +8,14 @@ class AdministradorController extends Controller
{
{
public
function
index
(){
public
function
index
(){
return
view
(
'admin.index'
);
return
view
(
'administrador.index'
);
}
public
function
naturezas
(){
return
view
(
'naturezas.index'
);
}
public
function
usuarios
(){
return
view
(
'administrador.usuarios'
);
}
}
}
}
app/Http/Controllers/Auth/RegisterController.php
View file @
99a9b2bb
...
@@ -9,7 +9,9 @@ use Illuminate\Support\Facades\Hash;
...
@@ -9,7 +9,9 @@ use Illuminate\Support\Facades\Hash;
use
Illuminate\Support\Facades\Validator
;
use
Illuminate\Support\Facades\Validator
;
use
App\User
;
use
App\User
;
use
App\Participante
;
use
App\Endereco
;
use
App\Endereco
;
class
RegisterController
extends
Controller
class
RegisterController
extends
Controller
{
{
/*
/*
...
@@ -98,10 +100,14 @@ class RegisterController extends Controller
...
@@ -98,10 +100,14 @@ class RegisterController extends Controller
$user
->
cpf
=
$data
[
'cpf'
];
$user
->
cpf
=
$data
[
'cpf'
];
$user
->
celular
=
$data
[
'celular'
];
$user
->
celular
=
$data
[
'celular'
];
$user
->
instituicao
=
$data
[
'instituicao'
];
$user
->
instituicao
=
$data
[
'instituicao'
];
$user
->
tipo
=
'participante'
;
$user
->
enderecoId
=
$end
->
id
;
$user
->
enderecoId
=
$end
->
id
;
$user
->
save
();
$user
->
save
();
$participante
=
new
Participante
();
$user
->
participantes
()
->
save
(
$participante
);
return
$user
;
return
$user
;
}
}
}
}
app/Http/Controllers/CoordenadorComissaoController.php
0 → 100644
View file @
99a9b2bb
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
App\Evento
;
use
App\CoordenadorComissao
;
use
App\Avaliador
;
use
App\Proponente
;
use
App\Participante
;
use
Illuminate\Support\Facades\Log
;
class
CoordenadorComissaoController
extends
Controller
{
public
function
index
(){
return
view
(
'coordenadorComissao.index'
);
}
public
function
usuarios
(){
return
view
(
'coordenadorComissao.usuarios'
);
}
public
function
editais
(){
$eventos
=
Evento
::
where
(
'coordenadorId'
,
Auth
()
->
user
()
->
id
)
->
get
();
return
view
(
'coordenadorComissao.editais'
,
[
'eventos'
=>
$eventos
]);
}
public
function
coordenadorComite
(){
$usuarios
=
CoordenadorComissao
::
all
();
return
view
(
'coordenadorComissao.listarUsuarios'
,
[
'usuarios'
=>
$usuarios
]);
}
public
function
avaliador
(){
$usuarios
=
Avaliador
::
all
();
return
view
(
'coordenadorComissao.listarUsuarios'
,
[
'usuarios'
=>
$usuarios
]);
}
public
function
proponente
(){
$usuarios
=
Proponente
::
all
();
return
view
(
'coordenadorComissao.listarUsuarios'
,
[
'usuarios'
=>
$usuarios
]);
}
public
function
participante
(){
$usuarios
=
Participante
::
all
();
return
view
(
'coordenadorComissao.listarUsuarios'
,
[
'usuarios'
=>
$usuarios
]);
}
}
app/Http/Controllers/EventoController.php
View file @
99a9b2bb
...
@@ -13,6 +13,7 @@ use App\ComissaoEvento;
...
@@ -13,6 +13,7 @@ use App\ComissaoEvento;
use
App\User
;
use
App\User
;
use
App\Trabalho
;
use
App\Trabalho
;
use
App\AreaModalidade
;
use
App\AreaModalidade
;
use
App\CoordenadorComissao
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Carbon\Carbon
;
use
Carbon\Carbon
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Support\Facades\Storage
;
...
@@ -54,8 +55,8 @@ class EventoController extends Controller
...
@@ -54,8 +55,8 @@ class EventoController extends Controller
*/
*/
public
function
create
()
public
function
create
()
{
{
//
$coordenadors
=
CoordenadorComissao
::
with
(
'user'
)
->
get
();
return
view
(
'evento.criarEvento'
);
return
view
(
'evento.criarEvento'
,
[
'coordenadors'
=>
$coordenadors
]
);
}
}
/**
/**
...
@@ -120,9 +121,12 @@ class EventoController extends Controller
...
@@ -120,9 +121,12 @@ class EventoController extends Controller
'inicioRevisao'
=>
$request
->
inicioRevisao
,
'inicioRevisao'
=>
$request
->
inicioRevisao
,
'fimRevisao'
=>
$request
->
fimRevisao
,
'fimRevisao'
=>
$request
->
fimRevisao
,
'resultado'
=>
$request
->
resultado
,
'resultado'
=>
$request
->
resultado
,
'coordenadorId'
=>
Auth
::
user
()
->
id
,
'coordenadorId'
=>
$request
->
coordenador_
id
,
]);
]);
// $user = User::find($request->coordenador_id);
// $user->coordenadorComissao()->editais()->save($evento);
// se vou me tornar coordenador do Evento
// se vou me tornar coordenador do Evento
// if($request->isCoordenador == true){
// if($request->isCoordenador == true){
...
@@ -130,7 +134,7 @@ class EventoController extends Controller
...
@@ -130,7 +134,7 @@ class EventoController extends Controller
// $evento->save();
// $evento->save();
// }
// }
$evento
->
coordenadorId
=
Auth
::
user
()
->
id
;
//
$evento->coordenadorId = Auth::user()->id;
$pdfEdital
=
$request
->
pdfEdital
;
$pdfEdital
=
$request
->
pdfEdital
;
$path
=
'pdfEdital/'
.
$evento
->
id
.
'/'
;
$path
=
'pdfEdital/'
.
$evento
->
id
.
'/'
;
...
@@ -149,10 +153,10 @@ class EventoController extends Controller
...
@@ -149,10 +153,10 @@ class EventoController extends Controller
$evento
->
save
();
$evento
->
save
();
$user
=
Auth
::
user
();
//
$user = Auth::user();
$subject
=
"Evento Criado"
;
//
$subject = "Evento Criado";
Mail
::
to
(
$user
->
email
)
//
Mail::to($user->email)
->
send
(
new
EventoCriado
(
$user
,
$subject
));
//
->send(new EventoCriado($user, $subject));
return
redirect
()
->
route
(
'coord.home'
);
return
redirect
()
->
route
(
'coord.home'
);
}
}
...
@@ -169,29 +173,29 @@ class EventoController extends Controller
...
@@ -169,29 +173,29 @@ class EventoController extends Controller
$hasTrabalho
=
false
;
$hasTrabalho
=
false
;
$hasTrabalhoCoautor
=
false
;
$hasTrabalhoCoautor
=
false
;
$hasFile
=
false
;
$hasFile
=
false
;
$trabalhos
=
Trabalho
::
where
(
'
autorI
d'
,
Auth
::
user
()
->
id
)
->
get
();
$trabalhos
=
Trabalho
::
where
(
'
proponente_i
d'
,
Auth
::
user
()
->
id
)
->
get
();
$trabalhosCount
=
Trabalho
::
where
(
'
autorI
d'
,
Auth
::
user
()
->
id
)
->
count
();
$trabalhosCount
=
Trabalho
::
where
(
'
proponente_i
d'
,
Auth
::
user
()
->
id
)
->
count
();
$trabalhosId
=
Trabalho
::
where
(
'evento
I
d'
,
$evento
->
id
)
->
select
(
'id'
)
->
get
();
$trabalhosId
=
Trabalho
::
where
(
'evento
_i
d'
,
$evento
->
id
)
->
select
(
'id'
)
->
get
();
$trabalhosIdCoautor
=
Coautor
::
whereIn
(
'trabalhoId'
,
$trabalhosId
)
->
where
(
'
autorI
d'
,
Auth
::
user
()
->
id
)
->
select
(
'trabalhoId'
)
->
get
();
//
$trabalhosIdCoautor =
Proponente
::whereIn('trabalhoId', $trabalhosId)->where('
proponente_i
d', Auth::user()->id)->select('trabalhoId')->get();
$coautorCount
=
Coautor
::
whereIn
(
'trabalhoId'
,
$trabalhosId
)
->
where
(
'
autorI
d'
,
Auth
::
user
()
->
id
)
->
count
();
//
$coautorCount = Coautor::whereIn('trabalhoId', $trabalhosId)->where('
proponente_i
d', Auth::user()->id)->count();
$trabalhosCoautor
=
Trabalho
::
whereIn
(
'id'
,
$trabalhosIdCoautor
)
->
get
();
//
$trabalhosCoautor = Trabalho::whereIn('id', $trabalhosIdCoautor)->get();
if
(
$trabalhosCount
!=
0
){
if
(
$trabalhosCount
!=
0
){
$hasTrabalho
=
true
;
$hasTrabalho
=
true
;
$hasFile
=
true
;
$hasFile
=
true
;
}
}
if
(
$coautorCount
!=
0
){
//
if($coautorCount != 0){
$hasTrabalhoCoautor
=
true
;
//
$hasTrabalhoCoautor = true;
$hasFile
=
true
;
//
$hasFile = true;
}
//
}
$mytime
=
Carbon
::
now
(
'America/Recife'
);
$mytime
=
Carbon
::
now
(
'America/Recife'
);
// dd(false);
// dd(false);
return
view
(
'evento.visualizarEvento'
,
[
return
view
(
'evento.visualizarEvento'
,
[
'evento'
=>
$evento
,
'evento'
=>
$evento
,
'trabalhos'
=>
$trabalhos
,
'trabalhos'
=>
$trabalhos
,
'trabalhosCoautor'
=>
$trabalhosCoautor
,
//
'trabalhosCoautor' => $trabalhosCoautor,
'hasTrabalho'
=>
$hasTrabalho
,
'hasTrabalho'
=>
$hasTrabalho
,
'hasTrabalhoCoautor'
=>
$hasTrabalhoCoautor
,
//
'hasTrabalhoCoautor' => $hasTrabalhoCoautor,
'hasFile'
=>
$hasFile
,
'hasFile'
=>
$hasFile
,
'mytime'
=>
$mytime
'mytime'
=>
$mytime
]);
]);
...
...
app/Http/Controllers/HomeController.php
View file @
99a9b2bb
...
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
...
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Auth
;
use
Auth
;
use
Illuminate\Support\Facades\Log
;
class
HomeController
extends
Controller
class
HomeController
extends
Controller
{
{
...
@@ -14,7 +15,7 @@ class HomeController extends Controller
...
@@ -14,7 +15,7 @@ class HomeController extends Controller
*/
*/
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
middleware
([
'auth'
,
'verified'
]);
$this
->
middleware
([
'auth'
]);
}
}
/**
/**
...
@@ -23,7 +24,8 @@ class HomeController extends Controller
...
@@ -23,7 +24,8 @@ class HomeController extends Controller
* @return \Illuminate\Contracts\Support\Renderable
* @return \Illuminate\Contracts\Support\Renderable
*/
*/
public
function
index
()
public
function
index
()
{
{
$eventos
=
\
App\Evento
::
all
();
if
(
Auth
::
check
()){
if
(
Auth
::
check
()){
if
(
Auth
::
user
()
->
tipo
==
'administrador'
){
if
(
Auth
::
user
()
->
tipo
==
'administrador'
){
return
view
(
'administrador.index'
);
return
view
(
'administrador.index'
);
...
@@ -31,6 +33,9 @@ class HomeController extends Controller
...
@@ -31,6 +33,9 @@ class HomeController extends Controller
else
if
(
Auth
::
user
()
->
tipo
==
'administradorResponsavel'
)
{
else
if
(
Auth
::
user
()
->
tipo
==
'administradorResponsavel'
)
{
return
view
(
'administradorResponsavel.index'
);
return
view
(
'administradorResponsavel.index'
);
}
}
else
if
(
Auth
::
user
()
->
tipo
==
'coordenador'
)
{
return
view
(
'coordenadorComissao.index'
);
}
else
if
(
Auth
::
user
()
->
tipo
==
'proponente'
)
{
else
if
(
Auth
::
user
()
->
tipo
==
'proponente'
)
{
return
view
(
'proponente.index'
);
return
view
(
'proponente.index'
);
}
}
...
@@ -38,8 +43,8 @@ class HomeController extends Controller
...
@@ -38,8 +43,8 @@ class HomeController extends Controller
return
view
(
'participante.index'
);
return
view
(
'participante.index'
);
}
}
}
}
//
Log
::
debug
(
'HomeController'
);
return
view
(
'
home'
);
return
view
(
'
index'
,
[
'eventos'
=>
$eventos
]
);
}
}
public
function
downloadArquivo
(
Request
$request
){
public
function
downloadArquivo
(
Request
$request
){
...
...
app/Http/Controllers/TrabalhoController.php
View file @
99a9b2bb
...
@@ -15,6 +15,7 @@ use App\Arquivo;
...
@@ -15,6 +15,7 @@ use App\Arquivo;
use
App\GrandeArea
;
use
App\GrandeArea
;
use
App\SubArea
;
use
App\SubArea
;
use
App\FuncaoParticipantes
;
use
App\FuncaoParticipantes
;
use
App\Participante
;
use
Carbon\Carbon
;
use
Carbon\Carbon
;
use
Auth
;
use
Auth
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
...
@@ -66,105 +67,188 @@ class TrabalhoController extends Controller
...
@@ -66,105 +67,188 @@ class TrabalhoController extends Controller
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
store
(
Request
$request
){
public
function
store
(
Request
$request
){
dd
(
$request
->
all
());
//
dd($request->all());
$mytime
=
Carbon
::
now
(
'America/Recife'
);
$mytime
=
Carbon
::
now
(
'America/Recife'
);
$mytime
=
$mytime
->
toDateString
();
$mytime
=
$mytime
->
toDateString
();
$evento
=
Evento
::
find
(
$request
->
eventoId
);
$evento
=
Evento
::
find
(
$request
->
editalId
);
if
(
$evento
->
inicioSubmissao
>
$mytime
){
if
(
$evento
->
inicioSubmissao
>
$mytime
){
if
(
$mytime
>=
$evento
->
fimSubmissao
){
if
(
$mytime
>=
$evento
->
fimSubmissao
){
return
redirect
()
->
route
(
'home'
);
return
redirect
()
->
route
(
'home'
);
}
}
}
}
$validatedData
=
$request
->
validate
([
'nomeTrabalho'
=>
[
'required'
,
'string'
,],
//O anexo de Decisão do CONSU dependo do tipo de edital
'areaId'
=>
[
'required'
,
'integer'
],
if
(
$evento
->
tipo
==
'PIBIC'
||
$evento
->
tipo
==
'PIBIC-EM'
){
'modalidadeId'
=>
[
'required'
,
'integer'
],
'eventoId'
=>
[
'required'
,
'integer'
],
'resumo'
=>
[
'nullable'
,
'string'
],
'nomeCoautor.*'
=>
[
'string'
],
'emailCoautor.*'
=>
[
'string'
],
'arquivo'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
]);
$validatedData
=
$request
->
validate
([
'editalId'
=>
[
'required'
,
'integer'
],
'nomeProjeto'
=>
[
'required'
,
'string'
,],
'grandeAreaId'
=>
[
'required'
,
'integer'
],
'areaId'
=>
[
'required'
,
'integer'
],
'subAreaId'
=>
[
'required'
,
'integer'
],
'pontuacaoPlanilha'
=>
[
'required'
,
'integer'
],
'linkGrupo'
=>
[
'required'
,
'string'
],
'linkLattesEstudante'
=>
[
'required'
,
'string'
],
'nomeCoordenador'
=>
[
'required'
,
'string'
],
'nomeParticipante.*'
=>
[
'required'
,
'string'
],
'emailParticipante.*'
=>
[
'string'
],
'nomePlanoTrabalho.*'
=>
[
'string'
],
'anexoProjeto'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
'anexoCONSU'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
'anexoLatterCoordenador'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
'anexoPlanilha'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
'anexoPlanoTrabalho.*'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
]);
$autor
=
Auth
::
user
();
$trabalho
=
Trabalho
::
create
([
$trabalhosDoAutor
=
Trabalho
::
where
(
'eventoId'
,
$request
->
eventoId
)
->
where
(
'autorId'
,
Auth
::
user
()
->
id
)
->
count
();
'titulo'
=>
$request
->
nomeProjeto
,
$areaModalidade
=
AreaModalidade
::
where
(
'areaId'
,
$request
->
areaId
)
->
where
(
'modalidadeId'
,
$request
->
modalidadeId
)
->
first
();
'grande_area_id'
=>
$request
->
grandeAreaId
,
Log
::
debug
(
'Numero de trabalhos'
.
$evento
);
'area_id'
=>
$request
->
areaId
,
if
(
$trabalhosDoAutor
>=
$evento
->
numMaxTrabalhos
){
'sub_area_id'
=>
$request
->
subAreaId
,
return
redirect
()
->
back
()
->
withErrors
([
'numeroMax'
=>
'Número máximo de trabalhos permitidos atingido.'
]);
'coordenador'
=>
$request
->
nomeCoordenador
,
}
'pontuacaoPlanilha'
=>
$request
->
pontuacaoPlanilha
,
'linkGrupoPesquisa'
=>
$request
->
linkGrupo
,
'linkLattesEstudante'
=>
$request
->
linkLattesEstudante
,
'data'
=>
$mytime
,
'evento_id'
=>
$request
->
editalId
,
'avaliado'
=>
0
,
//Anexos
'anexoDecisaoCONSU'
=>
$request
->
anexoCONSU
,
'anexoProjeto'
=>
$request
->
anexoProjeto
,
'anexoAutorizacaoComiteEtica'
=>
$request
->
anexoComiteEtica
,
'anexoLattesCoordenador'
=>
$request
->
anexoLatterCoordenador
,
'anexoPlanilhaPontuacao'
=>
$request
->
anexoPlanilha
,
]);
}
else
{
//Caso em que o anexo da Decisão do CONSU não necessário
$validatedData
=
$request
->
validate
([
'editalId'
=>
[
'required'
,
'integer'
],
'nomeProjeto'
=>
[
'required'
,
'string'
,],
'grandeAreaId'
=>
[
'required'
,
'integer'
],
'areaId'
=>
[
'required'
,
'integer'
],
'subAreaId'
=>
[
'required'
,
'integer'
],
'pontuacaoPlanilha'
=>
[
'required'
,
'integer'
],
'linkGrupo'
=>
[
'required'
,
'string'
],
'linkLattesEstudante'
=>
[
'required'
,
'string'
],
'nomeCoordenador'
=>
[
'required'
,
'string'
],
'nomeParticipante.*'
=>
[
'required'
,
'string'
],
'emailParticipante.*'
=>
[
'string'
],
'nomePlanoTrabalho.*'
=>
[
'string'
],
'anexoProjeto'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
'anexoLatterCoordenador'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
'anexoPlanilha'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
'anexoPlanoTrabalho.*'
=>
[
'required'
,
'file'
,
'mimes:pdf'
,
'max:2000000'
],
]);
$trabalho
=
Trabalho
::
create
([
'titulo'
=>
$request
->
nomeProjeto
,
'grande_area_id'
=>
$request
->
grandeAreaId
,
'area_id'
=>
$request
->
areaId
,
'sub_area_id'
=>
$request
->
subAreaId
,
'coordenador'
=>
$request
->
nomeCoordenador
,
'pontuacaoPlanilha'
=>
$request
->
pontuacaoPlanilha
,
'linkGrupoPesquisa'
=>
$request
->
linkGrupo
,
'linkLattesEstudante'
=>
$request
->
linkLattesEstudante
,
'data'
=>
$mytime
,
'evento_id'
=>
$request
->
editalId
,
'avaliado'
=>
0
,
//Anexos
'anexoProjeto'
=>
$request
->
anexoProjeto
,
'anexoAutorizacaoComiteEtica'
=>
$request
->
anexoComiteEtica
,
'anexoLattesCoordenador'
=>
$request
->
anexoLatterCoordenador
,
'anexoPlanilhaPontuacao'
=>
$request
->
anexoPlanilha
,
]);
if
(
$request
->
emailCoautor
!=
null
){
$i
=
0
;
foreach
(
$request
->
emailCoautor
as
$key
)
{
$i
++
;
}
if
(
$i
>
$evento
->
numMaxCoautores
){
return
redirect
()
->
back
()
->
withErrors
([
'numeroMax'
=>
'Número de coautores deve ser menor igual a '
.
$evento
->
numMaxCoautores
]);
}
}
}
if
(
$request
->
emailCoautor
!=
null
){
//Relaciona o projeto criado com o proponente que criou o projeto
$i
=
0
;
$trabalho
->
proponente
()
->
save
(
Auth
()
->
user
());
foreach
(
$request
->
emailCoautor
as
$key
)
{
$userCoautor
=
User
::
where
(
'email'
,
$key
)
->
first
();
//Envia email com senha temp para cada participante do projeto
if
(
$userCoautor
==
null
){
if
(
$request
->
emailParticipante
!=
null
){
foreach
(
$request
->
emailParticipante
as
$key
=>
$value
)
{
$userParticipante
=
User
::
where
(
'email'
,
$value
)
->
first
();
if
(
$userParticipante
==
null
){
$passwordTemporario
=
Str
::
random
(
8
);
$passwordTemporario
=
Str
::
random
(
8
);
Mail
::
to
(
$
key
)
->
send
(
new
EmailParaUsuarioNaoCadastrado
(
Auth
()
->
user
()
->
name
,
' '
,
'
Coautor
'
,
$evento
->
nome
,
$passwordTemporario
));
Mail
::
to
(
$
value
)
->
send
(
new
EmailParaUsuarioNaoCadastrado
(
Auth
()
->
user
()
->
name
,
' '
,
'
Participante
'
,
$evento
->
nome
,
$passwordTemporario
));
$usuario
=
User
::
create
([
$usuario
=
User
::
create
([
'email'
=>
$
key
,
'email'
=>
$
value
,
'password'
=>
bcrypt
(
$passwordTemporario
),
'password'
=>
bcrypt
(
$passwordTemporario
),
'usuarioTemp'
=>
true
,
'usuarioTemp'
=>
true
,
'name'
=>
$request
->
nomeCoautor
[
$i
],
'name'
=>
$request
->
nomeParticipante
[
$key
],
'funcao_participante_id'
=>
$request
->
funcaoParticipante
[
$key
],
]);
$participante
=
$usuario
->
participantes
()
->
create
([
'trabalho_id'
=>
$trabalho
->
id
,
]);
]);
$participante
->
trabalhos
()
->
save
(
$trabalho
);
}
else
{
$subject
=
"Participante de Projeto"
;
$email
=
$value
;
Mail
::
to
(
$email
)
->
send
(
new
SubmissaoTrabalho
(
$userParticipante
,
$subject
));
}
}
$i
++
;
}
}
}
}
$anexos
=
array
(
$request
->
anexoCONSU
,
$request
->
anexoProjeto
,
$request
->
anexoComiteEtica
,
$request
->
anexoLatterCoordenador
,
$request
->
anexoPlanilha
,
);
$trabalho
=
Trabalho
::
create
([
foreach
(
$anexos
as
$key
=>
$value
)
{
'titulo'
=>
$request
->
nomeTrabalho
,
'modalidadeId'
=>
$areaModalidade
->
modalidade
->
id
,
'areaId'
=>
$areaModalidade
->
area
->
id
,
'autorId'
=>
$autor
->
id
,
'eventoId'
=>
$evento
->
id
,
'avaliado'
=>
'nao'
]);
if
(
$request
->
emailCoautor
!=
null
){
$file
=
$value
;
foreach
(
$request
->
emailCoautor
as
$key
)
{
$path
=
'trabalhos/'
.
$request
->
editalId
.
'/'
.
$trabalho
->
id
.
'/'
;
$userCoautor
=
User
::
where
(
'email'
,
$key
)
->
first
();
$nome
=
"1.pdf"
;
Coautor
::
create
([
Storage
::
putFileAs
(
$path
,
$file
,
$nome
);
'ordem'
=>
'-'
,
'autorId'
=>
$userCoautor
->
id
,
$arquivo
=
Arquivo
::
create
([
'nome'
=>
$path
.
$nome
,
'trabalhoId'
=>
$trabalho
->
id
,
'data'
=>
$mytime
,
'versaoFinal'
=>
true
,
]);
}
if
(
$request
->
anexoPlanoTrabalho
!=
null
){
foreach
(
$request
->
anexoPlanoTrabalho
as
$key
=>
$value
)
{
$file
=
$value
;
$path
=
'trabalhos/'
.
$request
->
editalId
.
'/'
.
$trabalho
->
id
.
'/'
;
$nome
=
$request
->
nomePlanoTrabalho
[
$key
]
.
".pdf"
;
Storage
::
putFileAs
(
$path
,
$file
,
$nome
);
$arquivo
=
Arquivo
::
create
([
'nome'
=>
$path
.
$nome
,
'trabalhoId'
=>
$trabalho
->
id
,
'trabalhoId'
=>
$trabalho
->
id
,
'data'
=>
$mytime
,
'versaoFinal'
=>
true
,
]);
]);
}
}
}
}
$file
=
$request
->
arquivo
;
//dd($trabalho);
$path
=
'trabalhos/'
.
$request
->
eventoId
.
'/'
.
$trabalho
->
id
.
'/'
;
$nome
=
"1.pdf"
;
Storage
::
putFileAs
(
$path
,
$file
,
$nome
);
$arquivo
=
Arquivo
::
create
([
'nome'
=>
$path
.
$nome
,
'trabalhoId'
=>
$trabalho
->
id
,
'versaoFinal'
=>
true
,
]);
$subject
=
"Submissão de Trabalho"
;
$subject
=
"Submissão de Trabalho"
;
$autor
=
Auth
()
->
user
();
Mail
::
to
(
$autor
->
email
)
Mail
::
to
(
$autor
->
email
)
->
send
(
new
SubmissaoTrabalho
(
$autor
,
$subject
));
->
send
(
new
SubmissaoTrabalho
(
$autor
,
$subject
));
if
(
$request
->
emailCoautor
!=
null
){
foreach
(
$request
->
emailCoautor
as
$key
)
{
return
redirect
()
->
route
(
'evento.visualizar'
,[
'id'
=>
$request
->
editalId
]);
$userCoautor
=
User
::
where
(
'email'
,
$key
)
->
first
();
Mail
::
to
(
$userCoautor
->
email
)
->
send
(
new
SubmissaoTrabalho
(
$userCoautor
,
$subject
));
}
}
return
redirect
()
->
route
(
'evento.visualizar'
,[
'id'
=>
$request
->
eventoId
]);
}
}
/**
/**
...
...
app/Http/Controllers/UserController.php
View file @
99a9b2bb
...
@@ -9,14 +9,22 @@ use App\User;
...
@@ -9,14 +9,22 @@ use App\User;
use
App\Endereco
;
use
App\Endereco
;
use
App\Trabalho
;
use
App\Trabalho
;
use
App\Coautor
;
use
App\Coautor
;
use
App\Evento
;
use
Illuminate\Support\Facades\Log
;
class
UserController
extends
Controller
class
UserController
extends
Controller
{
{
//
public
function
index
(){
public
function
index
()
if
(
Auth
::
user
()){
{
return
redirect
()
->
route
(
'home'
);
$eventos
=
Evento
::
all
();
}
if
(
Auth
::
check
()){
Log
::
debug
(
'UserController check'
);
return
redirect
()
->
route
(
'home'
);
}
Log
::
debug
(
'UserController index'
);
return
view
(
'index'
,
[
'eventos'
=>
$eventos
]);
//return view('auth.login');
}
}
...
...
app/Http/Kernel.php
View file @
99a9b2bb
...
@@ -19,6 +19,7 @@ class Kernel extends HttpKernel
...
@@ -19,6 +19,7 @@ class Kernel extends HttpKernel
\
Illuminate\Foundation\Http\Middleware\ValidatePostSize
::
class
,
\
Illuminate\Foundation\Http\Middleware\ValidatePostSize
::
class
,
\
App\Http\Middleware\TrimStrings
::
class
,
\
App\Http\Middleware\TrimStrings
::
class
,
\
Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull
::
class
,
\
Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull
::
class
,
//\App\Http\Middleware\checkAdministrador::class
];
];
/**
/**
...
@@ -62,6 +63,7 @@ class Kernel extends HttpKernel
...
@@ -62,6 +63,7 @@ class Kernel extends HttpKernel
'throttle'
=>
\
Illuminate\Routing\Middleware\ThrottleRequests
::
class
,
'throttle'
=>
\
Illuminate\Routing\Middleware\ThrottleRequests
::
class
,
'verified'
=>
\
Illuminate\Auth\Middleware\EnsureEmailIsVerified
::
class
,
'verified'
=>
\
Illuminate\Auth\Middleware\EnsureEmailIsVerified
::
class
,
'isTemp'
=>
\
App\Http\Middleware\IsTemp
::
class
,
'isTemp'
=>
\
App\Http\Middleware\IsTemp
::
class
,
'checkAdministrador'
=>
\
App\Http\Middleware\checkAdministrador
::
class
,
];
];
/**
/**
...
...
app/Http/Middleware/checkAdministrador.php
View file @
99a9b2bb
<?php
<?php
namespace
App\Http\Middleware
;
namespace
App\Http\Middleware
;
use
Auth
;
use
Closure
;
use
Closure
;
use
Illuminate\Support\Facades\Log
;
class
checkAdministrador
class
checkAdministrador
{
{
...
@@ -16,7 +17,8 @@ class checkAdministrador
...
@@ -16,7 +17,8 @@ class checkAdministrador
public
function
handle
(
$request
,
Closure
$next
)
public
function
handle
(
$request
,
Closure
$next
)
{
{
if
(
!
Auth
::
check
()){
if
(
!
Auth
::
check
()){
return
redirect
(
'/'
)
->
with
(
'error'
,
'É necessário estar logado para utilizar esta funcionalidade'
);
Log
::
debug
(
'checkAdministrador'
);
return
redirect
(
'/'
);
}
}
if
(
Auth
::
user
()
->
tipo
==
'administrador'
){
if
(
Auth
::
user
()
->
tipo
==
'administrador'
){
return
$next
(
$request
);
return
$next
(
$request
);
...
...
app/Participante.php
0 → 100644
View file @
99a9b2bb
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
Participante
extends
Model
{
protected
$fillable
=
[
'name'
,
'user_id'
,
'trabalho_id'
];
public
function
user
(){
return
$this
->
belongsTo
(
'App\User'
);
}
public
function
trabalhos
(){
return
$this
->
belongsToMany
(
'App\Trabalho'
,
'trabalho_participante'
);
}
}
app/Proponente.php
View file @
99a9b2bb
...
@@ -9,4 +9,7 @@ class Proponente extends Model
...
@@ -9,4 +9,7 @@ class Proponente extends Model
public
function
user
(){
public
function
user
(){
return
$this
->
belongsTo
(
'App\User'
);
return
$this
->
belongsTo
(
'App\User'
);
}
}
public
function
trabalhos
(){
return
$this
->
belongsToMany
(
'App\Trabalho'
,
'trabalho_proponente'
);
}
}
}
app/Trabalho.php
View file @
99a9b2bb
...
@@ -12,7 +12,25 @@ class Trabalho extends Model
...
@@ -12,7 +12,25 @@ class Trabalho extends Model
* @var array
* @var array
*/
*/
protected
$fillable
=
[
protected
$fillable
=
[
'titulo'
,
'autores'
,
'data'
,
'modalidadeId'
,
'areaId'
,
'autorId'
,
'eventoId'
,
'resumo'
,
'avaliado'
'titulo'
,
'data'
,
'avaliado'
,
'decisaoCONSU'
,
'pontuacaoPlanilha'
,
'linkGrupoPesquisa'
,
'linkLattesEstudante'
,
'anexoDecisaoCONSU'
,
'anexoAutorizacaoComiteEtica'
,
'anexoLattesCoordenador'
,
'anexoPlanilhaPontuacao'
,
'anexoProjeto'
,
'grande_area_id'
,
'area_id'
,
'sub_area_id'
,
'evento_id'
,
'proponente_id'
,
];
];
public
function
recurso
(){
public
function
recurso
(){
...
@@ -53,4 +71,10 @@ class Trabalho extends Model
...
@@ -53,4 +71,10 @@ class Trabalho extends Model
public
function
planoTrabalho
(){
public
function
planoTrabalho
(){
return
$this
->
hasMany
(
'App\PlanoTrabalho'
);
return
$this
->
hasMany
(
'App\PlanoTrabalho'
);
}
}
public
function
participantes
(){
return
$this
->
belongsToMany
(
'App\Participante'
,
'trabalho_participante'
);
}
public
function
proponentes
(){
return
$this
->
belongsToMany
(
'App\Proponente'
,
'trabalho_proponente'
);
}
}
}
app/User.php
View file @
99a9b2bb
...
@@ -85,6 +85,15 @@ class User extends Authenticatable implements MustVerifyEmail
...
@@ -85,6 +85,15 @@ class User extends Authenticatable implements MustVerifyEmail
public
function
AdministradorResponsavel
(){
public
function
AdministradorResponsavel
(){
return
$this
->
hasMany
(
'App\AdministradorResponsavel'
);
return
$this
->
hasMany
(
'App\AdministradorResponsavel'
);
}
}
public
function
participantes
(){
return
$this
->
hasMany
(
'App\Participante'
);
}
public
function
avaliadors
(){
return
$this
->
hasMany
(
'App\Avaliador'
);
}
public
function
coordenadorComissao
(){
return
$this
->
hasMany
(
'App\CoordenadorComissao'
);
}
public
function
sendPasswordResetNotification
(
$token
){
public
function
sendPasswordResetNotification
(
$token
){
$this
->
notify
(
new
recuperacaoSenha
(
$token
));
$this
->
notify
(
new
recuperacaoSenha
(
$token
));
...
...
database/migrations/2014_10_12_000000_create_users_table.php
View file @
99a9b2bb
...
@@ -16,17 +16,16 @@ class CreateUsersTable extends Migration
...
@@ -16,17 +16,16 @@ class CreateUsersTable extends Migration
Schema
::
create
(
'users'
,
function
(
Blueprint
$table
)
{
Schema
::
create
(
'users'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'name'
)
->
nullable
();
$table
->
string
(
'name'
)
->
nullable
();
$table
->
string
(
'email'
)
->
unique
();
$table
->
string
(
'email'
)
->
unique
();
$table
->
timestamp
(
'email_verified_at'
)
->
nullable
();
$table
->
string
(
'password'
);
$table
->
string
(
'password'
);
$table
->
string
(
'instituicao'
)
->
nullable
();
$table
->
string
(
'instituicao'
)
->
nullable
();
$table
->
string
(
'celular'
)
->
nullable
();
$table
->
string
(
'celular'
)
->
nullable
();
$table
->
string
(
'cpf'
)
->
nullable
();
$table
->
string
(
'cpf'
)
->
nullable
();
$table
->
string
(
'especProfissional'
)
->
nullable
();
$table
->
boolean
(
'usuarioTemp'
)
->
nullable
();
$table
->
string
(
'tipo'
)
->
nullable
();
$table
->
string
(
'tipo'
)
->
nullable
();
$table
->
boolean
(
'usuarioTemp'
)
->
nullable
();
$table
->
rememberToken
();
$table
->
rememberToken
();
$table
->
timestamps
();
$table
->
timestamps
();
$table
->
timestamp
(
'email_verified_at'
)
->
nullable
();
$table
->
integer
(
'enderecoId'
)
->
nullable
();
$table
->
integer
(
'enderecoId'
)
->
nullable
();
});
});
...
...
database/migrations/2020_02_05_123048_create_trabalhos_table.php
View file @
99a9b2bb
...
@@ -15,31 +15,26 @@ class CreateTrabalhosTable extends Migration
...
@@ -15,31 +15,26 @@ class CreateTrabalhosTable extends Migration
{
{
Schema
::
create
(
'trabalhos'
,
function
(
Blueprint
$table
)
{
Schema
::
create
(
'trabalhos'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
bigIncrements
(
'id'
);
$table
->
timestamps
();
$table
->
string
(
'titulo'
);
$table
->
string
(
'titulo'
);
$table
->
string
(
'grandeArea'
);
$table
->
boolean
(
'avaliado'
)
->
nullable
();
$table
->
string
(
'area'
);
$table
->
string
(
'subArea'
);
$table
->
string
(
'decisaoCONSU'
);
$table
->
string
(
'anexoDecisaoCONSU'
);
$table
->
string
(
'autorizacaoComiteEtica'
);
$table
->
string
(
'anexoAutorizacaoComiteEtica'
);
$table
->
string
(
'coordenador'
);
//preencher automaticamente
$table
->
string
(
'anexoLattesCoordenador'
);
$table
->
string
(
'anexoPlanilhaPontuacao'
);
$table
->
string
(
'pontuacaoPlanilha'
);
$table
->
string
(
'linkGrupoPesquisa'
);
$table
->
string
(
'linkGrupoPesquisa'
);
$table
->
string
(
'linkLattesEstudante'
);
$table
->
string
(
'linkLattesEstudante'
);
$table
->
string
(
'
autores'
)
->
nullable
(
);
$table
->
string
(
'
pontuacaoPlanilha'
);
$table
->
date
(
'data'
)
->
nullable
();
$table
->
date
(
'data'
)
->
nullable
();
$table
->
text
(
'resumo'
)
->
nullable
();
//Anexos
$table
->
text
(
'avaliado'
)
->
nullable
();
$table
->
string
(
'anexoProjeto'
);
$table
->
string
(
'anexoDecisaoCONSU'
)
->
nullable
();
$table
->
string
(
'anexoPlanilhaPontuacao'
);
$table
->
string
(
'anexoLattesCoordenador'
);
$table
->
string
(
'anexoAutorizacaoComiteEtica'
);
//chaves estrangeiras
$table
->
unsignedBigInteger
(
'grande_area_id'
);
$table
->
unsignedBigInteger
(
'area_id'
);
$table
->
unsignedBigInteger
(
'sub_area_id'
);
$table
->
unsignedBigInteger
(
'evento_id'
);
$table
->
unsignedBigInteger
(
'proponente_id'
);
$table
->
integer
(
'modalidadeId'
);
$table
->
timestamps
();
$table
->
integer
(
'areaId'
);
$table
->
integer
(
'autorId'
);
$table
->
integer
(
'eventoId'
);
$table
->
integer
(
'proponente_id'
);
});
});
}
}
...
...
database/migrations/2020_02_06_132418_chaves_estrangeiras.php
View file @
99a9b2bb
...
@@ -101,18 +101,18 @@ class ChavesEstrangeiras extends Migration
...
@@ -101,18 +101,18 @@ class ChavesEstrangeiras extends Migration
//------------------------------------------------------------------------
//------------------------------------------------------------------------
Schema
::
table
(
'trabalhos'
,
function
(
Blueprint
$table
)
{
//
Schema::table('trabalhos', function (Blueprint $table) {
$table
->
foreign
(
'modalidadeId'
)
->
references
(
'id'
)
->
on
(
'modalidades'
);
//
$table->foreign('modalidadeId')->references('id')->on('modalidades');
});
//
});
// Schema::table('trabalhos', function (Blueprint $table) {
// Schema::table('trabalhos', function (Blueprint $table) {
// $table->foreign('areaId')->references('id')->on('areas');
// $table->foreign('areaId')->references('id')->on('areas');
// });
// });
Schema
::
table
(
'trabalhos'
,
function
(
Blueprint
$table
)
{
//
Schema::table('trabalhos', function (Blueprint $table) {
$table
->
foreign
(
'autorId'
)
->
references
(
'id'
)
->
on
(
'users'
);
//
$table->foreign('autorId')->references('id')->on('users');
});
//
});
Schema
::
table
(
'trabalhos'
,
function
(
Blueprint
$table
)
{
//
Schema::table('trabalhos', function (Blueprint $table) {
$table
->
foreign
(
'eventoId'
)
->
references
(
'id'
)
->
on
(
'eventos'
);
//
$table->foreign('eventoId')->references('id')->on('eventos');
});
//
});
//------------------------------------------------------------------------
//------------------------------------------------------------------------
...
@@ -122,12 +122,12 @@ class ChavesEstrangeiras extends Migration
...
@@ -122,12 +122,12 @@ class ChavesEstrangeiras extends Migration
//------------------------------------------------------------------------
//------------------------------------------------------------------------
Schema
::
table
(
'revisors'
,
function
(
Blueprint
$table
)
{
//
Schema::table('revisors', function (Blueprint $table) {
$table
->
foreign
(
'revisorId'
)
->
references
(
'id'
)
->
on
(
'users'
);
//
$table->foreign('revisorId')->references('id')->on('users');
});
//
});
Schema
::
table
(
'revisors'
,
function
(
Blueprint
$table
)
{
//
Schema::table('revisors', function (Blueprint $table) {
$table
->
foreign
(
'eventoId'
)
->
references
(
'id'
)
->
on
(
'eventos'
);
//
$table->foreign('eventoId')->references('id')->on('eventos');
});
//
});
// Schema::table('revisors', function (Blueprint $table) {
// Schema::table('revisors', function (Blueprint $table) {
// $table->foreign('areaId')->references('id')->on('areas');
// $table->foreign('areaId')->references('id')->on('areas');
// });
// });
...
...
database/migrations/2020_05_20_211421_create_proponentes_table.php
View file @
99a9b2bb
...
@@ -15,9 +15,9 @@ class CreateProponentesTable extends Migration
...
@@ -15,9 +15,9 @@ class CreateProponentesTable extends Migration
{
{
Schema
::
create
(
'proponentes'
,
function
(
Blueprint
$table
)
{
Schema
::
create
(
'proponentes'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'CPF'
);
//
$table->string('CPF');
$table
->
string
(
'SIAPE'
);
$table
->
string
(
'SIAPE'
);
$table
->
string
(
'email'
)
->
unique
();
//
$table->string('email')->unique();
$table
->
string
(
'cargo'
);
$table
->
string
(
'cargo'
);
$table
->
string
(
'vinculo'
);
$table
->
string
(
'vinculo'
);
$table
->
string
(
'titulacaoMaxima'
);
$table
->
string
(
'titulacaoMaxima'
);
...
...
Prev
1
2
3
Next
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