Exemplo n.º 1
0
 public static function DetalhaLog($idacesso)
 {
     $u = unserialize($_SESSION['usu']);
     $sql = "select  acoes.CodAcesso, acessos.CodUsuario, usuario.NomeCompleto, acoes.Acao, acoes.DataHora ";
     $sql .= "\t\t,case when acessos.Host is null then '' else acessos.Host end AS Host ";
     $sql .= "from mesusuariologacoes acoes ";
     $sql .= "inner join mesacessousuario acessos ";
     $sql .= "\t\ton acessos.numacesso = acoes.codacesso ";
     $sql .= "inner join mesusuario usuario ";
     $sql .= "\t\ton usuario.codigo = acessos.codusuario ";
     $sql .= "where CodAcesso = :pCodAcesso ";
     $sql .= "order by DataHora desc";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->bindParam(":pCodAcesso", $idacesso, PDO::PARAM_INT);
     $cmd->execute();
     if ($cmd->rowCount() > 0) {
         $ret = Comuns::TopoTabelaListagem("Ações realizadas", "actrealizadas", array("Usuário", "Ação", "Data/Hora", "Host"));
         while ($linha = $cmd->fetch(PDO::FETCH_OBJ)) {
             $ret .= '<tr>';
             $ret .= '  <td>' . $linha->NomeCompleto . '</td>';
             $ret .= '  <td>' . $linha->Acao . '</td>';
             $ret .= '  <td>' . date('d/m/Y H:i:s', strtotime($linha->DataHora)) . '</td>';
             $ret .= '  <td>' . $linha->Host . '</td>';
             $ret .= '</tr>';
         }
         $ret .= '</tbody></table>';
     } else {
         $ret = "Falha ao recuperar detalhes";
     }
     $cmd->closeCursor();
     return $ret;
 }
Exemplo n.º 2
0
function Main()
{
    $usu = unserialize($_SESSION['usu']);
    //$usu = new Usuario();
    $usufiltro = $_POST['txtUsuario'];
    $idusuario = $_POST['idusuario'];
    $dtinifiltro = $_POST['txtDtIni'];
    $dtfimfiltro = $_POST['txtDtFin'];
    $pagina = $_POST['hidPagina'];
    $tpl = file_get_contents("tpl/frm-acessos.html");
    $botoes = Botao::BotaoPesquisar("fntPesquisarAcessos();", "Pesquisar acessos");
    $tpl = str_replace("<!--telatopo-->", Comuns::GeraTopoPagina($usu), $tpl);
    $tpl = str_replace("<!--itens-toolbar-->", $botoes, $tpl);
    $tpl = str_replace("<!--txtDtIni-->", $dtinifiltro, $tpl);
    $tpl = str_replace("<!--txtDtFin-->", $dtfimfiltro, $tpl);
    if ($dtinifiltro != "" && $dtfimfiltro != "") {
        Log::RegistraLog("Acessou tela de consulta de acessos ao sistema e parametrizou: dtinifiltro=" . $dtinifiltro . "; dtfimfiltro=" . $dtfimfiltro . "; idusuario=" . $idusuario);
        $idusuario = $idusuario == "" ? null : $idusuario;
        $pagina = $pagina == "" ? 1 : $pagina;
        $tpl = str_replace("<!--hidPagina-->", $pagina, $tpl);
        $dtinifiltro = Comuns::DataBanco($dtinifiltro) . " 00:00:00";
        $dtfimfiltro = Comuns::DataBanco($dtfimfiltro) . " 23:59:59";
        $regs = 0;
        $acessos = $usu->ListaAcessosSistema($usuario = $idusuario, $dataini = $dtinifiltro, $datafim = $dtfimfiltro, $pagina = $pagina, 30, $regs);
        if (count($acessos) > 0) {
            $tabela = Comuns::TopoTabelaListagem("Acessos ao sistema", "acessos", array('Núm. Acesso', 'Usuário', 'Data', 'Detalhes'));
            foreach ($acessos as $linha) {
                $tabela .= '<tr>';
                $tabela .= '  <td>' . $linha->NumAcesso . '</td>';
                $tabela .= '  <td>' . $linha->Usuario . '</td>';
                $tabela .= '  <td>' . date("d/m/Y H:i:s", strtotime($linha->Data)) . '</td>';
                $tabela .= '  <td><a href="javascript:void(0);" onclick="javascript:fntDetalhesAcesso(' . $linha->NumAcesso . ');">' . Comuns::IMG_ACAO_DETALHES . '</a></td>';
                $tabela .= '</tr>';
            }
            $tabela .= '</tbody>';
            $tabela .= '</table>';
            $tabela .= Comuns::GeraPaginacao($regs, $pagina, 30, 0, "fntNavegaPaginacaoAcessos", true);
            $tabela .= '<br /><br />';
        } else {
            $tabela = "@lng[Nenhum registro encontrado]";
        }
    } else {
        $tabela = "@lng[Pesquisa não realizada]";
    }
    $tpl = str_replace("<!--txtUsuario-->", $usufiltro, $tpl);
    $tpl = str_replace("<!--id-usuario-->", $idusuario, $tpl);
    $tpl = str_replace("<!--acessos-usuarios-->", $tabela, $tpl);
    $tpl = str_replace("<!--hidPagina-->", "", $tpl);
    echo Comuns::Idioma($tpl);
}
Exemplo n.º 3
0
function Main()
{
    header('Content-Type: text/html; charset=iso-8859-1');
    $tpl = file_get_contents("tpl/cad-componenteexame.html");
    $codexame = base64_decode($_POST["c"]);
    $registro = base64_decode($_POST['r']);
    $tpl = str_replace("<!--hdnCodigoExame-->", $_POST["c"], $tpl);
    $tpl = str_replace("<!--nomeexame-->", TipoExame::ConsultaNomeExame($codexame), $tpl);
    // Lista os componentes já cadastrados
    $componentes = new Componente();
    $componentes->setCodexame($codexame);
    if ($registro == "") {
        $tpl = str_replace("<!--txtDescricao-->", "", $tpl);
        $tpl = str_replace("<!--hdnCodigoComp-->", "", $tpl);
    } else {
        $componentes->setCodcomponente($registro);
        $retorno = $componentes->Carrega();
        $tpl = str_replace("<!--txtDescricao-->", $retorno->getDescricao(), $tpl);
        $tpl = str_replace("<!--hdnCodigoComp-->", base64_encode($retorno->getCodcomponente()), $tpl);
    }
    $rs = $componentes->Lista();
    if (count($rs) > 0) {
        $tab = Comuns::TopoTabelaListagem("Componentes cadastrados", "componentes", array('Descrição', 'Ações'));
        foreach ($rs as $comp) {
            $excri = base64_encode($comp->CodExame);
            $compcri = base64_encode($comp->Codigo);
            $tab .= '    <tr id="' . $excri . '_' . $compcri . '">';
            $tab .= '      <td>' . $comp->Descricao . '</td>';
            $tab .= '      <td>';
            $tab .= '        <a href="javascript:void(0);" onclick="javascript:fntEditaComponente(\'' . $excri . '\',\'' . $compcri . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
            $tab .= '        <a href="javascript:void(0);" onclick="javascript:fntDeletaComponente(\'' . $excri . '\',\'' . $compcri . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a>';
            $tab .= '        <a href="javascript:void(0);" onclick="javascript:fntAbreValorRef(\'' . $excri . '\',\'' . $compcri . '\')">' . Comuns::IMG_ACAO_VALORES_REF . '</a>';
            $tab .= '        <a href="javascript:void(0);" onclick="javascript:fntMoverComponente(\'' . $excri . '\',\'' . $compcri . '\')">' . Comuns::IMG_ACAO_MOVER . '</a>';
            $tab .= '      </td>';
            $tab .= '    </tr>';
        }
        $tab .= '  </tbody>';
        $tab .= '</table>';
    } else {
        $tab = "<br />@lng[Nenhum componente cadastrado]";
    }
    $tpl = str_replace("<!--tabela-->", $tab, $tpl);
    echo Comuns::Idioma($tpl);
}
Exemplo n.º 4
0
 public function Lista()
 {
     if (isset($this->codcaso)) {
         $sql = "select CodObjetivo, Descricao ";
         $sql .= "from mescasoobjetivos where CodCaso = :pCodCaso;";
         $cnn = Conexao2::getInstance();
         $cmd = $cnn->prepare($sql);
         $cmd->bindParam(":pCodCaso", $this->codcaso, PDO::PARAM_INT);
         $cmd->execute();
         if ($cmd->errorCode() == Comuns::QUERY_OK) {
             if ($cmd->rowCount() > 0) {
                 $ret .= Comuns::TopoTabelaListagem("Objetivos cadastrados", "tabobjetivos", array("Objetivo", "Ações"));
                 while ($objetivo = $cmd->fetch(PDO::FETCH_OBJ)) {
                     $codigo = base64_encode($objetivo->CodObjetivo);
                     $ret .= '<tr>';
                     $ret .= '<td>' . $objetivo->Descricao . '</td>';
                     $ret .= '<td>';
                     $ret .= '<a href="javascript:void(0);" onclick="javascript:fntExibeCadastroEtapa(\'' . $codigo . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
                     $ret .= '<a href="javascript:void(0);" onclick="javascript:fntExcluiObjetivo(\'' . $codigo . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                     $ret = str_replace("##id##", "", $ret);
                     $ret .= '</td>';
                     $ret .= '</tr>';
                 }
                 $ret .= "</tbody></table>";
             } else {
                 $ret = "@lng[Nenhum objetivo cadastrado]";
             }
             return $ret;
         } else {
             $msg = $cmd->errorInfo();
             $this->msg_erro = $msg[2];
             return false;
         }
     } else {
         $this->msg_erro = "@lng[Caso não informado]";
         return false;
     }
 }
Exemplo n.º 5
0
 public function ListaPedidosAprovacao()
 {
     $sql = "select Codigo, NomeCompleto, NomeUsuario, Email, DtCadastro FROM mesusuario WHERE Situacao = 0;";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $sqlcombo = "select Codigo, Descricao from mesgrupousuario;";
     if ($cmd->execute()) {
         if ($cmd->rowCount() > 0) {
             $ret = Comuns::TopoTabelaListagem("Novos cadastros pendentes de aprovação", "CadPendentes", array('Nome', 'Usuário', 'E-mail', 'Data Cad.', 'Ações'));
             $ret .= '    <tr>';
             $ret .= '      <td>' . $linha["NomeCompleto"] . '</td>';
             $ret .= '      <td>' . $linha["NomeUsuario"] . '</td>';
             $ret .= '      <td>' . $linha["Email"] . '</td>';
             $ret .= '      <td>';
             //$combo = new ComboBox()
             $ret .= '      </td>';
             $ret .= '    </tr>';
         } else {
             $msg = $cmd->errorInfo();
             $this->msg_erro = $msg[2];
             return false;
         }
     } else {
         throw new Exception($cmd->errorInfo(), 1013);
     }
 }
Exemplo n.º 6
0
 public function ListaTabela($pagina = 1, $nporpagina = 10)
 {
     $ini = $pagina * $nporpagina - $nporpagina;
     $sql = "SELECT Codigo, Descricao ";
     $sql .= "FROM mespermissao LIMIT " . $ini . ", " . $nporpagina . ";";
     $cnn = new Conexao();
     $rs = $cnn->Consulta($sql);
     if (mysql_num_rows($rs)) {
         $ret = Comuns::TopoTabelaListagem("Lista de Permissões do sistema", "permissoessis", array('Descrição', 'Ações'));
         while ($linha = mysql_fetch_array($rs)) {
             $cod = base64_encode($linha["Codigo"]);
             $ret .= '    <tr>';
             $ret .= '      <td>' . $linha["Descricao"] . '</td>';
             $ret .= '      <td><a href="cadastro.php?t=' . $this->form . '&r=' . $cod . '">' . Comuns::IMG_ACAO_EDITAR . '</a>&nbsp;<a href="javascript:void(0);" onclick="javascript:fntExcluiPermissao(\'' . $cod . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a></td>';
             $ret .= '    </tr>';
         }
         $ret .= '  </tbody>';
         $ret .= '</table>';
         $registros = Comuns::NRegistros("mespermissao");
         if ($registros > 0) {
             $ret .= Comuns::GeraPaginacao($registros, $pagina, $nporpagina, $this->form);
         }
     } else {
         $ret = "@lng[Nenhuma permissão cadastrado]";
     }
     return $ret;
 }
Exemplo n.º 7
0
 public function ListaTabela($pagina = 1, $nporpagina = 10)
 {
     $ini = $pagina * $nporpagina - $nporpagina;
     $sql = "SELECT Codigo, Descricao, CodAreaPai, Ativo ";
     $sql .= "FROM mesarea LIMIT " . $ini . ", " . $nporpagina . ";";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->execute();
     if ($cmd->rowCount() > 0) {
         $ret = Comuns::TopoTabelaListagem("Lista de Áreas de conhecimento", "AreasCad", array('Descrição', 'Área principal', 'Ativo', 'Ações'));
         while ($rs = $cmd->fetch(PDO::FETCH_OBJ)) {
             $cod = base64_encode($rs->Codigo);
             if (!is_null($rs->CodAreaPai) && $rs->CodAreaPai > 0) {
                 $areapai = self::RetornaArea($rs->CodAreaPai);
                 $descricao = $areapai->getCodigo() . " - " . $areapai->getDescricao();
             } else {
                 $descricao = "&nbsp;";
             }
             $ret .= '<tr>';
             $ret .= '  <td>' . $rs->Descricao . '</td>';
             $ret .= '  <td>' . $descricao . '</td>';
             // Exibe o status atual da pergunta.
             if ($rs->Ativo == 1) {
                 $ret .= '  <td><a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAD\', \'' . $cod . '\');">' . Comuns::IMG_STATUS_ATIVO . '</a></td>';
                 $ret = str_replace("##id##", 'id="' . $cod . '"', $ret);
             } else {
                 $ret .= '  <td><a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAD\', \'' . $cod . '\');">' . Comuns::IMG_STATUS_INATIVO . '</a></td>';
                 $ret = str_replace("##id##", 'id="' . $cod . '"', $ret);
             }
             $ret .= '  <td>';
             $ret .= '    <a href="cadastro.php?t=' . $this->form . '&r=' . $cod . '">' . Comuns::IMG_ACAO_EDITAR . '</a>';
             $ret = str_replace("##id##", "", $ret);
             $ret .= '  </td>';
             $ret .= '</tr>';
         }
         $ret .= '  </tbody>';
         $ret .= '</table>';
         $registros = Comuns::NRegistros("mesarea");
         if ($registros > 0) {
             $ret .= Comuns::GeraPaginacao($registros, $pagina, $nporpagina, $this->form);
         }
     } else {
         $ret = "@lng[Nenhum item cadastrado até o momento]";
     }
     return $ret;
 }
Exemplo n.º 8
0
 public function Lista($codcaso)
 {
     $sql = "select CodCaso, CodConteudo, case when length(Descricao) > 100 then concat(left(Descricao, 100), '...') else Descricao end as Descricao, Chave, DtCadastro ";
     $sql .= "from mescasoconteudo ";
     $sql .= "where CodCaso = :pCodCaso;";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
     $cmd->execute();
     if ($cmd->rowCount() > 0) {
         $tabela = Comuns::TopoTabelaListagem("Hipertexto", "contcad", array("Conteúdo", "Dt. Cadastro", "Ações"));
         while ($conteudo = $cmd->fetch(PDO::FETCH_OBJ)) {
             $tabela .= '<tr>';
             $tabela .= '<td>' . $conteudo->Descricao . '</td>';
             $tabela .= '<td width="150">' . date("d/m/Y H:i:s", strtotime($conteudo->DtCadastro)) . '</td>';
             $tabela .= '<td width="100">';
             $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntExibeCadastroEtapa(\'' . base64_encode($conteudo->CodConteudo) . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
             $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntDeletaConteudosHipertexto(\'' . base64_encode($conteudo->CodConteudo) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
             $tabela .= '</td>';
             $tabela = str_replace("##id##", "", $tabela);
             $tabela .= "</tr>";
         }
         $tabela .= "</tbody></table>";
     }
     $sql = "SELECT m.CodCaso, m.CodMidia, m.Descricao, m.Complemento, m.CodTipo, tm.Descricao as TipoMidia, m.DtCadastro, m.url ";
     $sql .= "FROM mesmidia m INNER JOIN mestipomidia tm ON tm.CodTipo = m.CodTipo ";
     $sql .= "where CodCaso = :pCodCaso ORDER BY m.CodTipo, DtCadastro DESC;";
     $codtipo = 0;
     $tababerta = false;
     $cmd->closeCursor();
     $cmd = $cnn->prepare($sql);
     $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
     $cmd->execute();
     if ($cmd->rowCount() > 0) {
         $obj = new ReflectionClass("Comuns");
         while ($midia = $cmd->fetch(PDO::FETCH_OBJ)) {
             if ($codtipo != $midia->CodTipo) {
                 $codtipo = $midia->CodTipo;
                 if ($tababerta == true) {
                     $tabela .= "</tbody></table>";
                     $tababerta = false;
                 }
                 $tabela .= Comuns::TopoTabelaListagem($midia->TipoMidia, "contcad_" + $midia->CodTipo, array("Tipo", "Descrição", "Dt. Cadastro", "Ações"));
                 $tababerta = true;
             }
             $icone = "IMG_MIDIA_" . strtoupper(Comuns::Limpa($midia->TipoMidia));
             $tabela .= '<tr>';
             $tabela .= '<td width="50">' . $obj->getConstant($icone) . '</td>';
             $tabela .= '<td>' . $midia->Descricao . '</td>';
             $tabela .= '<td width="150">' . date('d/m/Y H:i:s', strtotime($midia->DtCadastro)) . '</td>';
             $tabela .= '<td width="100">';
             $tabela .= '<a href="javascript:void(0);" onclick="fntAtualizaMidia(\'' . base64_encode($midia->CodMidia) . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
             if (strtoupper($midia->TipoMidia) == "DOCUMENTO") {
                 $tabela .= '<a href="' . $midia->url . '" target="_blank">';
             } else {
                 $tabela .= '<a href="javascript:void(0);" onclick="';
                 $tabela .= strtoupper($midia->TipoMidia) == "IMAGEM" ? 'fntViewImagem' : 'fntLoadMidia';
                 $tabela .= '(\'' . base64_encode($midia->CodMidia) . '\');';
                 $tabela .= '">';
             }
             $tabela .= Comuns::IMG_ACAO_VISUALIZAR . '</a>';
             $tabela .= '<a href="javascript:void(0);" onclick="fntRemoveMidia(\'' . base64_encode($midia->CodMidia) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
             $tabela .= '</td>';
             $tabela .= '</tr>';
         }
         if ($tababerta == true) {
             $tabela .= "</tbody></table>";
         }
     }
     //else
     //{
     //	$tabela = "Nenhum conteúdo adicional cadastrado até o momento";
     //}
     return $tabela;
 }
Exemplo n.º 9
0
 public function ListaTabela($pagina = 1, $nporpagina = 15)
 {
     $ini = $pagina * $nporpagina - $nporpagina;
     $sql = "SELECT i.Codigo, i.NomeCompleto, i.Sigla, i.UF, i.Cidade, i.Pais, p.Nome as NomePais, i.NomeResponsavel, i.Ativo ";
     $sql .= "FROM mesinstituicao i INNER JOIN mespaises p ON p.Codigo = i.Pais LIMIT " . $ini . ", " . $nporpagina . ";";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->execute();
     if ($cmd->errorCode() == Comuns::QUERY_OK) {
         if ($cmd->rowCount() > 0) {
             $ret = Comuns::TopoTabelaListagem("Lista de Instituições de ensino", "Instituicoes", array('Nome', 'Sigla', 'Estado', 'Cidade', 'País', 'Responsável', 'Ativo', 'Ações'));
             while ($rs = $cmd->fetch(PDO::FETCH_OBJ)) {
                 $cod = base64_encode($rs->Codigo);
                 $ret .= '<tr>';
                 $ret .= '<td>' . $rs->NomeCompleto . '</td>';
                 $ret .= '<td>' . $rs->Sigla . '</td>';
                 $ret .= '<td>' . $rs->UF . '</td>';
                 $ret .= '<td>' . $rs->Cidade . '</td>';
                 $ret .= '<td>' . $rs->NomePais . '</td>';
                 $ret .= '<td>' . $rs->NomeResponsavel . '</td>';
                 $ret .= '<td>';
                 $ret .= '<a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAG\', \'' . $cod . '\')">' . ($rs->Ativo == 1 ? Comuns::IMG_STATUS_ATIVO : Comuns::IMG_STATUS_INATIVO) . '</a>';
                 $ret = str_replace("##id##", 'id="' . $cod . '"', $ret);
                 $ret .= '</td>';
                 $ret .= '<td>';
                 $ret .= '<a href="cadastro.php?t=' . $this->form . '&r=' . $cod . '">' . Comuns::IMG_ACAO_EDITAR . '</a>&nbsp;';
                 $ret .= '<a href="javascript:void(0);" onclick="javascript:fntExcluiInstituicao(\'' . $cod . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                 $ret = str_replace("##id##", "", $ret);
                 $ret .= '</td>';
                 $ret .= '</tr>';
             }
         } else {
             $ret = "@lng[Nenhuma instituição cadastrada]";
         }
     } else {
         $msg = $cmd->errorInfo();
         $this->msg_erro = $msg[2];
         $ret = $this->msg_erro;
     }
     return $ret;
 }
Exemplo n.º 10
0
function Main()
{
    header('Content-Type: text/html; charset=iso-8859-1');
    $tpl = file_get_contents("tpl/cad-valoresreferencia.html");
    // Pode ser que o componente do exame seja zero.
    // Isso indica um exame sem componentes
    $codexame = base64_decode($_POST['e']);
    $codcompo = base64_decode($_POST['c']);
    $registro = base64_decode($_POST['r']);
    $nomepai = "";
    if ($codcompo == 0) {
        $nomepai = TipoExame::ConsultaNomeExame($codexame);
        $tipo = "exame";
    } else {
        $nomepai = Componente::ConsultaNomeComponente($codexame, $codcompo);
        $tipo = "componente";
    }
    $tpl = str_replace("<!--hdnCodigoExame-->", $_POST["e"], $tpl);
    $tpl = str_replace("<!--hdnCodigoCompo-->", $_POST["c"], $tpl);
    $tpl = str_replace("<!--nomeexame-->", $nomepai, $tpl);
    $tpl = str_replace("<!--tipo-->", $tipo, $tpl);
    $valref = new ValorReferencia();
    $valref->setCodexame($codexame);
    $valref->setCodcomponente($codcompo);
    if ($registro == "") {
        $tpl = str_replace("<!--txtAgrupador-->", "", $tpl);
        $tpl = str_replace("<!--txtValMin-->", "", $tpl);
        $tpl = str_replace("<!--txtValMax-->", "", $tpl);
        $tpl = str_replace("<!--txtValIgual-->", "", $tpl);
        $tpl = str_replace("<!--txtUnidMedida-->", "", $tpl);
        $tpl = str_replace("<!--opcoestipovalor-->", TipoValorReferencia::RetornaSelect(0), $tpl);
        $tpl = str_replace("<!--chkmarcado-->", "", $tpl);
    } else {
        if ($registro == "--") {
            $valref->setAgrupador("");
        } else {
            $valref->setAgrupador($registro);
        }
        $retorno = $valref->Carrega();
        $tpl = str_replace("<!--txtAgrupador-->", $retorno->getAgrupador(), $tpl);
        $tpl = str_replace("<!--txtValMin-->", $retorno->getVlrminimo(), $tpl);
        $tpl = str_replace("<!--txtValMax-->", $retorno->getVlrmaximo(), $tpl);
        $tpl = str_replace("<!--txtValIgual-->", $retorno->getVlrminimo(), $tpl);
        $tpl = str_replace("<!--txtUnidMedida-->", $retorno->getUnidadeMedida(), $tpl);
        $tpl = str_replace("<!--opcoestipovalor-->", TipoValorReferencia::RetornaSelect($retorno->getTipo()), $tpl);
        if ($retorno->getTemagrupador() == 1) {
            $tpl = str_replace("<!--chkmarcado-->", "", $tpl);
        } else {
            $tpl = str_replace('<!--chkmarcado-->', 'checked="checked"', $tpl);
        }
    }
    $rs = $valref->Lista();
    if (count($rs) > 0) {
        $tab = Comuns::TopoTabelaListagem("Valores de referência", "valref", array('Agrupador', 'Referência', 'Unid. Medida', 'Ações'));
        foreach ($rs as $reg) {
            $cri_codexame = base64_encode($reg->CodExame);
            $cri_codcompo = base64_encode($reg->CodComponente);
            $cri_agrupador = base64_encode($reg->Agrupador);
            $tab .= '    <tr>';
            $tab .= '      <td>' . $reg->Agrupador . '</td>';
            $tab .= '      <td>' . $reg->Descricao . '</td>';
            $tab .= '      <td>' . $reg->UnidadeMedida . '</td>';
            $tab .= '      <td>';
            $tab .= '        <a href="javascript:void(0);" onclick="javascript:fntEditaValorRef(\'' . $cri_codexame . '\',\'' . $cri_codcompo . '\', \'' . $cri_agrupador . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
            $tab .= '        <a href="javascript:void(0);" onclick="javascript:fntDeletaValorRef(\'' . $cri_codexame . '\',\'' . $cri_codcompo . '\', \'' . $cri_agrupador . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a>';
            $tab .= '      </td>';
            $tab .= '    </tr>';
        }
        $tab .= '  </tbody>';
        $tab .= '</table>';
    } else {
        $tab = "<br />@lng[Nenhum valor de referência cadastrado]";
    }
    $tpl = str_replace("<!--tabela-->", $tab, $tpl);
    echo Comuns::Idioma($tpl);
}
Exemplo n.º 11
0
 public function ListaTabela($pagina = 1, $nporpagina = 10)
 {
     $ini = $pagina * $nporpagina - $nporpagina;
     $sql = "select  p.Codigo, case when length(pt.Texto) > 50 then concat(left(pt.Texto, 50), '...') else pt.Texto end as Texto ";
     $sql .= "\t\t,u.Codigo as CodAutor, u.NomeCompleto as Autor, cp.Descricao as Classe, tp.Descricao as Tipo, p.Ativo ";
     $sql .= "from mespergunta p ";
     $sql .= "inner join mesclassepergunta cp on cp.Codigo = p.CodClass ";
     $sql .= "inner join mesperguntatexto pt on pt.CodPergunta = p.Codigo and pt.Linha = 1 ";
     $sql .= "inner join mesusuario u on u.Codigo = p.Codusuario ";
     $sql .= "inner join mestipopergunta tp on tp.Codigo = p.CodTipo LIMIT " . $ini . ", " . $nporpagina . ";";
     $cnn = Conexao2::getInstance();
     $q = $cnn->prepare($sql);
     $q->execute();
     if ($q->rowCount() > 0) {
         $ret = Comuns::TopoTabelaListagem("Lista de Exercícios", "PerguntasCad", array('Descrição', 'Autor', 'Classe', 'Tipo', 'Ativo', 'Ações'));
         while ($rs = $q->fetch(PDO::FETCH_OBJ)) {
             $cod = base64_encode($rs->Codigo);
             $ret .= '<tr>';
             $ret .= '  <td>' . $rs->Texto . '</td>';
             $ret .= '  <td>' . $rs->Autor . '</td>';
             $ret .= '  <td>' . $rs->Classe . '</td>';
             $ret .= '  <td>' . $rs->Tipo . '</td>';
             // Exibe o status atual da pergunta.
             if ($rs->Ativo == 1) {
                 $ret .= '  <td><a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAA\', \'' . $cod . '\');">' . Comuns::IMG_STATUS_ATIVO . '</a></td>';
                 $ret = str_replace("##id##", 'id="' . $cod . '"', $ret);
             } else {
                 $ret .= '  <td><a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAA\', \'' . $cod . '\');">' . Comuns::IMG_STATUS_INATIVO . '</a></td>';
                 $ret = str_replace("##id##", 'id="' . $cod . '"', $ret);
             }
             $ret .= '  <td>';
             $ret .= '    <a href="vwpergunta.php?r=' . $cod . '">' . Comuns::IMG_ACAO_EDITAR . '</a>';
             $ret = str_replace("##id##", "", $ret);
             $ret .= '    <a href="vwalternativas.php?p=' . $cod . '">' . Comuns::IMG_ACAO_OPCOES . '</a>';
             // O Autor da pergunta é o único que pode excluir ela.
             if ($this->usuario == $rs->CodAutor) {
                 $ret .= '    <a href="javascript:void(0);" onclick="javascript:fntExcluirPergunta(' . $cod . ');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                 $ret = str_replace("##id##", "", $ret);
             }
             $ret .= '  </td>';
             $ret .= '</tr>';
         }
         $ret .= '  </tbody>';
         $ret .= '</table>';
         $registros = Comuns::NRegistros("mespergunta");
         if ($registros > 0) {
             $ret .= Comuns::GeraPaginacao($registros, $pagina, $nporpagina, $this->form);
         }
     } else {
         $ret = "@lng[Nenhuma pergunta cadastrada]";
     }
     return $ret;
 }
Exemplo n.º 12
0
function TratarDadosExameFisico($template)
{
    if (isset($_SESSION['caso']) && $_SESSION['caso'] != 0) {
        $ef = new ExameFisico();
        $mid = new Midia();
        $ef->Carrega($_SESSION['caso']);
        $template = str_replace("<!--txtExaFisCabeca-->", $ef->getCabeca(), $template);
        $template = str_replace("<!--txtExaFisPescoco-->", $ef->getPescoco(), $template);
        $template = str_replace("<!--txtExaFisAusPulmonar-->", $ef->getAuscultapulmonar(), $template);
        $template = str_replace("<!--txtExaFisAusCardiaca-->", $ef->getAuscultacardiaca(), $template);
        $template = str_replace("<!--txtExaFisSinVit-->", $ef->getSinaisvitais(), $template);
        $template = str_replace("<!--txtExaFisAbdomen-->", $ef->getAbdomen(), $template);
        $template = str_replace("<!--txtExaFisPele-->", $ef->getPele(), $template);
        $template = str_replace("<!--txtExaFisExtrem-->", $ef->getExtremidades(), $template);
        $template = str_replace("<!--txtExaFisGeral-->", $ef->getEstadoGeral(), $template);
        $template = str_replace("<!--midCabeca-->", $ef->getMidiasCabeca(), $template);
        $template = str_replace("<!--midPescoco-->", $ef->getMidiasPescoco(), $template);
        $template = str_replace("<!--midAusPulmonar-->", $ef->getMidiasAuscultaPulmonar(), $template);
        $template = str_replace("<!--midAusCardiaca-->", $ef->getMidiasAuscultaCardiaca(), $template);
        $template = str_replace("<!--midAbdomen-->", $ef->getMidiasAbdomen(), $template);
        $template = str_replace("<!--midExtrem-->", $ef->getMidiasExtremidades(), $template);
        $template = str_replace("<!--midPele-->", $ef->getMidiasPele(), $template);
        $template = str_replace("<!--midSinVit-->", $ef->getMidiasSinaisVitais(), $template);
        $template = str_replace("<!--midGeral-->", $ef->getMidiasEstadoGeral(), $template);
        $mid->setCodCaso($_SESSION['caso']);
        $lista_midias = $mid->ListaRecordSet();
        if ($lista_midias) {
            $tabmidias = Comuns::TopoTabelaListagem("", "tabMidias", array('&nbsp;', 'Mídia', 'Tipo'));
            foreach ($lista_midias as $midia) {
                $tabmidias .= '<tr>';
                $tabmidias .= '<td><input type="checkbox" name="chkMidia[]" id="chkMidia_' . $midia->CodMidia . '" value="' . $midia->CodMidia . '" class="chkmidias"></td>';
                $tabmidias .= '<td>' . $midia->Descricao . '</td>';
                $tabmidias .= '<td>' . ($midia->CodTipo == 1 ? Comuns::IMG_MIDIA_IMAGEM : ($midia->CodTipo == 2 ? Comuns::IMG_MIDIA_VIDEO : Comuns::IMG_MIDIA_AUDIO)) . '</td>';
                $tabmidias .= '</tr>';
            }
            $tabmidias .= '</body></table>';
            $template = str_replace("<!--midias-->", $tabmidias, $template);
        } else {
            $template = str_replace("<!--midias-->", $mid->getErro(), $template);
        }
    } else {
        $template = str_replace("<!--txtExaFisCabeca-->", "", $template);
        $template = str_replace("<!--txtExaFisPescoco-->", "", $template);
        $template = str_replace("<!--txtExaFisAusPulmonar-->", "", $template);
        $template = str_replace("<!--txtExaFisAusCardiaca-->", "", $template);
        $template = str_replace("<!--txtExaFisSinVit-->", "", $template);
        $template = str_replace("<!--txtExaFisAbdomen-->", "", $template);
        $template = str_replace("<!--txtExaFisPele-->", "", $template);
        $template = str_replace("<!--txtExaFisExtrem-->", "", $template);
        $template = str_replace("<!--txtExaFisGeral-->", "", $template);
        $template = str_replace("<!--midCabeca-->", "0", $template);
        $template = str_replace("<!--midPescoco-->", "0", $template);
        $template = str_replace("<!--midAusPulmonar-->", "0", $template);
        $template = str_replace("<!--midAusCardiaca-->", "0", $template);
        $template = str_replace("<!--midAbdomen-->", "0", $template);
        $template = str_replace("<!--midExtrem-->", "0", $template);
        $template = str_replace("<!--midPele-->", "0", $template);
        $template = str_replace("<!--midSinVit-->", "0", $template);
        $template = str_replace("<!--midGeral-->", "0", $template);
    }
    return $template;
}
Exemplo n.º 13
0
 public function Lista($codcaso)
 {
     try {
         $sql = "select CodCaso, CodTratamento, ";
         $sql .= "case when length(Titulo) > 75 then concat(left(Titulo, 75), '...') else Titulo end as Descricao, ";
         $sql .= "Correto, Justificativa, ConteudoAdicional ";
         $sql .= "from mescasotratamento ";
         $sql .= "where CodCaso = :pCodCaso;";
         $cnn = Conexao2::getInstance();
         $cmd = $cnn->prepare($sql);
         $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
         $cmd->execute();
         if ($cmd->rowCount() > 0) {
             $tiporesp = Caso::BuscaConfiguracao($codcaso, "tratamentos", "TipoResp");
             switch ($tiporesp) {
                 case "CE":
                     $labelResposta = "@lng[Correto]";
                     break;
                 case "ORD":
                     $labelResposta = "@lng[Indicação (ordem)]";
                     break;
             }
             $tabela = Comuns::TopoTabelaListagem("Tratamentos cadastrados", "tratcad", array("Descrição", $labelResposta, "Ações"));
             while ($tratamento = $cmd->fetch(PDO::FETCH_OBJ)) {
                 $tabela .= '<tr>';
                 $tabela .= '  <td>' . $tratamento->Descricao . '</td>';
                 $tabela .= '  <td>' . ($tiporesp == "CE" ? SimNao::Descreve($tratamento->Correto) : $tratamento->Correto) . '</td>';
                 $tabela .= '  <td>';
                 $tabela .= '    <a href="javascript:void(0);" onclick="javascript:fntExibeCadastroEtapa(\'' . base64_encode($tratamento->CodTratamento) . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
                 $tabela .= '    <a href="javascript:void(0);" onclick="javascript:fntDeletaTratamento(\'' . base64_encode($tratamento->CodTratamento) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                 $tabela .= '  </td>';
                 $tabela = str_replace("##id##", "", $tabela);
                 $tabela .= "</tr>";
             }
             $tabela .= "</tbody></table>";
         } else {
             $tabela = "@lng[Nenhum tratamento cadastrado até o momento]";
         }
     } catch (PDOException $ex) {
         $this->msg_erro = $ex->getMessage();
         $tabela = $this->msg_erro;
     }
     header('Content-Type: text/html; charset=iso-8859-1');
     return $tabela;
 }
Exemplo n.º 14
0
 /**
  * Retorna uma string em formato de tabela com os registros de Tipos de pergunta limitado pelo paginador.
  */
 public function ListaTabela($pagina = 1, $nporpagina = 10)
 {
     $ini = $pagina * $nporpagina - $nporpagina;
     $sql = "SELECT Codigo, Descricao ";
     $sql .= "FROM mestipopergunta LIMIT " . $ini . ", " . $nporpagina . ";";
     $cnn = new Conexao();
     $rs = $cnn->Consulta($sql);
     if (mysql_num_rows($rs)) {
         $ret = Comuns::TopoTabelaListagem("Lista de Tipos de pergunta", "TiposPergunta", array('Descrição', 'Ações'));
         while ($linha = mysql_fetch_array($rs)) {
             $cod = base64_encode($linha["Codigo"]);
             $ret .= '    <tr>';
             $ret .= '      <td>' . $linha["Descricao"] . '</td>';
             $ret .= '      <td><a href="cadastro.php?t=' . $this->form . '&r=' . $cod . '">E</a> | <a href="javascript:void(0);" onclick="javascript:fntExcluiGrupoUsuario(' . $cod . ')">X</a></td>';
             $ret .= '    </tr>';
         }
         $ret .= '  </tbody>';
         $ret .= '</table>';
         $registros = Comuns::NRegistros("mesGrupoUsuario");
         if ($registros > 0) {
             $ret .= Comuns::GeraPaginacao($registros, $pagina, $nporpagina, $this->form);
         }
     } else {
         $ret = "@lng[Nenhum tipo de pergunta cadastrado]";
     }
     return $ret;
 }
Exemplo n.º 15
0
 public function RetornaListaConfAnexos($strChaveAtual)
 {
     $sql = "select CodConteudo, TipoConteudo ";
     $sql .= "from mescasomontagemanexos ";
     $sql .= "where CodCaso = :pCodCaso ";
     $sql .= "  and CodMontagem = 1 ";
     $sql .= "  and CodChave = :pCodChave ";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->bindParam(":pCodCaso", $this->codcaso, PDO::PARAM_INT);
     $cmd->bindParam(":pCodChave", $strChaveAtual, PDO::PARAM_STR);
     $cmd->execute();
     if ($cmd->errorCode() == Comuns::QUERY_OK) {
         if ($cmd->rowCount() > 0) {
             $html = Comuns::TopoTabelaListagem("", "tabAnexos", array('Descrição', 'Tipo', 'Ações'));
             while ($linha = $cmd->fetch(PDO::FETCH_OBJ)) {
                 if ($linha->TipoConteudo == 'C') {
                     $c = new Conteudo();
                     $c->Carrega($this->codcaso, $linha->CodConteudo);
                     $html .= '<tr>';
                     $html .= '<td>' . $c->getDescricao() . '</td>';
                     $html .= '<td>@lng[Hipertexto]</td>';
                     $html .= '<td>';
                     $html .= '<a href="javascript:void(0);" onclick="javascript:fntDeletaAnexo(\'' . base64_encode($strChaveAtual) . '\', \'C' . base64_encode($linha->CodConteudo) . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                     $html .= '</td>';
                     $html .= '</tr>';
                 } else {
                     $m = new Midia();
                     $m->setCodCaso($this->codcaso);
                     $m->setCodMidia($linha->CodConteudo);
                     $m->CarregaPorCodigoEspecifico();
                     $html .= '<tr>';
                     $html .= '<td>' . $m->getDescricao() . '</td>';
                     $html .= '<td>' . Comuns::DescreveTipoMidia($m->getTipoMidia()) . '</td>';
                     $html .= '<td>';
                     $html .= '<a href="javascript:void(0);" onclick="javascript:fntDeletaAnexo(\'' . base64_encode($strChaveAtual) . '\', \'M' . base64_encode($linha->CodConteudo) . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                     $html .= '</td>';
                     $html .= '</tr>';
                 }
             }
             return $html;
         } else {
             return '<strong>@lng[Nenhum item cadastrado]</strong>';
         }
     } else {
         $msg = $cmd->errorInfo();
         $this->msg_erro = $msg[2];
         return false;
     }
 }
Exemplo n.º 16
0
function fntRetornaAgrupadoresDePerguntas()
{
    if (isset($_SESSION['caso']) && $_SESSION['caso'] > 0) {
        $gp = new GrupoPergunta();
        $lista = $gp->ListaAgrupamentosCaso($_SESSION['caso']);
        if ($lista != false && count($lista) > 0) {
            $html = Comuns::TopoTabelaListagem("", "tabAgrupadores", array('&nbsp;', 'Agrupador', 'Núm. exercícios'));
            foreach ($lista as $gperg) {
                $html .= '<tr>';
                $html .= '<td><input type="checkbox" id="chk_grupo-perg_' . $gperg->CodAgrupamento . '" class="item_arvore"></td>';
                $html .= '<td><span id="spn_grupo-perg_' . $gperg->CodAgrupamento . '">' . $gperg->Texto . '</span></td>';
                $html .= '<td>' . $gperg->Perguntas . '</td>';
                $html .= '</tr>';
            }
            $html .= "</tbody></table>";
            return $html;
        } else {
            return "@lng[Nenhum agrupamento de exercícios cadastrado/vinculado ao caso clínico]";
        }
    } else {
        return "@lng[Caso não encontrado]";
    }
}
Exemplo n.º 17
0
 public function Lista($codcaso)
 {
     try {
         $sql = "select CodCaso, CodDesfecho, ";
         $sql .= "case when length(Titulo) > 40 then concat(left(Titulo, 40), '...') else Titulo end as Desfecho ";
         $sql .= "from mescasodesfecho ";
         $sql .= "where CodCaso = :pCodCaso;";
         $cnn = Conexao2::getInstance();
         $cmd = $cnn->prepare($sql);
         $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
         $cmd->execute();
         if ($cmd->rowCount() > 0) {
             $tabela = Comuns::TopoTabelaListagem("Desfechos cadastrados", "desfcad", array("Descrição", "Ações"));
             while ($desfecho = $cmd->fetch(PDO::FETCH_OBJ)) {
                 $tabela .= '<tr>';
                 $tabela .= '<td>' . $desfecho->Desfecho . "</td>";
                 $tabela .= '<td>';
                 $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntExibeCadastroEtapa(\'' . base64_encode($desfecho->CodDesfecho) . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
                 $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntDeletaDesfecho(\'' . base64_encode($desfecho->CodDesfecho) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                 $tabela .= '</td>';
                 $tabela = str_replace("##id##", "", $tabela);
                 $tabela .= "</tr>";
             }
             $tabela .= "</tbody></table>";
         } else {
             $tabela = "@lng[Nenhum desfecho cadastrado até o momento]";
         }
     } catch (PDOException $ex) {
         $this->msg_erro = $ex->getMessage();
         $tabela = $this->msg_erro;
     }
     header('Content-Type: text/html; charset=iso-8859-1');
     return $tabela;
 }
Exemplo n.º 18
0
 public function ListaTabela($pagina = 1, $nporpagina = 20)
 {
     $ini = $pagina * $nporpagina - $nporpagina;
     $sql = "SELECT Codigo, Texto ";
     $sql .= "FROM mesperguntaagrupador LIMIT " . $ini . ", " . $nporpagina . ";";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->execute();
     if ($cmd->rowCount() > 0) {
         $ret = Comuns::TopoTabelaListagem("Lista de agrupadores de pergunta", "AgrupPerg", array('Texto', 'Ações'));
         while ($linha = $cmd->fetch(PDO::FETCH_OBJ)) {
             $cod = base64_encode($linha->Codigo);
             $ret .= '<tr>';
             $ret .= '  <td>' . $linha->Texto . '</td>';
             $ret .= '  <td>';
             $ret .= '    <a href="cadastro.php?t=' . $this->form . '&r=' . $cod . '">' . Comuns::IMG_ACAO_EDITAR . '</a>&nbsp;';
             $ret .= '    <a href="vwagrupador.php?c=' . $cod . '">' . Comuns::IMG_ACAO_COMPONENTES . '</a>&nbsp;';
             $ret .= '    <a href="javascript:void(0);" onclick="javascript:fntDeletaGrupoPergunta(\'' . $cod . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a>&nbsp;';
             $ret = str_replace("##id##", 'id="' . $cod . '"', $ret);
             $ret .= '  </td>';
             $ret .= '</tr>';
         }
         $ret .= '  </tbody>';
         $ret .= '</table>';
         $registros = Comuns::NRegistros("mesperguntaagrupador");
         if ($registros > 0) {
             $ret .= Comuns::GeraPaginacao($registros, $pagina, $nporpagina, $this->form);
         }
     } else {
         $ret = "@lng[Nenhum agrupador de pergunta cadastrado]";
     }
     return $ret;
 }
Exemplo n.º 19
0
 public function ListaTabela($pagina = 1, $nporpagina = 10, $usuario = "", $filtros = "")
 {
     $ini = $pagina * $nporpagina - $nporpagina;
     $sql = "select  c.Codigo ";
     $sql .= "\t\t,c.Nome ";
     $sql .= "\t\t,c.Descricao ";
     $sql .= "\t\t,concat(c.CodArea, ' - ', a.Descricao) as AreaConhecimento ";
     $sql .= "\t\t,n.Descricao as Dificuldade ";
     $sql .= "\t\t,c.DaResposta ";
     $sql .= "\t\t,c.Ativo ";
     $sql .= "from mescaso c ";
     $sql .= "inner join mesnivelpergunta n ";
     $sql .= "\t\ton n.Codigo = c.CodNivelDif ";
     $sql .= "inner join mesarea a ";
     $sql .= "\t\ton a.Codigo = c.CodArea ";
     $sql .= "where c.Excluido = 0 " . $filtros;
     $sqlcount = "select COUNT(*) FROM mescaso c where c.Excluido = 0 " . $filtros;
     if ($usuario != "") {
         $usuario = unserialize($usuario);
         $isAdmin = $usuario->TemGrupo(1);
         /* Verifica se tem permissão de Administrador */
         $sql .= "  AND (c.Publico = 1 ";
         $sql .= "\tOR (c.Publico = 0 AND c.CodAutor = " . $usuario->getCodigo() . ") ";
         $sql .= "\tOR c.Codigo IN (SELECT CodCaso FROM mescasocolaborador mcol WHERE mcol.CodUsuario = " . $usuario->getCodigo() . ") ";
         $sql .= $isAdmin ? "   OR c.Codigo = c.Codigo) " : ")";
         $sqlcount .= "  AND (c.Publico = 1 ";
         $sqlcount .= "\t OR (c.Publico = 0 AND c.CodAutor = " . $usuario->getCodigo() . ") ";
         $sqlcount .= "\t OR c.Codigo IN (SELECT CodCaso FROM mescasocolaborador mcol WHERE mcol.CodUsuario = " . $usuario->getCodigo() . ") ";
         $sqlcount .= $isAdmin ? "   OR c.Codigo = c.Codigo) " : ")";
     }
     $sql .= "LIMIT " . $ini . ", " . $nporpagina . ";";
     Log::RegistraLog("Comando SQL: " . $sql);
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->execute();
     if ($cmd->rowCount() > 0) {
         $ret = Comuns::TopoTabelaListagem("Casos de estudo cadastrados", "casos", array('Nome', 'Descrição', 'Área de conhecimento', 'Nível Dif.', 'Ativo', 'Ações'));
         while ($rs = $cmd->fetch(PDO::FETCH_OBJ)) {
             $cod = base64_encode($rs->Codigo);
             $ret .= '<tr>';
             $ret .= '  <td>' . $rs->Nome . '</td>';
             $ret .= '  <td>' . $rs->Descricao . '</td>';
             $ret .= '  <td>' . $rs->AreaConhecimento . '</td>';
             $ret .= '  <td>' . $rs->Dificuldade . '</td>';
             //$ret .= '  <td>' . SimNao::Descreve($rs->DaResposta) . '</td>';
             if ($rs->Ativo == 1) {
                 $ret .= '  <td><a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAE\', \'' . $cod . '\');">' . Comuns::IMG_STATUS_ATIVO . '</a></td>';
                 $ret = str_replace("##id##", 'id="' . $cod . '"', $ret);
             } else {
                 $ret .= '  <td><a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAE\', \'' . $cod . '\');">' . Comuns::IMG_STATUS_INATIVO . '</a></td>';
                 $ret = str_replace("##id##", 'id="' . $cod . '"', $ret);
             }
             $ret .= '  <td><a href="vwcaso.php?cod=' . $cod . '">' . Comuns::IMG_ACAO_EDITAR . '</a></td>';
             $ret = str_replace("##id##", "", $ret);
             $ret .= '</tr>';
         }
         $ret .= '  </tbody>';
         $ret .= '</table>';
         $registros = Comuns::NRegistros("mescaso", $sqlcount);
         if ($registros > 0) {
             $ret .= Comuns::GeraPaginacao($registros, $pagina, $nporpagina, $this->form, "fntNavegaTab", true);
         }
     } else {
         $ret = "@lng[Nenhum item cadastrado até o momento]";
     }
     return $ret;
 }
Exemplo n.º 20
0
 public function ListaHipotesesCaso($codcaso)
 {
     try {
         $sql = "select CodHipotese, Descricao, Correto, Justificativa, ConteudoAdicional ";
         $sql .= "from mescasohipotdiagn hip ";
         $sql .= "where hip.CodCaso = :pCodCaso;";
         $cnn = Conexao2::getInstance();
         $cmd = $cnn->prepare($sql);
         $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
         $cmd->execute();
         if ($cmd->rowCount() > 0) {
             $tiporesp = Caso::BuscaConfiguracao($codcaso, "hipoteses", "TipoResp");
             switch ($tiporesp) {
                 case "CE":
                     $labelResposta = "Correto";
                     break;
                 case "ORD":
                     $labelResposta = "Ordem de chance";
                     break;
             }
             $tabela = Comuns::TopoTabelaListagem("Hipóteses cadastradas", "hipoteses", array("Nome", $labelResposta, "Ações"));
             while ($hipotese = $cmd->fetch(PDO::FETCH_OBJ)) {
                 $tabela .= '<tr>';
                 $tabela .= '  <td>' . $hipotese->Descricao . "</td>";
                 $tabela .= '  <td>' . ($tiporesp == "CE" ? SimNao::Descreve($hipotese->Correto) : $hipotese->Correto) . "</td>";
                 $tabela .= '  <td>';
                 $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntExibeCadastroEtapa(\'' . base64_encode($hipotese->CodHipotese) . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
                 $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntDeletaHipotese(\'' . base64_encode($hipotese->CodHipotese) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                 $tabela .= '  </td>';
                 $tabela = str_replace("##id##", "", $tabela);
                 $tabela .= "</tr>";
             }
             $tabela .= "</tbody></table>";
         } else {
             $tabela = "@lng[Nenhuma hipótese cadastrada até o momento]";
         }
     } catch (PDOException $ex) {
         $this->msg_erro = $ex->getMessage();
         $tabela = $this->msg_erro;
     }
     header('Content-Type: text/html; charset=iso-8859-1');
     return $tabela;
 }
Exemplo n.º 21
0
 public function ListaMidiasVinculados($codcaso)
 {
     $sql = "select distinct exmidia.CodCaso ";
     $sql .= "\t\t,exmidia.NumBateria ";
     $sql .= "\t\t,exmidia.CodExame ";
     $sql .= "\t\t,case when exmidia.CodExame <> -1 then ex.Descricao else 'Nenhum expecífico' end as Exame ";
     $sql .= "\t\t,exmidia.CodMidia ";
     $sql .= "\t\t,midia.Descricao ";
     $sql .= "from mescasoexamesmidia exmidia ";
     $sql .= "inner join mescasoexames ex ";
     $sql .= "\t\ton ex.CodCaso = exmidia.CodCaso ";
     //$sql .= "	   and ex.NumBateria = exmidia.NumBateria ";
     $sql .= "\t   and ex.CodExame = case when exmidia.CodExame <> -1 then exmidia.codexame else ex.CodExame end ";
     $sql .= "inner join mesmidia midia ";
     $sql .= "\t\ton midia.CodCaso = exmidia.CodCaso ";
     $sql .= "\t   and midia.CodMidia = exmidia.CodMidia ";
     $sql .= "where exmidia.CodCaso = :pCodCaso;";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
     $cmd->execute();
     if ($cmd->errorCode() == Comuns::QUERY_OK) {
         if ($cmd->rowCount() > 0) {
             $ret = Comuns::TopoTabelaListagem("Mídias já vinculadas aos exames", "tabMidVinc", array("Exame", "Mídia", "Ações"));
             while ($linha = $cmd->fetch(PDO::FETCH_OBJ)) {
                 $ret .= '<tr>';
                 //$ret .= '<td>' . $linha->NumBateria . '</td>';
                 $ret .= '<td>' . $linha->Exame . '</td>';
                 $ret .= '<td>' . $linha->Descricao . '</td>';
                 $ret .= '<td><a href="javascript:void(0);" onclick="fntDeletaConteudosExames(\'M' . base64_encode($linha->CodMidia) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a></td>';
                 $ret = str_replace("##id##", "", $ret);
                 $ret .= '</tr>';
             }
             $ret .= "</tbody></table>";
         } else {
             $ret = "@lng[Nenhuma mídia criada até o momento]";
         }
         return $ret;
     } else {
         $msg = $cmd->errorInfo();
         $this->msg_erro = $msg[2];
         return false;
     }
 }
Exemplo n.º 22
0
 public function Lista($codcaso)
 {
     $sql = "select CodDiagnostico, Descricao, Correto, Justificativa, ConteudoAdicional ";
     $sql .= "from mescasodiagnostico diag ";
     $sql .= "where diag.CodCaso = :pCodCaso;";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
     $cmd->execute();
     if ($cmd->rowCount() > 0) {
         $tiporesp = Caso::BuscaConfiguracao($codcaso, "diagnosticos", "TipoResp");
         switch ($tiporesp) {
             case "CE":
                 $labelResposta = "Correto";
                 break;
             case "ORD":
                 $labelResposta = "Chance";
                 break;
         }
         $tabela = Comuns::TopoTabelaListagem("Diagnósticos cadastradas", "diags", array("Descrição", $labelResposta, "Ações"));
         while ($diagnostico = $cmd->fetch(PDO::FETCH_OBJ)) {
             $tabela .= '<tr>';
             $tabela .= '  <td>' . $diagnostico->Descricao . "</td>";
             $tabela .= '  <td>' . ($tiporesp == "CE" ? SimNao::Descreve($diagnostico->Correto) : $diagnostico->Correto) . "</td>";
             $tabela .= '  <td>';
             $tabela .= '    <a href="javascript:void(0);" onclick="javascript:fntExibeCadastroEtapa(\'' . base64_encode($diagnostico->CodDiagnostico) . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
             $tabela .= '    <a href="javascript:void(0);" onclick="javascript:fntDeletaDiagnostico(\'' . base64_encode($diagnostico->CodDiagnostico) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
             $tabela .= '  </td>';
             $tabela = str_replace("##id##", "", $tabela);
             $tabela .= "</tr>";
         }
         $tabela .= "</tbody></table>";
     } else {
         $tabela = "@lng[Nenhum diagnóstico cadastrado até o momento]";
     }
     return $tabela;
 }
Exemplo n.º 23
0
 public function ListaTabela($pagina = 1, $nporpagina = 10, $usu = null, $filtros = "")
 {
     $ini = $pagina * $nporpagina - $nporpagina;
     $sql = "select Codigo, Descricao, Ativo, TemComponentes ";
     $sql .= "from mestipoexame WHERE 1=1 " . $filtros . " ORDER BY Descricao LIMIT " . $ini . ", " . $nporpagina . ";";
     Log::RegistraLog($sql);
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->execute();
     if ($cmd->rowCount() > 0) {
         $ret = Comuns::TopoTabelaListagem("Tipos de exames cadastrados", "exames", array('Descrição', 'Ativo', 'Ações'));
         while ($rs = $cmd->fetch(PDO::FETCH_OBJ)) {
             $cod = base64_encode($rs->Codigo);
             $ret .= '<tr>';
             $ret .= '  <td>' . $rs->Descricao . '</td>';
             if ($rs->Ativo == 1) {
                 $ret .= '  <td><a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAF\', \'' . $cod . '\');">' . Comuns::IMG_STATUS_ATIVO . '</a></td>';
                 $ret = str_replace("##id##", 'id="' . $cod . '"', $ret);
             } else {
                 $ret .= '  <td><a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAF\', \'' . $cod . '\');">' . Comuns::IMG_STATUS_INATIVO . '</a></td>';
                 $ret = str_replace("##id##", 'id="' . $cod . '"', $ret);
             }
             $ret .= '  <td>';
             $ret .= '    <a href="cadastro.php?t=' . $this->form . '&r=' . $cod . '">' . Comuns::IMG_ACAO_EDITAR . '</a>';
             $ret = str_replace("##id##", "", $ret);
             if ($rs->TemComponentes == 1) {
                 $ret .= '  <a href="javascript:void(0);" onclick="javascript:fntAbreComponentes(\'' . $cod . '\');">' . Comuns::IMG_ACAO_COMPONENTES . '</a>';
             } else {
                 $ret .= '  <a href="javascript:void(0);" onclick="javascript:fntAbreValorRef(\'' . $cod . '\', \'' . base64_encode("0") . '\');">' . Comuns::IMG_ACAO_VALORES_REF . '</a>';
             }
             $ret .= '		<a href="javascript:void(0);" onclick="javascript:fntExcluiTipoExame(\'' . $cod . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a>';
             $ret .= '  </td>';
             $ret .= '</tr>';
         }
         $ret .= '  </tbody>';
         $ret .= '</table>';
         if ($filtros != "") {
             $sqlCount = "SELECT COUNT(*) AS Registros FROM mestipoexame WHERE 1=1 " . $filtros . ";";
         } else {
             $sqlCount = null;
         }
         $registros = Comuns::NRegistros("mestipoexame", $sqlCount);
         if ($registros > 0) {
             $ret .= Comuns::GeraPaginacao($registros, $pagina, $nporpagina, $this->form, "fntNavegaTab", true);
         }
     } else {
         $ret = "@lng[Nenhum item cadastrado até o momento]";
     }
     return $ret;
 }