Commit da227a5dafe0a6924ec894ae05be7643997540f9
1 parent
f171a701
Exists in
master
Alterado listagem de alunos, para exibir o nome da pessoa da mãe, quando vincula…
…da a pessoa da mãe a pessoa do aluno.
Showing
1 changed file
with
52 additions
and
119 deletions
Show diff stats
ieducar/intranet/educar_aluno_lst.php
... | ... | @@ -142,10 +142,10 @@ class indice extends clsListagem |
142 | 142 | $this->limite = 20; |
143 | 143 | $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->limite-$this->limite: 0; |
144 | 144 | |
145 | - $obj_aluno = new clsPmieducarAluno(); | |
146 | - $obj_aluno->setLimite( $this->limite, $this->offset ); | |
145 | + $aluno = new clsPmieducarAluno(); | |
146 | + $aluno->setLimite( $this->limite, $this->offset ); | |
147 | 147 | |
148 | - $lista = $obj_aluno->lista2( | |
148 | + $alunos = $aluno->lista2( | |
149 | 149 | $this->cod_aluno, |
150 | 150 | null, |
151 | 151 | null, |
... | ... | @@ -173,122 +173,26 @@ class indice extends clsListagem |
173 | 173 | $this->cod_inep |
174 | 174 | ); |
175 | 175 | |
176 | - $total = $obj_aluno->_total; | |
177 | - | |
178 | - // monta a lista | |
179 | - if( is_array( $lista ) && count( $lista ) ) | |
180 | - { | |
181 | - foreach ( $lista AS $registro ) | |
182 | - { | |
183 | - | |
184 | - $registro["nome_responsavel"] = null; | |
185 | - $det_fisica_aluno = null; | |
186 | - | |
187 | - if($registro['tipo_responsavel'] == 'p' || (!$registro["nome_responsavel"] && $registro['tipo_responsavel'] == null)) | |
188 | - { | |
189 | - $obj_fisica= new clsFisica($registro["ref_idpes"]); | |
190 | - $det_fisica_aluno = $obj_fisica->detalhe(); | |
191 | - if($det_fisica_aluno["idpes_pai"] ) | |
192 | - { | |
193 | - $obj_ref_idpes = new clsPessoa_( $det_fisica_aluno["idpes_pai"] ); | |
194 | - $det_ref_idpes = $obj_ref_idpes->detalhe(); | |
195 | - $obj_fisica= new clsFisica($det_fisica_aluno["idpes_pai"]); | |
196 | - $det_fisica = $obj_fisica->detalhe(); | |
197 | - $registro["nome_responsavel"] = $det_ref_idpes['nome']; | |
198 | - | |
199 | - if( $det_fisica["cpf"] ) | |
200 | - $registro["cpf_responsavel"] = int2CPF($det_fisica["cpf"]); | |
201 | - } | |
202 | - | |
203 | - } | |
204 | - | |
205 | - if($registro['tipo_responsavel'] == 'm' || ($registro["nome_responsavel"] == null && $registro['tipo_responsavel'] == null)) | |
206 | - { | |
207 | - if(!$det_fisica_aluno) | |
208 | - { | |
209 | - $obj_fisica= new clsFisica($registro["ref_idpes"]); | |
210 | - $det_fisica_aluno = $obj_fisica->detalhe(); | |
211 | - } | |
212 | - | |
213 | - if($det_fisica_aluno["idpes_mae"] ) | |
214 | - { | |
215 | - $obj_ref_idpes = new clsPessoa_( $det_fisica_aluno["idpes_mae"] ); | |
216 | - $det_ref_idpes = $obj_ref_idpes->detalhe(); | |
217 | - $obj_fisica= new clsFisica($det_fisica_aluno["idpes_mae"]); | |
218 | - $det_fisica = $obj_fisica->detalhe(); | |
219 | - $registro["nome_responsavel"] = $det_ref_idpes["nome"]; | |
220 | - | |
221 | - if($det_fisica["cpf"]) | |
222 | - $registro["cpf_responsavel"] = int2CPF($det_fisica["cpf"]); | |
223 | - } | |
224 | - } | |
225 | - | |
226 | - if($registro['tipo_responsavel'] == 'r' || ($registro["nome_responsavel"] == null && $registro['tipo_responsavel'] == null)) | |
227 | - { | |
228 | - if(!$det_fisica_aluno) | |
229 | - { | |
230 | - $obj_fisica= new clsFisica($registro["ref_idpes"]); | |
231 | - $det_fisica_aluno = $obj_fisica->detalhe(); | |
232 | - } | |
233 | - | |
234 | - if( $det_fisica_aluno["idpes_responsavel"] ) | |
235 | - { | |
236 | - $obj_ref_idpes = new clsPessoa_( $det_fisica_aluno["idpes_responsavel"] ); | |
237 | - $obj_fisica = new clsFisica( $det_fisica_aluno["idpes_responsavel"] ); | |
238 | - $det_ref_idpes = $obj_ref_idpes->detalhe(); | |
239 | - $det_fisica = $obj_fisica->detalhe(); | |
240 | - $registro["nome_responsavel"] = $det_ref_idpes["nome"]; | |
241 | - if($det_fisica["cpf"]) | |
242 | - $registro["cpf_responsavel"] = int2CPF($det_fisica["cpf"]); | |
243 | - } | |
244 | - } | |
245 | - | |
246 | - if(!$registro["nome_responsavel"]) | |
247 | - { | |
248 | - if($registro['tipo_responsavel'] != null) | |
249 | - { | |
250 | - if($registro['tipo_responsavel'] == 'p') | |
251 | - $registro["nome_responsavel"] = $registro["nm_pai"]; | |
252 | - else | |
253 | - $registro["nome_responsavel"] = $registro["nm_mae"]; | |
254 | - } | |
255 | - else | |
256 | - { | |
257 | - if($registro["nm_pai"]) | |
258 | - $registro["nome_responsavel"] = $registro["nm_pai"]; | |
259 | - else | |
260 | - $registro["nome_responsavel"] = $registro["nm_mae"]; | |
261 | - } | |
262 | - } | |
263 | - | |
264 | - $inepMapper = new Educacenso_Model_AlunoDataMapper(); | |
265 | - $alunoInep = NULL; | |
266 | - | |
267 | - try { | |
268 | - $alunoInep = $inepMapper->find(array('cod_aluno' => $registro["cod_aluno"])); | |
269 | - } | |
270 | - catch(Exception $e) { | |
271 | - } | |
272 | - | |
273 | - if (empty($alunoInep->alunoInep)){ | |
274 | - $registro['cod_inep'] = '-'; | |
275 | - } else { | |
276 | - $registro['cod_inep'] = $alunoInep->alunoInep; | |
277 | - } | |
278 | - | |
279 | - $registro["nome_aluno"] = strtoupper($registro["nome_aluno"]); | |
280 | - $registro["nm_mae"] = strtoupper($registro["nm_mae"]); | |
281 | - $registro["nome_responsavel"] = strtoupper($registro["nome_responsavel"]); | |
282 | - | |
283 | - $this->addLinhas( array( | |
284 | - "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$registro["cod_aluno"]}</a>", | |
285 | - "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$registro["cod_inep"]}</a>", | |
286 | - "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$registro["nome_aluno"]}</a>", | |
287 | - "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$registro["nm_mae"]}</a>", | |
288 | - "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$registro["nome_responsavel"]}</a>", | |
289 | - "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$registro["cpf_responsavel"]}</a>" | |
290 | - ) ); | |
291 | - } | |
176 | + $total = $aluno->_total; | |
177 | + | |
178 | + foreach ( $alunos AS $registro ) { | |
179 | + $alunoInepId = $this->tryLoadAlunoInepId($registro["cod_aluno"]); | |
180 | + $nomeAluno = strtoupper($registro["nome_aluno"]); | |
181 | + $nomeMae = strtoupper($this->loadNomeMae($registro)); | |
182 | + | |
183 | + // responsavel | |
184 | + $aluno->cod_aluno = $registro["cod_aluno"]; | |
185 | + $responsavel = $aluno->getResponsavelAluno(); | |
186 | + $nomeResponsavel = strtoupper($responsavel["nome_responsavel"]); | |
187 | + | |
188 | + $this->addLinhas( array( | |
189 | + "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$registro["cod_aluno"]}</a>", | |
190 | + "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$alunoInepId}</a>", | |
191 | + "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$nomeAluno}</a>", | |
192 | + "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$nomeMae}</a>", | |
193 | + "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$nomeResponsavel}</a>", | |
194 | + "<a href=\"educar_aluno_det.php?cod_aluno={$registro["cod_aluno"]}\">{$responsavel["cpf_responsavel"]}</a>" | |
195 | + ) ); | |
292 | 196 | } |
293 | 197 | |
294 | 198 | $this->addPaginador2( "educar_aluno_lst.php", $total, $_GET, $this->nome, $this->limite ); |
... | ... | @@ -306,6 +210,35 @@ class indice extends clsListagem |
306 | 210 | //** |
307 | 211 | $this->largura = "100%"; |
308 | 212 | } |
213 | + | |
214 | + protected function loadNomeMae($aluno) { | |
215 | + $nome = $aluno['nm_mae']; | |
216 | + | |
217 | + $pessoaAluno = new clsFisica($aluno['ref_idpes']); | |
218 | + $pessoaAluno = $pessoaAluno->detalhe(); | |
219 | + | |
220 | + if ($pessoaAluno['idpes_mae']) { | |
221 | + $pessoaMae = new clsPessoaFj($pessoaAluno['idpes_mae']); | |
222 | + $pessoaMae = $pessoaMae->detalhe(); | |
223 | + $nome = $pessoaMae['nome']; | |
224 | + } | |
225 | + | |
226 | + return $nome; | |
227 | + } | |
228 | + | |
229 | + protected function tryLoadAlunoInepId($alunoId) { | |
230 | + $dataMapper = new Educacenso_Model_AlunoDataMapper(); | |
231 | + | |
232 | + try { | |
233 | + $alunoInep = $dataMapper->find(array('cod_aluno' => $alunoId)); | |
234 | + $id = $alunoInep->alunoInep; | |
235 | + } | |
236 | + catch(Exception $e) { | |
237 | + $id = ''; | |
238 | + } | |
239 | + | |
240 | + return $id; | |
241 | + } | |
309 | 242 | } |
310 | 243 | // cria uma extensao da classe base |
311 | 244 | $pagina = new clsIndexBase(); | ... | ... |