Skip to content

Commit 1818668

Browse files
Merge pull request #608 from ezanon/issue607
Obtém órgão responsável de projeto e correção na obtenção de financia…
2 parents ae35b52 + 94f7e95 commit 1818668

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

src/Lattes.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,6 +2058,7 @@ protected static function _listarProjetosPesquisa($codpes, $lattes_array = null,
20582058
foreach ($atuacoes as $pp) {
20592059
if (isset($pp['ATIVIDADES-DE-PARTICIPACAO-EM-PROJETO']['PARTICIPACAO-EM-PROJETO']['PROJETO-DE-PESQUISA'])) {
20602060
$projeto = $pp['ATIVIDADES-DE-PARTICIPACAO-EM-PROJETO']['PARTICIPACAO-EM-PROJETO']['PROJETO-DE-PESQUISA'];
2061+
$participacao = $pp['ATIVIDADES-DE-PARTICIPACAO-EM-PROJETO']['PARTICIPACAO-EM-PROJETO'];
20612062
if (!isset($projeto['EQUIPE-DO-PROJETO'])) {
20622063
foreach ($projeto as $pesquisa) {
20632064
$integrantes = Arr::get($pesquisa, "EQUIPE-DO-PROJETO.INTEGRANTES-DO-PROJETO", []);
@@ -2073,6 +2074,8 @@ protected static function _listarProjetosPesquisa($codpes, $lattes_array = null,
20732074
'DESCRICAO-DO-PROJETO' => Arr::get($pesquisa, "@attributes.DESCRICAO-DO-PROJETO", ""),
20742075
'EQUIPE-DO-PROJETO' => $aux_integrantes,
20752076
'FINANCIADORES' => $aux_financiadores,
2077+
'ORGAO-CODIGO' => Arr::get($participacao, "@attributes.CODIGO-ORGAO", ""),
2078+
'ORGAO-NOME' => Arr::get($participacao, "@attributes.NOME-ORGAO", ""),
20762079
];
20772080

20782081
if (!self::_verificarFiltro($tipo, $aux_projeto['ANO-INICIO'], $limit_ini, $limit_fim, 1)) {
@@ -2095,6 +2098,8 @@ protected static function _listarProjetosPesquisa($codpes, $lattes_array = null,
20952098
'DESCRICAO-DO-PROJETO' => Arr::get($projeto, "@attributes.DESCRICAO-DO-PROJETO", ""),
20962099
'EQUIPE-DO-PROJETO' => $aux_integrantes,
20972100
'FINANCIADORES' => $aux_financiadores,
2101+
'ORGAO-CODIGO' => Arr::get($participacao, "@attributes.CODIGO-ORGAO", ""),
2102+
'ORGAO-NOME' => Arr::get($participacao, "@attributes.NOME-ORGAO", ""),
20982103
];
20992104

21002105
if (!self::_verificarFiltro($tipo, $aux_projeto['ANO-INICIO'], $limit_ini, $limit_fim, 1)) {
@@ -2111,7 +2116,6 @@ protected static function _listarProjetosPesquisa($codpes, $lattes_array = null,
21112116
if (!isset($c['PROJETO-DE-PESQUISA'])) {
21122117
continue;
21132118
}
2114-
21152119
$dados_basicos = (!isset($c['PROJETO-DE-PESQUISA']) && isset($c[1])) ? 1 : 'PROJETO-DE-PESQUISA';
21162120
if (!isset($c['PROJETO-DE-PESQUISA']['EQUIPE-DO-PROJETO'])) {
21172121
foreach ($c['PROJETO-DE-PESQUISA'] as $pesquisa) {
@@ -2128,6 +2132,8 @@ protected static function _listarProjetosPesquisa($codpes, $lattes_array = null,
21282132
'DESCRICAO-DO-PROJETO' => Arr::get($pesquisa, "@attributes.DESCRICAO-DO-PROJETO", ""),
21292133
'EQUIPE-DO-PROJETO' => $aux_integrantes,
21302134
'FINANCIADORES' => $aux_financiadores,
2135+
'ORGAO-CODIGO' => Arr::get($c, "@attributes.CODIGO-ORGAO", ""),
2136+
'ORGAO-NOME' => Arr::get($c, "@attributes.NOME-ORGAO", ""),
21312137
];
21322138

21332139
$i++;
@@ -2142,7 +2148,7 @@ protected static function _listarProjetosPesquisa($codpes, $lattes_array = null,
21422148
if (isset($c['PROJETO-DE-PESQUISA']['EQUIPE-DO-PROJETO']['INTEGRANTES-DO-PROJETO'])) {
21432149
$integrantes = Arr::get($c, "PROJETO-DE-PESQUISA.EQUIPE-DO-PROJETO.INTEGRANTES-DO-PROJETO", []);
21442150
$aux_integrantes = self::_listarAutores($integrantes);
2145-
$financiadores = Arr::get($c, "FINANCIADORES-DO-PROJETO.FINANCIADOR-DO-PROJETO", []);
2151+
$financiadores = Arr::get($c, "{$dados_basicos}.FINANCIADORES-DO-PROJETO.FINANCIADOR-DO-PROJETO", []);
21462152
$aux_financiadores = self::_listarFinanciadores($financiadores);
21472153
$aux_projeto = [
21482154
'NOME-DO-PROJETO' => Arr::get($c, "{$dados_basicos}.@attributes.NOME-DO-PROJETO", ""),
@@ -2153,6 +2159,8 @@ protected static function _listarProjetosPesquisa($codpes, $lattes_array = null,
21532159
'DESCRICAO-DO-PROJETO' => Arr::get($c, "{$dados_basicos}.@attributes.DESCRICAO-DO-PROJETO", ""),
21542160
'EQUIPE-DO-PROJETO' => $aux_integrantes,
21552161
'FINANCIADORES' => $aux_financiadores,
2162+
'ORGAO-CODIGO' => Arr::get($c, "@attributes.CODIGO-ORGAO", ""),
2163+
'ORGAO-NOME' => Arr::get($c, "@attributes.NOME-ORGAO", ""),
21562164
];
21572165
} else {
21582166
$aux_projeto = [
@@ -2668,14 +2676,13 @@ protected static function _listarOrientacoesEmAndamentoIC($codpes, $lattes_array
26682676
*/
26692677
protected static function listarFinanciadores($array) {
26702678
$aux_financiadores = [];
2671-
if ($array) {
2672-
foreach ($array as $financiador) {
2673-
// REMOVIDO o '@attributes.' pois $financiador já são os atributos
2679+
if ($array) {
2680+
foreach ($array as $financiador) {
26742681
array_push($aux_financiadores, [
2675-
"NOME-INSTITUICAO" => Arr::get($financiador, 'NOME-INSTITUICAO', false),
2676-
"NATUREZA" => Arr::get($financiador, 'NATUREZA', false),
2677-
]);
2678-
}
2682+
"NOME-INSTITUICAO" => Arr::get($financiador, '@attributes', false) ? Arr::get($financiador, '@attributes.NOME-INSTITUICAO', false) : Arr::get($financiador, 'NOME-INSTITUICAO', false),
2683+
"NATUREZA" => Arr::get($financiador, '@attributes', false) ? Arr::get($financiador, '@attributes.NATUREZA', false) : Arr::get($financiador, 'NATUREZA', false),
2684+
]);
2685+
};
26792686
return $aux_financiadores;
26802687
}
26812688
return false;

0 commit comments

Comments
 (0)