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 = " "; } $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; }
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> <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; }
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> '; $ret .= ' <a href="vwagrupador.php?c=' . $cod . '">' . Comuns::IMG_ACAO_COMPONENTES . '</a> '; $ret .= ' <a href="javascript:void(0);" onclick="javascript:fntDeletaGrupoPergunta(\'' . $cod . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a> '; $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; }
public function ListaTabela($pagina = 1, $nporpagina = 10, $usuario = null, $filtros = "") { $ini = $pagina * $nporpagina - $nporpagina; $sql = "SELECT Codigo, NomeCompleto, NomeUsuario, Email, Ativo "; $sql .= "FROM mesusuario WHERE 1=1 " . $filtros . " LIMIT " . $ini . ", " . $nporpagina . ";"; $cnn = new Conexao(); $rs = $cnn->Consulta($sql); if (mysql_num_rows($rs) > 0) { $ret = Comuns::TopoTabelaListagem("Lista de Usuarios do sistema", "UsuSis", array('Nome', 'Usuário', 'E-mail', 'Ativo', 'Ações')); while ($linha = mysql_fetch_array($rs)) { $cod = base64_encode($linha["Codigo"]); $ret .= ' <tr>'; $ret .= ' <td>' . $linha["NomeCompleto"] . '</td>'; $ret .= ' <td>' . $linha["NomeUsuario"] . '</td>'; $ret .= ' <td>' . $linha["Email"] . '</td>'; $ret .= ' <td>'; if ($linha["Ativo"] == 1) { $ret .= '<a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAB\', \'' . $cod . '\')">' . Comuns::IMG_STATUS_ATIVO . '</a>'; $ret = str_replace("##id##", 'id="' . $cod . '"', $ret); } else { $ret .= '<a href="javascript:void(0);" onclick="javascript:fntAlteraStatus(\'AAAB\', \'' . $cod . '\')">' . 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> '; $ret .= ' <a href="javascript:void(0);" onclick="javascript:fntExcluiUsuario(\'' . $cod . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>'; $ret = str_replace("##id##", "", $ret); $ret .= ' </td>'; $ret .= ' </tr>'; } $ret .= ' </tbody>'; $ret .= '</table>'; if ($filtros != "") { $sqlCount = "SELECT COUNT(*) AS Registros FROM mesusuario WHERE 1=1 " . $filtros . ";"; } else { $sqlCount = null; } $registros = Comuns::NRegistros("mesusuario", $sqlCount); if ($registros > 0) { $ret .= Comuns::GeraPaginacao($registros, $pagina, $nporpagina, $this->form, "fntNavegaTab", true); } } else { $ret = "@lng[Nenhum usuário cadastrado]"; } return $ret; }
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; }
/** * 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; }
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; }
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; }