Пример #1
0
 protected function get()
 {
     if ($this->canGet()) {
         $id = $this->getRequest()->id;
         $aluno = new clsPmieducarAluno();
         $aluno->cod_aluno = $id;
         $aluno = $aluno->detalhe();
         $attrs = array('cod_aluno' => 'id', 'ref_cod_aluno_beneficio' => 'beneficio_id', 'ref_cod_religiao' => 'religiao_id', 'ref_idpes' => 'pessoa_id', 'tipo_responsavel' => 'tipo_responsavel', 'ref_usuario_exc' => 'destroyed_by', 'data_exclusao' => 'destroyed_at', 'analfabeto', 'ativo', 'aluno_estado_id');
         $aluno = Portabilis_Array_Utils::filter($aluno, $attrs);
         $aluno['nome'] = $this->loadNomeAluno($id);
         $aluno['tipo_transporte'] = $this->loadTransporte($id);
         $aluno['tipo_responsavel'] = $this->tipoResponsavel($aluno);
         $aluno['aluno_inep_id'] = $this->loadAlunoInepId($id);
         $aluno['ativo'] = $aluno['ativo'] == 1;
         $aluno['aluno_estado_id'] = Portabilis_String_Utils::toUtf8($aluno['aluno_estado_id']);
         $aluno['alfabetizado'] = $aluno['analfabeto'] == 0;
         unset($aluno['analfabeto']);
         // destroyed_by username
         $dataMapper = $this->getDataMapperFor('usuario', 'funcionario');
         $entity = $this->tryGetEntityOf($dataMapper, $aluno['destroyed_by']);
         $aluno['destroyed_by'] = is_null($entity) ? null : $entity->get('matricula');
         $aluno['destroyed_at'] = Portabilis_Date_Utils::pgSQLToBr($aluno['destroyed_at']);
         $objFichaMedica = new clsModulesFichaMedicaAluno($id);
         if ($objFichaMedica->existe()) {
             $objFichaMedica = $objFichaMedica->detalhe();
             foreach ($objFichaMedica as $chave => $value) {
                 $objFichaMedica[$chave] = Portabilis_String_Utils::toUtf8($value);
             }
             $aluno = Portabilis_Array_Utils::merge($objFichaMedica, $aluno);
         }
         $objUniforme = new clsModulesUniformeAluno($id);
         if ($objUniforme->existe()) {
             $objUniforme = $objUniforme->detalhe();
             foreach ($objUniforme as $chave => $value) {
                 $objUniforme[$chave] = Portabilis_String_Utils::toUtf8($value);
             }
             $aluno = Portabilis_Array_Utils::merge($objUniforme, $aluno);
         }
         $objMoradia = new clsModulesMoradiaAluno($id);
         if ($objMoradia->existe()) {
             $objMoradia = $objMoradia->detalhe();
             foreach ($objMoradia as $chave => $value) {
                 $objMoradia[$chave] = Portabilis_String_Utils::toUtf8($value);
             }
             $aluno = Portabilis_Array_Utils::merge($objMoradia, $aluno);
         }
         $sql = "select sus from cadastro.fisica where idpes = \$1";
         $aluno['sus'] = Portabilis_String_Utils::toUtf8($this->fetchPreparedQuery($sql, $aluno['pessoa_id'], false, 'first-field'));
         return $aluno;
     }
 }