static function getSexoByFlag($flag) { $sexo = Sexo::getArray(); if (array_key_exists($flag, $sexo)) { return $sexo[$flag]; } else { return false; } }
public function getGridDados() { /** @var RelationshipDao $dao */ $dao = $this->getFromServiceLocator(RelationshipConst::DAO); /** @var \Application\Entity\User $instituicaoLogado */ $instituicaoLogado = $this->getFromServiceLocator(UsuarioConst::ZFCUSER_AUTH_SERVICE)->getIdentity(); $qb = $dao->findRelationshipsByInstitutionUser($instituicaoLogado->getId()); $jqgrid = new JqGridTable(); $jqgrid->setAlias('r'); $jqgrid->setQuery($qb); //$paramsPost = $jqgrid->getParametrosFromPost(); $rows = $jqgrid->getDatatableArray(); $dados = []; foreach ($rows[JqGridConst::PARAM_REGISTROS] as $row) { /** @var Relationship $relationship */ $relationship = $row; /** @var Person $pessoaRelacionada */ $pessoaRelacionada = $relationship->getPersonUserId()->getPerson(); $temp[PersonConst::FLD_NAME] = $pessoaRelacionada->getName(); $temp[PersonConst::FLD_SEX] = Sexo::getSexoByFlag($pessoaRelacionada->getSex()); $temp[UsuarioConst::FLD_EMAIL] = $pessoaRelacionada->getUserId()->getEmail(); $botaoEditar = new JqGridButton(); $botaoEditar->setTitle('Ver Mais'); $botaoEditar->setClass('btn btn-primary btn-xs'); $botaoEditar->setUrl('/pessoa/pagina/' . $relationship->getPersonUserId()->getId()); $botaoEditar->setIcon('glyphicon glyphicon-eye-open'); $temp[JqGridConst::ACAO] = "<div class='agrupa-botoes'>" . $botaoEditar->render() . "</div>"; $dados[] = $temp; } $rows[JqGridConst::PARAM_REGISTROS] = $dados; return $rows; }