Exemple #1
0
function Main()
{
    $html = "";
    if ($_GET['id']) {
        $idioma = $_GET['id'];
        $sql = "select e.Codigo, e.Expressao, t.Expressao as Traducao ";
        $sql .= "from sisexpressoes e left outer join sistraducoes t on t.CodExpressao = e.Codigo and t.CodIdioma = :pCodIdioma ";
        $sql .= "order by e.Expressao";
        $cnn = Conexao2::getInstance();
        $cmd = $cnn->prepare($sql);
        $cmd->bindParam(":pCodIdioma", $idioma, PDO::PARAM_INT);
        $cmd->execute();
        $total = 0;
        $feito = 0;
        if ($cmd->errorCode() == Comuns::QUERY_OK) {
            $html = '<table class="listadados">';
            $html .= '<tr class="head"><th>@lng[Expressão]</th><th>@lng[Tradução]</th></tr>';
            while ($expressao = $cmd->fetch(PDO::FETCH_OBJ)) {
                $html .= '<tr>';
                $html .= '  <td><label>' . $expressao->Expressao . '</label></td>';
                $html .= '  <td>';
                $html .= '    <input type="text" name="exp_' . $expressao->Codigo . '" id="exp_' . $expressao->Codigo . '" value="' . ($expressao->Traducao == null ? '' : $expressao->Traducao) . '" class="campo campomedio" onblur="javascript:fntGravaTraducao(' . $expressao->Codigo . ');" /></td>';
                $html .= '    <input type="hidden" name="h_exp_' . $expressao->Codigo . '" id="h_exp_' . $expressao->Codigo . '" value="' . ($expressao->Traducao == null ? '' : $expressao->Traducao) . '" />';
                $html .= '  </td>';
                $html .= '</tr>';
                $total++;
                $feito += $expressao->Traducao == null ? 0 : 1;
            }
            $html .= '</table>';
            $html = '<div class="info-percentual">@lng[Percentual traduzido:] ' . $feito / $total * 100 . '%</div>' . $html;
        } else {
            $msg = $cmd->errorInfo();
            $html = $msg[2];
        }
    }
    $usu = unserialize($_SESSION['usu']);
    $tpl = file_get_contents("tpl/frm-idiomas.html");
    $idiomas = null;
    Comuns::ArrayObj("select Codigo, Nome from sisidiomas order by Nome", $idiomas);
    $cmbIdiomas = new ComboBox("selIdioma", $idiomas, "Codigo", "Nome", "0", "@lng[Selecione]");
    $cmbIdiomas->cssClass("campo");
    $cmbIdiomas->setSelectedValue($_GET['id'] ? $_GET['id'] : "0");
    $cmbIdiomas->Eventos(array("onchange" => "fntBuscaTraducoes()"));
    $botoes = Botao::BotaoNovo("fntAddExpressao();", "@lng[Adicionar expressão]");
    $botoes .= Botao::BotaoPesquisar("fntBuscaTraducoes();", "@lng[Buscar traduções]");
    $tpl = str_replace("<!--telatopo-->", Comuns::GeraTopoPagina($usu), $tpl);
    $tpl = str_replace("<!--itens-toolbar-->", $botoes, $tpl);
    $tpl = str_replace("<!--selIdioma-->", $cmbIdiomas->RenderHTML(), $tpl);
    $tpl = str_replace("<!--expressoes-->", $html, $tpl);
    header('Content-Type: text/html; charset=iso-8859-1');
    echo Comuns::Idioma($tpl);
}
Exemple #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);
}